Repository navigation
fix(opencode2): only treat the question tool's form as a pane blocker - #22399
Conversation
OpenCode 2 has one form primitive and several producers, and Orca's setup bridge mapped every `form.created` to `question.asked` — the un-evictable "the pane owner must answer this" blocker. Against opencode v2.0.12 only `metadata.kind === "question"` is the agent's question tool; `websearch.provider` is a provider picker and `mcp-elicitation` is an MCP server prompt raised on sessionID "global", which is not a session and so can never be retired by that session going idle. Admit only the question kind, remember the admitted form ids, and drop `form.replied`/`form.cancelled` for forms that were never admitted so an ignored form's resolution cannot retire a live blocker. Evidence (live v2.0.12 capture, real TUI in a PTY against `opencode serve`) in docs/bug-reproductions/opencode2-form-created-kinds. That capture also shows the reported Subagents/Shell/Terminals dock and the agent picker emit no server event at all, so they were never the `form.created` source. Refs #22371
|
Warning Review limit reachedNext included review available in 9 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- Only the question tool's form blocks the pane.
form.creatednow requiresform.metadata.kind === "question"before mapping toquestion.asked, so thewebsearch.providerpicker andmcp-elicitationprompts stop minting Orca's un-evictable "needs input" blocker. Themcp-elicitationcase is the damaging one (sessionID: "global"can never be retired by session idle). - Symmetric resolution guard.
admittedQuestionFormIDs(module-scoped, cap 64, FIFO) remembers admitted form ids and dropsform.replied/form.cancelledfor forms Orca never admitted. - Tests + docs. Two new picker tests, one question/retire test, one "live blocker survives an ignored form" test; byte-digest re-pin in
hook-service.test.ts; captured form shapes underdocs/bug-reproductions/opencode2-form-created-kinds/(gated by a new.gitignoreallow-list).
The form.created kind guard is correct and load-bearing — stubbing it fails 4 tests. I have one minor note on the resolution guard inline: it isn't exercised by any test and the collision its Why comment describes isn't reachable, given the attention key is an exact tuple that already includes the form id.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Review was right that the admitted-form-id set defended against nothing. `clearAttentionForResolution` builds the exact key [factoryID, "AskUserQuestion", form.id, sourceSessionID] and returns null on a miss, with no session-wide fallback, and form ids are unique — so a resolution for a form Orca ignored already matches no live blocker. The guard's comment claimed a collision the key structure rules out, which is worse than no comment. Removes the set, its FIFO eviction helper, and the claim; the kind check on form.created is the whole fix. The end-to-end test stays: it pins the behavior that an MCP form raised and cancelled leaves a live question blocker standing, which is the property worth holding regardless of how it is achieved.
|
Good catch — you're right, and I verified it rather than taking it on faith. Dropped the guard in 6cf7934.
Since it was also unpinnable by any behavioral test — exactly as you found — keeping it would have meant carrying a module-scoped mutable Set plus a FIFO eviction helper for zero observable effect, with a comment asserting an invariant that isn't true. Removed all of it. The I kept the "keeps a live question blocker while an ignored form is raised and resolved" test. You're right that it passes either way, but that's the point — it pins the behavior (an MCP form raised and cancelled leaves a live question blocker standing), which is the property worth holding regardless of how the code achieves it. Re-pinned the plugin byte digest again. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Dropped the unreachable resolution guard.
6cf7934removesadmittedQuestionFormIDs, the FIFOadmitQuestionFormhelper, and theform.replied/form.cancelleddrop, addressing the prior review.clearAttentionForResolutionbuilds the exact key[factoryID, "AskUserQuestion", form.id, sessionID]and returnsnullon a miss with no session-wide fallback, so an ignored form's resolution already matches nothing; the rewritten comment now says so. - Kind check is the whole fix.
form.createdstill admits onlymetadata.kind === "question", and the end-to-end test that an ignored MCP form raised and cancelled leaves a live question blocker standing is retained (still passes). - Digest re-pin. The
hook-service.test.tsbyte digest was updated for the emitted plugin source; expected, since bothgetOpenCodePluginSource()andgetOpenCode2PluginSource()embedgetOpenCode2SetupSource(). - Unrelated reformat.
psRunnerinopencode-client-sweep.test.tsis a Prettier-only reflow; no behavior change.
Verified locally: pnpm test src/main/opencode/hook-plugin-opencode2-setup.test.ts src/main/opencode/hook-service.test.ts — 52 pass.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
#22399 admitted an OpenCode 2 form.created as a pane blocker only when metadata.kind === "question". On v2.0.15 that is an allow-list on a field with no contract: packages/schema/src/form.ts declares Metadata as an open Schema.Record and metadata itself as optional, and the public POST /api/session/:sessionID/form endpoint lets any client raise a real blocking form on a real session with no metadata. Orca dropped those, so the pane painted no blocker while OpenCode waited forever. Invert the default. Every form whose owner is a real session blocks; only a form owned by the "global" MCP-elicitation sentinel is dropped, because that owner is not a session and never goes idle, so its blocker could not be retired. That also restores websearch.provider as a blocker: it carries the real context.sessionID, session idle retires it, and while it is pending the agent is genuinely stalled on the user. Resolution is unchanged: clearAttentionForResolution keys on the exact form id plus source session, so a resolution for a dropped form matches nothing and cannot retire a live blocker.
…22548) stablyai#22399 admitted an OpenCode 2 form.created as a pane blocker only when metadata.kind === "question". On v2.0.15 that is an allow-list on a field with no contract: packages/schema/src/form.ts declares Metadata as an open Schema.Record and metadata itself as optional, and the public POST /api/session/:sessionID/form endpoint lets any client raise a real blocking form on a real session with no metadata. Orca dropped those, so the pane painted no blocker while OpenCode waited forever. Invert the default. Every form whose owner is a real session blocks; only a form owned by the "global" MCP-elicitation sentinel is dropped, because that owner is not a session and never goes idle, so its blocker could not be retired. That also restores websearch.provider as a blocker: it carries the real context.sessionID, session idle retires it, and while it is pending the agent is genuinely stalled on the user. Resolution is unchanged: clearAttentionForResolution keys on the exact form id plus source session, so a resolution for a dropped form matches nothing and cannot retire a live blocker. (cherry picked from commit f1eb191)

