Repository navigation
fix(opencode): retire a rolled-up subagent blocker on unknown-lineage idle - #22615
pullfrog[bot] wants to merge 2 commits into
Conversation
clearAttentionForSession retires a blocker only by sourceSessionID, so a descendant's question displayed on the root it rolled up to survives when the root's idle lands on the unknown-lineage branch. That branch is reachable: rootSessionById is bounded at 128 and a live blocker does not pin its root, so a long-lived process evicts the mapping and a failing re-lookup sends the idle to the fallback. Use clearAttentionForTurnEnd there too, matching the source or the rolled-up root; the Busy branch keeps the source-only clear so a live blocker still outranks Busy. Regression test evicts the root's cached ancestry with 130 session.created events, then fails the root lookup at idle; without the swap the last post stays SessionStart instead of SessionIdle.
|
The only real failure was a flaky test unrelated to this PR's opencode change: Root cause: the reset script's Fix: raise the test's target PID above any real Task list (6/6 completed)
|

Follow-up to #22604 (merged), closing the one remaining path from its review.
ELI5
When a subagent asks a question, Orca shows "needs input" on the pane. The merged fix retires that indicator when the root turn ends — but only if Orca still remembers which pane the subagent belongs to. In a long-lived session Orca can forget, and if the lookup is also failing at that moment, the indicator could stay stuck. This closes that gap.
What Changed
clearAttentionForTurnEnd(added in #22604) matches a blocker by its source session or the root session it is displayed on. #22604 wired it into the normal idle branch, but thechildState === nullfallback idle branch still usedclearAttentionForSession, which matches by source only.Before: root's cached lineage is evicted and its idle lookup fails → the fallback branch cannot match a child's rolled-up blocker → the pane stays on "needs input" after the turn.
After: the fallback branch retires it and the pane goes idle.
The
childState === null && Busybranch keeps the source-only clear, so a live blocker still outranks the root going Busy (the scope #22604 deliberately chose).Why
The branch is reachable, contrary to the review thread's initial conclusion. The reasoning there was that a root-displayed blocker implies a successful lookup, and success is cached, so the root's idle resolves from cache. That holds until the cache drops the entry:
rootSessionByIdis capped at 128 andrememberSessionRootevicts the oldest key — a live blocker does not pin its root. Once evicted, the root's idle re-looks up; during the SDK outage this branch exists to handle, that lookup fails,childStateisnull, and control reaches the fallback.Demonstrated by the new regression test: it resolves the child's ancestry (so the blocker is displayed on
ROOT), inserts 130session.createdevents to evictROOTfrom the 128-entry cache, then fails theROOTlookup at idle. WithclearAttentionForSessionthe final post staysSessionStart(the blocker survives); the swap makes itSessionIdle, for both plugin families.Linked Issue
Fixes #22371
Follow-up to #22604.
Visual Proof
N/A— the change is a status-lifecycle branch, no layout or interaction change. The proof is the hook-post sequence pinned by the new test: without the swap the last post isSessionStart; with it,SessionIdle { sessionID: ROOT }.Testing
New:
retires a root displayed child blocker when the root idle cannot resolve lineage. Mutation-checked — reverting the swap fails it withexpected 'SessionStart' to be 'SessionIdle'for bothopencodeandopencode2.pnpm test src/main/opencode src/main/opencode2 src/main/agent-hooks src/main/mimo→ 114 files passedpnpm tc:nodeclean;pnpm run check:code-quality:changed→ 0 findingsBoth pinned plugin digests move (the ownership source is shared with
mimo-code), same as fix(opencode): retire a subagent's blocker when the root turn ends #22604.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Authored by pullfrog/opencode while investigating the review thread on #22604.
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
docs/reference/agent-status-store.md.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm testpass locallyDeepSeek Flash(free via Pullfrog for OSS) | 𝕏