Repository navigation
fix(omp): stop the tab spinner sticking after subagents finish - #23662
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between e548ddcb7fd235fd354892d29a8402706df34549 and bb5328beb65b093cd94f8c0893edf1a26af9f475. 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughAccepted OMP status events now mark lifecycle state as owning the pane. OMP child lifecycle events are ignored when the state does not own the pane. A child that starts after completion was posted resets completion tracking and marks the roster as waiting. New Pi and OMP tests cover child settlement timing, task-session event isolation, and ownership after extension reload. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The status change tracks helper completion, and the reload test verifies that completion is not reported before the helper finishes. No actionable merge-blocking risk remains in the reviewed changes. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The visible effect is limited to pane activity and completion notifications. Known child sessions are excluded, but it is not established how ownership behaves when session details are unavailable. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Issue 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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: c360b0a7-16c3-4952-8cdc-8a19270c83d3
📥 Commits
Reviewing files that changed from the base of the PR and between a9195ee and 3f93c4f73cadfca5c5c1895dbb575e75780179cd.
📒 Files selected for processing (5)
src/main/pi/agent-status-extension-async-subagents.test.tssrc/main/pi/agent-status-extension-omp-lifecycle.test.tssrc/main/pi/agent-status-handler-source.tssrc/main/pi/agent-status-subagent-roster-source.tssrc/main/pi/omp-session-status-owner-source.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
Important
The new ownsPaneStatus guard is a per-factory-invocation local, but the subagent roster it protects survives an in-process reload. After a reload the guard sees false and silently drops a child completion that would previously have settled the pane, so the OMP tab can stay stuck on the spinner.
Reviewed changes
- Late-helper re-open — a lifecycle
startedframe arriving after the run already reported done re-armswaiting/completionPostedGenerationand re-postsagent_start, so the helper's completion re-postsagent_end(Pi and OMP). - Leaked-helper reset — the new
resetSubagentRoster()runs on every OMPagent_startand replaces the duplicated inline clears insession_shutdown/session_switch. - Owner-only tracking — a new
ownsPaneStatusflag, set in theonStatuswrapper onceownsSessionStatus(ctx)passes, gates the rosteronEventso a task session's copy ignores lifecycle frames. - Tests — 11 new cases across the OMP lifecycle and Pi async-subagent suites; 9 fail with the production change reverted (reproduced locally, and the two guard cases pass on base as pre-existing behavior).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/pi/agent-status-extension-omp-lifecycle.test.ts (1)
273-273: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the reload assertion distinguish delayed and resumed
agent_endevents.When
agent_endruns whilechild-1is active, this test does not assert that no hook was posted. Its final assertion passes both when completion posts a newagent_endand when the root posts one early and completion posts nothing.Suggested test correction
await lifecycle(harness, 'child-1', 'started') await hook(harness, 'agent_end') + expect(postedHookNames(harness.fetchMock)).not.toContain('agent_end') harness.reload() + const agentEndCountBeforeCompletion = postedHookNames(harness.fetchMock) + .filter(name => name === 'agent_end').length await lifecycle(harness, 'child-1', 'completed') - expect(postedHookNames(harness.fetchMock).at(-1)).toBe('agent_end') + expect(postedHookNames(harness.fetchMock) + .filter(name => name === 'agent_end')).toHaveLength(agentEndCountBeforeCompletion + 1)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 67e13c86-aed1-4ecf-9ca9-fb5845006297
📥 Commits
Reviewing files that changed from the base of the PR and between 3f93c4f73cadfca5c5c1895dbb575e75780179cd and 65b44c79515014af81305fc08734b66c34bf28f5.
📒 Files selected for processing (3)
src/main/pi/agent-status-extension-omp-lifecycle.test.tssrc/main/pi/agent-status-subagent-roster-source.tssrc/main/pi/omp-session-status-owner-source.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the delta since the prior Pullfrog review (3f93c4f), covering the single follow-up commit 65b44c7.
- Pane ownership moved onto the persisted roster —
lifecycleState.ownsPanereplaces the factory-closureownsPaneStatus, so the roster guard now survives an in-process reload; a task session's own bus still sees no ownership and ignores lifecycle frames. - Added a reload regression test —
keeps OMP pane ownership across an extension reloadasserts a child completion afterreload()still postsagent_end(it fails on the pre-fix code), and the task-session test drops the now-invalid root seed.
The prior [!IMPORTANT] finding is addressed and its thread resolved. Both changed test files pass locally (33/33).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
@coderabbitai re the nitpick on the reload test ( |
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the delta since the prior Pullfrog review (65b44c7), covering the single follow-up commit 40cc60a.
- Strengthened the OMP reload regression test —
keeps OMP pane ownership across an extension reloadnow assertsagent_endhas not been posted after the root's early end and before the tracked child finishes, so its final.at(-1)assertion can only pass when the child's post-reload completion settles the pane. Production source is unchanged.
Both changed test files pass locally (33/33), and the lone prior Pullfrog thread is resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Tip For best results, initiate chat on the files or code changes.
🧠 Learnings usedIf you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |
40cc60a to
e548ddc
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the delta since the prior Pullfrog review (40cc60a), covering the two follow-up production commits 465b66c and e548ddc.
- Stopped dropping live helpers at the next OMP run —
agent_startno longer clears the subagent roster (theresetSubagentRoster()helper and itsagent_startcall are gone), so a helper still running across a new root run keeps holding the pane until it reports completion;session_shutdownandsession_switchstill clear the roster inline. - Re-armed only a completion that was actually posted — the late-child re-arm now tests
completionPostedGeneration === runGenerationrather thanendedRunGeneration === runGeneration, so a child that starts between a run'sagent_endand its deferred settle can no longer consume that run'sagent_end; the settle posts it instead. - Tests — replaced the "drops a child that never settled" case with outlives-next-run and late-outlives-next-run cases, and added a Pi case whose trailing
tool_execution_startpost makes the pre-fix ordering observable (anagent_endposted too early). 35/35 pass locally across both files.
Traced the generation / waiting / active state machine for both runtimes over the relevant event orderings: the new condition is strictly narrower than the old one (it additionally proves a completion was posted), and because it runs after active.add(id) and before post('agent_start'), it can only enable an agent_end, never strand an agent_start or emit an unpaired one.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the delta since the prior Pullfrog review (e548ddc), covering the single follow-up commit bb5328b.
- Settled a child that wakes before OMP's first root turn — the late-child re-arm now also fires when
isOmpRuntime() && runGeneration === 0, so a helper that starts and finishes before the root's firstagent_startno longer leaves the pane on the spinner; Pi is unaffected because the extra clause is OMP-gated. - Restored the regression test —
settles a child woken before the resumed root has run a turnre-covers the case dropped ine548ddc. Mutation-checked locally: removing the new clause makes only this test fail (['agent_start']vs['agent_start', 'agent_end']), so it is a genuine discriminator.
Traced postAgentEndOnce at generation 0: runGeneration === 0 under OMP means no root agent_start has passed ownership (the pane is idle), and the pre-existing completionPostedGeneration === runGeneration condition remains strictly narrower, so no unpaired agent_end is possible. 36/36 tests pass across both changed suites and check:code-quality:changed is clean.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the delta since the prior Pullfrog review (bb5328b), covering the single follow-up commit 79c3d1f.
- Guarded the pre-first-run re-arm against a mid-turn reload — a new persisted
lifecycleState.rootRunInFlightis set onagent_startand cleared on a terminalagent_end,session_shutdown, and OMPsession_switch; the OMPrunGeneration === 0clause now also requires!rootRunInFlight. A factory reload resets the closure run counters to 0 but leaves this flag intact, so a child that starts after a reload no longer re-arms a completion and settles the pane while the root is still working. - Added the reload regression test —
does not settle a reload that lands while the root run is still in flightasserts noagent_endis posted for the post-reload child completion, and that the root's own terminalagent_endis.
Traced the reload path: rootRunInFlight survives on pi.events.__orcaPiSubagents while runGeneration resets to 0, so the guard suppresses the pre-first-run re-arm; the root's later terminal agent_end clears the flag and postAgentEndOnce() emits the single agent_end. The completionPostedGeneration === runGeneration clause is unchanged and stays strictly narrower. Mutation-checked locally: dropping && !lifecycleState.rootRunInFlight fails only the new test, so it is a genuine discriminator. 51/51 tests pass across the OMP lifecycle, Pi async-subagent, completion-delivery, and nested-run-settlement suites. The lone prior Pullfrog thread remains resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Wake turns started after the root reported done, ids that never settled, and task-session copies of the extension all left the tab spinning. Fixes stablyai#22854
Ownership is per event bus, so it has to survive a factory re-run on the same bus.
Clearing the roster on agent_start dropped live children, so Esc or a woken helper could mark the tab done early. Also drops the now-unused reset helper.
A child starting between a run's end and its settle took that run's done, leaving the pane on working when the settle came.
After a resume, a woken helper could finish before any run posted a done, leaving the tab spinning.
…completion The generation-0 clause treated "this factory run has not seen a turn" as "the pane is idle", but an in-process extension reload resets those counters while the root run is still working. A child starting and finishing in that window then posted agent_end, so the tab read done while OMP kept working. Track the root run on the roster, which survives a reload, and only re-open a completion when no run is in flight.
79c3d1f to
4ddb3c8
Compare
nwparker
left a comment
There was a problem hiding this comment.
OMP/Pi completion rearm and pane-owner guards keep child lifecycle from stranding or settling lead incorrectly. 281 Pi tests, node typecheck and quality gate pass. Source overlaps #23201; combine with its final settlement regression suite retained.
Required PR Checks verify passed on this exact commit: 4ddb3c8.
|
Pre-merge bot audit on 4ddb3c8: all four inline threads are resolved and their guards/regression coverage remain present. The never-ending-helper and missing-provenance warnings describe inherited behavior: postAgentEndOnce and ownsSessionStatus are byte-identical to the reviewed baseline. This fix adds a pane-ownership guard that narrows which child events can affect status; it does not add a timeout or widen status ownership. A helper that emits neither agent_end nor runner exit can still leave a spinner, as before; that is an explicit residual limitation. The generic docstring-coverage suggestion is declined under AGENTS.md's concise non-obvious-comment rule. This is low risk when merged independently: the overlapping #23201 feature is excluded from this batch and must preserve both settlement regression suites when integrated later. Current exact-head CI has 34 passing/completed checks and this PR is mergeable and approved. |

ELI5
When OMP uses helper agents, Orca's tab could keep spinning after OMP had gone quiet. Typing
/exitthen popped an "agent finished" notification for work that had finished long before. That happened when a helper started up again after OMP had already reported "done", or when a helper's own copy of Orca's plugin flipped the tab back to working. Now the tab settles once OMP and its helpers are idle — and, just as important, it keeps spinning while OMP is still working, including right after the plugin reloads itself mid-turn.What Changed
Before: an OMP tab could stay on the spinner after OMP was idle:
Because the tab never got a "done", exiting OMP was then reported as a finished task.
After: the tab goes to done once the main agent and every helper it is tracking have finished, and
/exitno longer sends an extra notification.How it works. The status plugin that Orca generates for OMP and Pi (
src/main/pi/*-source.ts) keeps a list of running helpers, and only reports "done" once per main turn after that list is empty. Two changes:omp --resume), the plugin re-opens that turn's completion, so the helper finishing reports "done" again through the samepostAgentEndOnce()path. A helper that starts before the "done" goes out just holds it, as before.onStatus/ownsSessionStatus) now also records on the helper list that this copy owns the tab (ownsPane). Under OMP, a copy that never owned the tab ignores helper events.Pi and Prime keep waiting for their background helpers exactly as before (#21882); the late-helper re-open applies to them too.
Why
I checked each choice against OMP's source (18.3.1, the reported version, and 18.3.2):
main's behavior.postAgentEndOnce()keeps a single place that decides when to report done, so the existing process-exit grace period and session resets work unchanged. It only re-opens a "done" that was actually posted, so a helper that starts between a run's end and its settle can't take that run's "done".Trade-off: a helper that finishes after the turn now sends one "agent finished" notification of its own. A helper that never reports an end still holds the tab on working, as on
main, until/new,/resumeor exit.Linked Issue
Fixes #22854
The issue's second cause (a helper that never reports an end) is left as on
main, since clearing it hides helpers that are still running. Tracked as a follow-up.Visual Proof
The tab still shows the same spinner and done states; what changed is when the plugin reports them — so these clips are all about timing. In each one the tab's state dot is ringed in orange and the renderer is zoomed so it is readable; the caption says what just happened. Nothing is typed into the terminal — the real OMP status plugin is driven through its real event bus and posts to the real hook server, and the tab you see is the real rendered tab.
Before — a helper that wakes after the turn leaves the tab spinning forever
before-late-subagent-spinner-stuck.webm
Watch the tab dot: spinner → green check when the run ends → spinner again when a helper wakes up → and then it never goes back. The helper has finished and nothing at all is running, but the tab keeps spinning.
After — the same sequence settles
after-late-subagent-clears-spinner.webm
Same steps, same moment: the helper finishes and the tab flips straight to the green check.
After — the opposite direction: the spinner must not stop early
after-midrun-child-keeps-spinner.webm
Here OMP is still mid-run when the plugin reloads itself and a helper starts and finishes. The helper's finish must not be mistaken for the run's finish — watch the dot stay on the spinner for several seconds after the helper is gone, and only turn green once the root run itself ends.
Testing
Reproduced the issue's late-helper case on
main: the tab ends on working.Loaded the generated plugin through OMP 18.3.2's real extension loader and event bus, posting to a real HTTP hook server. On
mainthe late-helper case sticks; with this fix it ends on done, a helper's copy of the plugin posts nothing, and a run that will continue stays working.Added a regression case,
does not settle a reload that lands while the root run is still in flight, for the mid-turn-reload direction; it fails without the in-flight guard.Added 15 test cases in
agent-status-extension-omp-lifecycle.test.tsandagent-status-extension-async-subagents.test.ts. 6 of them fail with the fix reverted. The rest guard the fix and were each mutation-checked: a helper still running across the next run keeps the tab working, a helper that starts before a run's "done" is posted doesn't take it, a helper finishing mid-run doesn't settle the tab, and ownership survives a reload.pnpm tc, oxlint, oxfmt andcheck:code-quality:changedpass, andsrc/main/pipasses (280 tests).The clips above were produced by an e2e harness that loads the generated OMP status plugin into a VM, hands it a real pi event bus, and points it at the running app's real hook server, then asserts the rendered tab's state dot at each step. Each clip is one of three consecutive passing runs. The "before" clip is the same harness with only
src/main/pi/*-source.tsreverted to the PR base, and its "after" assertion fails there; the third clip's assertion fails without the in-flight guard commit. The harness is capture-only and is not part of this PR.Tested on macOS. Not run on Windows (the reporter's OS) or over SSH; the change is platform-independent JS inside the plugin, which SSH hosts receive unchanged.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
AI assistance was used while writing this change. A follow-up review pass on this branch (the mid-turn-reload guard above) was done with Claude (Anthropic).
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.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)