Skip to content

fix(omp): stop the tab spinner sticking after subagents finish - #23662

Merged
nwparker merged 7 commits into
stablyai:mainfrom
AmoabaKelvin:fix/omp-spinner-stuck-after-subagents
Oct 5, 2026
Merged

nwparker merged 7 commits into
stablyai:mainfrom
AmoabaKelvin:fix/omp-spinner-stuck-after-subagents

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​157 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​155
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12

ELI5

When OMP uses helper agents, Orca's tab could keep spinning after OMP had gone quiet. Typing /exit then 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:

  • when a helper woke up after the main turn had reported done (for example, a helper answering a message);
  • when a helper's own helper started, because the helper's copy of the plugin set the tab to working and nothing set it back.

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 /exit no 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:

  • Late helper. If a helper starts after the main turn's "done" was already posted, or under OMP before this copy of the plugin has seen a turn (for example a helper woken right after omp --resume), the plugin re-opens that turn's completion, so the helper finishing reports "done" again through the same postAgentEndOnce() path. A helper that starts before the "done" goes out just holds it, as before.
  • Never while the main agent is working. "This copy has not seen a turn" is not the same as "the pane is idle": an in-process plugin reload resets the plugin's own turn counters while the main agent keeps running. So the plugin now records on the helper list (which survives a reload) whether a main run is in flight, and only re-opens a completion when none is. Without that, a helper starting and finishing in the window after a mid-turn reload posted "done" and the tab read idle while OMP was still working.
  • Only the tab's owner tracks helpers. OMP loads the plugin again inside every helper session. The existing session filter (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):

  • Why a helper that never reports an end isn't cleared (the issue's second suggestion): OMP can end a run while a helper is still working. Pressing Esc, and several other ways a run can end, skip OMP's "is background work pending" check, and a woken helper only counts as background work once it yields. Clearing the list when a run ends, or when the next one starts, shows "done" while a helper is still running. In OMP's source every helper start is paired with an end on normal, abort, kill and error paths, so a helper that never ends is rare; that case keeps main's behavior.
  • Why reopen the completion instead of adding a second "post done" path: reusing 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".
  • Why an owner flag: each OMP helper session gets its own event bus and runs its own copy of the plugin (OMP 18.0.8+). Without the flag, a helper's copy could post a false "done" or a "working" that never clears. The flag lives on the per-bus helper list, so it survives an extension reload.

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, /resume or 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 main the 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.ts and agent-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 and check:code-quality:changed pass, and src/main/pi passes (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.ts reverted 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

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ee7ecfd2-ecc7-4438-8c84-1daecbafd869

📥 Commits

Reviewing files that changed from the base of the PR and between e548ddcb7fd235fd354892d29a8402706df34549 and bb5328beb65b093cd94f8c0893edf1a26af9f475.

📒 Files selected for processing (2)
  • src/main/pi/agent-status-extension-omp-lifecycle.test.ts
  • src/main/pi/agent-status-subagent-roster-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.


📝 Walkthrough

Walkthrough

Accepted 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 bb532

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 Review

Security architecture risk: 🔵 Low · up to bb532

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

  • Low · security · inferred: The new pane-owner marker inherits an ownership check that accepts missing session provenance. If a child copy receives such a callback, it can subsequently process its bus’s child events as the pane owner. Whether production child callbacks can meet that condition is unresolved.
Security review details

Security Blast Radius

  • inferred — The demonstrated output is pane activity and completion status. Evidence does not establish that lifecycle events cross session event buses or that these notifications control a privileged action.

Trust Boundaries and Controls

  • observed — The child-event handler checks its copy’s ownsPane flag, not the originating identity of each lifecycle event. Known non-owner copies are blocked; event-origin guarantees remain unverified.

Hardening Proposals

  • proposed — Establish the runtime’s session-provenance and event-delivery guarantees before relying on the ownership marker as a boundary; cover missing provenance and reordered lifecycle events where those states are possible.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #22854 is directly linked. The changes implement the late-helper fix: they track helper lifecycle, reopen completion after a late start, wait for tracked helpers, preserve pending async work, an… Implement and test a safe stale-helper policy for terminal root completion. The policy must distinguish leaked helper IDs from real pending asynchronous work and must preserve the required working state while async work remains pending.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The OMP ownership changes, helper settlement logic, first-run handling, reload handling, and related Pi behavior directly support issue #22854. The Pi changes preserve helper waiting and apply the sha…
Title check ✅ Passed The title clearly identifies the primary fix: preventing the OMP tab spinner from remaining active after subagents finish.
Description check ✅ Passed The description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, AI disclosure, and checklist status. It al…
Full details: Linked Issues check

Explanation

Issue #22854 is directly linked. The changes implement the late-helper fix: they track helper lifecycle, reopen completion after a late start, wait for tracked helpers, preserve pending async work, and ignore OMP task-session copies that do not own the pane. The added OMP and Pi tests cover these cases. The issue also identifies a never-settling helper as a failure mode and proposes stale-helper handling. The current changes leave that case unchanged, so the pane can still remain working after the root is terminal. The later first-run and reload handling does not resolve this gap.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts
  • src/main/pi/agent-status-extension-omp-lifecycle.test.ts
  • src/main/pi/agent-status-handler-source.ts
  • src/main/pi/agent-status-subagent-roster-source.ts
  • src/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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 started frame arriving after the run already reported done re-arms waiting/completionPostedGeneration and re-posts agent_start, so the helper's completion re-posts agent_end (Pi and OMP).
  • Leaked-helper reset — the new resetSubagentRoster() runs on every OMP agent_start and replaces the duplicated inline clears in session_shutdown/session_switch.
  • Owner-only tracking — a new ownsPaneStatus flag, set in the onStatus wrapper once ownsSessionStatus(ctx) passes, gates the roster onEvent so 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).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/main/pi/agent-status-extension-omp-lifecycle.test.ts (1)

