agent.prompt behaves inconsistently between Codex OAuth and non-Codex providers #9384

Closed
opened 2026-02-16 18:12:19 -05:00 by yindo · 1 comment
Owner

Originally created by @dhruvkej9 on GitHub (Feb 15, 2026).

Originally assigned to: @thdxr on GitHub.

Hey team - I ran into something confusing while configuring OpenCode and I think this is a real behavior inconsistency.

When I set agent.build.prompt, it does not behave the same across providers:

  • Codex + OAuth path: my agent.prompt is added, while Codex base instructions still apply via options.instructions.
  • Non-Codex path: my agent.prompt replaces the provider fallback prompt (SystemPrompt.provider(...)).

So the same config key (agent.prompt) is effectively additive in one path and replacement in another path.

Why this is confusing

As a user, I expect one mental model:

  • either agent.prompt always appends,
  • or always replaces,
  • or there are separate explicit fields for append vs replace.

Right now behavior depends on provider/auth path, which is hard to predict and easy to misconfigure.

Code paths I checked (v1.2.4)

  • packages/opencode/src/session/llm.ts
    • around line 72: uses input.agent.prompt else SystemPrompt.provider(...) (non-Codex fallback)
    • around line 115: for Codex OAuth sets options.instructions = SystemPrompt.instructions()
  • packages/opencode/src/session/system.ts
    • instructions() returns Codex prompt header (PROMPT_CODEX)

Suggested fix

Please make semantics consistent across providers. For example:

  1. Keep agent.prompt strictly additive everywhere, and add a separate agent.prompt_replace if needed, or
  2. Keep agent.prompt replacement everywhere and add agent.prompt_append explicitly.

Even just documenting the current split behavior clearly would help in the short term.

Happy to test a patch if you want.

Originally created by @dhruvkej9 on GitHub (Feb 15, 2026). Originally assigned to: @thdxr on GitHub. Hey team - I ran into something confusing while configuring OpenCode and I think this is a real behavior inconsistency. When I set `agent.build.prompt`, it does not behave the same across providers: - **Codex + OAuth path**: my `agent.prompt` is added, while Codex base instructions still apply via `options.instructions`. - **Non-Codex path**: my `agent.prompt` replaces the provider fallback prompt (`SystemPrompt.provider(...)`). So the same config key (`agent.prompt`) is effectively **additive** in one path and **replacement** in another path. ## Why this is confusing As a user, I expect one mental model: - either `agent.prompt` always appends, - or always replaces, - or there are separate explicit fields for append vs replace. Right now behavior depends on provider/auth path, which is hard to predict and easy to misconfigure. ## Code paths I checked (v1.2.4) - `packages/opencode/src/session/llm.ts` - around line 72: uses `input.agent.prompt` else `SystemPrompt.provider(...)` (non-Codex fallback) - around line 115: for Codex OAuth sets `options.instructions = SystemPrompt.instructions()` - `packages/opencode/src/session/system.ts` - `instructions()` returns Codex prompt header (`PROMPT_CODEX`) ## Suggested fix Please make semantics consistent across providers. For example: 1. Keep `agent.prompt` strictly additive everywhere, and add a separate `agent.prompt_replace` if needed, or 2. Keep `agent.prompt` replacement everywhere and add `agent.prompt_append` explicitly. Even just documenting the current split behavior clearly would help in the short term. Happy to test a patch if you want.
yindo closed this issue 2026-02-16 18:12:19 -05:00
Author
Owner

@dhruvkej9 commented on GitHub (Feb 15, 2026):

Closing this one and reposting via the repo issue template so maintainers get the exact structured format. Reopening if needed.

@dhruvkej9 commented on GitHub (Feb 15, 2026): Closing this one and reposting via the repo issue template so maintainers get the exact structured format. Reopening if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9384