fix(chat-message): refresh stale session-agent cache from explicit input.agent#2965
Open
sjawhar wants to merge 1 commit intocode-yeongyu:devfrom
Open
fix(chat-message): refresh stale session-agent cache from explicit input.agent#2965sjawhar wants to merge 1 commit intocode-yeongyu:devfrom
sjawhar wants to merge 1 commit intocode-yeongyu:devfrom
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Fixes a stale cache bug by allowing explicit agent updates in the chat handler. The change is localized, logically sound, and includes a regression test.
…put.agent resolve: rebase conflict in chat-message test
9605378 to
7351a53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chat.messagereceives a turn with an explicitinput.agent, update the session-agent map unconditionally instead of ignoring it if a value already existsProblem
setSessionAgentuses first-write-wins semantics (only writes if key doesn't exist). This is correct for initial session setup (e.g.delegate-task/sync-task.tsinitializing a subagent session), but wrong inchat-message.tswhere OpenCode delivers an explicit agent on every turn.Any programmatic caller that sends
session.promptAsyncwith an explicitagentto an already-initialized session gets silently ignored — the session stays pinned to whatever agent was set first. This affects:opencode runwith--agenton a resumed sessionNormal TUI agent switching is unaffected (it goes through different code paths).
Changes
src/plugin/chat-message.ts(2 lines)updateSessionAgentalongside existingsetSessionAgentsetSessionAgent(input.sessionID, input.agent)withupdateSessionAgent(input.sessionID, input.agent)src/plugin/chat-message.test.ts(13 lines)input.agent = "build", verifies map updates to "build"Summary by cubic
Refreshes the session agent on every turn when
input.agentis provided, replacing first-write-wins behavior in the chat-message handler. Prevents sessions from sticking to the first-set agent for external callers, resumed sessions with--agent, and MCP clients.setSessionAgentwithupdateSessionAgentinsrc/plugin/chat-message.ts.Written for commit 7351a53. Summary will update on new commits.