273-273: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the reload assertion distinguish delayed and resumed agent_end events.

When agent_end runs while child-1 is active, this test does not assert that no hook was posted. Its final assertion passes both when completion posts a new agent_end and 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.ts
  • src/main/pi/agent-status-subagent-roster-source.ts
  • src/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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.ownsPane replaces the factory-closure ownsPaneStatus, 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 reload asserts a child completion after reload() still posts agent_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).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator Author

@coderabbitai re the nitpick on the reload test (agent-status-extension-omp-lifecycle.test.ts): agreed, the final .at(-1) check alone also passed if the root settled early. Addressed in 40cc60a537 with one assertion that nothing settled before the child completes, so the completion must post the agent_end. Verified it now fails when the root settles early at agent_end.

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Fixes spinner state tracking in subagent lifecycle.

The PR appears safe to merge based on the reviewed changes.

Summary

The PR changes when the generated status plugin reports completion: it waits for tracked helpers, reopens completion for a late helper, and limits OMP helper tracking to the pane-owning session. The latest revision preserves the in-flight root-turn flag across an extension reload. No new actionable issue was established; both previous findings are resolved.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Root turn starts] --> B[Track running helpers]
  B --> C{Root turn ended and helpers idle?}
  C -- No --> B
  C -- Yes --> D[Report done]
  D --> E{Late helper starts?}
  E -- Yes --> B
Loading

Reviews (4) · Last reviewed commit: "fix(omp): keep a mid-turn reload from se..."

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 reload now asserts agent_end has 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.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@AmoabaKelvin, thanks for addressing the test nitpick. The new assertion checks that settlement does not occur before the child completes, so the final agent_end check covers the intended behavior.


🧠 Learnings used
Learnt from: AmoabaKelvin
Repo: stablyai/orca PR: 23662
File: src/main/pi/agent-status-subagent-roster-source.ts:45-46
Timestamp: 2026-09-28T18:34:26.956Z
Learning: In OMP v18.3.2, `buildSubagentSessionOptions()` does not pass `eventBus` when creating an in-process task session, and `createAgentSession()` creates a new `EventBus` when none is passed. In `src/main/pi/agent-status-subagent-roster-source.ts`, an OMP task session's extension copy therefore cannot replace the root session's callbacks through the root `pi.events.__orcaPiSubagents` roster. The shared bus used by `harness.reload()` in `src/main/pi/agent-status-extension-omp-lifecycle.test.ts` is a test setup, not evidence that OMP task sessions share the root event bus.

If 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.

@AmoabaKelvin
AmoabaKelvin force-pushed the fix/omp-spinner-stuck-after-subagents branch from 40cc60a to e548ddc Compare September 28, 2026 22:56

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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_start no longer clears the subagent roster (the resetSubagentRoster() helper and its agent_start call are gone), so a helper still running across a new root run keeps holding the pane until it reports completion; session_shutdown and session_switch still clear the roster inline.
  • Re-armed only a completion that was actually posted — the late-child re-arm now tests completionPostedGeneration === runGeneration rather than endedRunGeneration === runGeneration, so a child that starts between a run's agent_end and its deferred settle can no longer consume that run's agent_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_start post makes the pre-fix ordering observable (an agent_end posted 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.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 first agent_start no 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 turn re-covers the case dropped in e548ddc. 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.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.rootRunInFlight is set on agent_start and cleared on a terminal agent_end, session_shutdown, and OMP session_switch; the OMP runGeneration === 0 clause 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 flight asserts no agent_end is posted for the post-reload child completion, and that the root's own terminal agent_end is.

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.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

AmoabaKelvin and others added 7 commits October 4, 2026 22:42
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.
@nwparker
nwparker force-pushed the fix/omp-spinner-stuck-after-subagents branch from 79c3d1f to 4ddb3c8 Compare October 5, 2026 05:46

@nwparker nwparker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@nwparker

nwparker commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

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.

@nwparker
nwparker merged commit e65bbc9 into stablyai:main Oct 5, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OMP tab spinner stays on after OMP is idle; /exit then fires an 'agent finished' notification

2 participants