ELI5
When an agent asks you a question, Orca marks the pane "needs your answer" and won't clear it until you answer. OpenCode 2 uses the same internal "form" for several unrelated things — a web-search provider picker, and prompts raised by MCP servers. Orca treated all of them as questions from your agent. One of them can jam a pane in "needs input" with nothing you can do to clear it.
What Changed
src/main/opencode2/status-plugin-setup-source.tsmapped everyform.createdtoquestion.asked— Orca's un-evictable "the pane owner must answer this" blocker. It now admits only the agent's question tool, keyed onform.metadata.kind === "question".Every
Form.askcall site in the shippedopencode v2.0.12bundle, cross-checked against live captures:metadata.kindsessionIDquestionQuestionsquestiontoolwebsearch.providerChoose a web search providermcp-elicitation<server> is requesting input"global"mcp-elicitationis the damaging one."global"is not a session id, so the blocker it minted could never be retired by that session going idle — the pane stays "needs input" until an exactly-matchingform.replied/form.cancelledarrives, or the plugin is disposed.The guard is symmetric. Admitted form ids are remembered (bounded at 64, oldest evicted first) and a
form.replied/form.cancelledfor a form Orca never admitted is dropped. Without that, an ignored form's resolution shares the attention-key shape and would retire an unrelated live blocker.Why
Reported in #22371.
This PR does not close that issue, and I want to be explicit about why. The report attributes the stray "question" indicator to OpenCode 2's subagent menu. I set out to confirm that and disproved it: I drove the real TUI in a PTY against a real
opencode serve, opened the exactSubagents / Shell / Terminalsdock from the reporter's screenshot, and paged and dismissed it while reading the server's/api/eventstream. It carried nothing butserver.connectedand heartbeats. Same for theshift+tabagent picker and thectrl+pcommand palette. Those pickers are local Solid components in the TUI; they never callForm.askand emit no server event at all, so they were never theform.createdsource.What the investigation did surface is that the blanket mapping is wrong regardless — two of the three real form producers are not questions. That is worth fixing on its own, so it ships here, tagged
Refsrather thanFixes.Alternatives considered:
sessionID === "global". Catchesmcp-elicitationonly;websearch.providercarries a real session id and would still mint a blocker. An allow-list on the producer's own stamp is both narrower and more honest about intent.Also found while reading the retirement paths, not changed here: OpenCode 2 never emits
message.part.updated, and its question form carriesmetadata.tool = { messageID, id }rather than the{ messageID, callID }that Orca'sclearQuestionForToolPartmatches. That tool-completion retirement path is therefore dead code for OpenCode 2, leavingform.replied/form.cancelledand session idle as its only ways out. Worth a follow-up; out of scope here.Linked Issue
Refs #22371
Visual Proof
N/A— and the reason matters more than usual here.This changes which OpenCode 2 events become a pane blocker. A before/after screenshot would require making the app paint the blocker on demand, which needs a live MCP elicitation or a web-search provider prompt driven through a real agent turn — I could raise those forms on the server, but not through the genuine producers. Rather than stage a screenshot from a synthetic form and present it as the real path, the proof here is the captured event stream plus an end-to-end run of the real plugin.
Committed under
docs/bug-reproductions/opencode2-form-created-kinds/: the discriminator table, the liveform.created/form.repliedcaptures for thequestionkind, and the rendered PTY screen of the subagent dock that produced no events. (docs/**is gitignored behind an allow-list, so.gitignoregains!docs/bug-reproductions/**— AGENTS.md already points thehas_reprolabel at that directory, which did not yet exist.)End-to-end against the fixed plugin and a live server:
kind: "websearch.provider"form produced no hook postkind: "question"form producedAskUserQuestionTesting
Platforms: macOS, against the shipped
opencode v2.0.12binary.pnpm test src/main/opencode/ src/main/opencode2/— 11 files, 168 tests passpnpm test src/shared/agent-hook-listener src/main/agent-hooks— 1261 passpnpm tcclean;oxlintclean;pnpm run check:code-quality:changed— 0 new findingsThe new picker tests were checked for vacuousness: stubbing out the guard fails 4 of them. The plugin byte-digest test in
hook-service.test.tswas re-pinned, which is expected for any change to the emitted plugin source.Reviewer steps:
docs/bug-reproductions/opencode2-form-created-kinds/README.mdhas the exactopencode serve+ SSE commands to re-capture all three form shapes.AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
setup()bridge. For OpenCode 2, the only behavior change is that two form kinds stop minting a blocker.kind: "question"would stop blocking the pane — the agent's own prompt is still visible in the terminal, so the user sees it; they just don't get the sidebar indicator. The previous failure mode was a pane jammed in "needs input" with no way to clear it. The new one is strictly less harmful.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm testpass locally