Skip to content

fix(pi): settle OMP status on terminal agent_end via willContinue - #14330

Closed
dandaka wants to merge 3 commits into
stablyai:mainfrom
dandaka:fix/omp-agent-end-will-continue
Closed

dandaka wants to merge 3 commits into
stablyai:mainfrom
dandaka:fix/omp-agent-end-will-continue

Conversation

@dandaka

@dandaka dandaka commented Aug 13, 2026 •

Copy link
Copy Markdown

ELI5

When an OMP agent finished its turn, the Orca pane could stay stuck showing "working" forever. Orca was waiting for OMP to report itself idle, but OMP never does that — instead it says on each agent_end whether it will continue. Now Orca listens to that signal: if OMP says it's continuing, the pane stays working; otherwise it settles to done immediately.

What Changed

  • The generated Pi/OMP status extension's agent_end handler now branches for OMP runtimes: willContinue === true keeps the pane active (and drops any stale idle-recheck timer), anything else posts the terminal agent_end right away.
  • Pi and prime-agent keep their existing agent_settled / idle-recheck behavior unchanged.
  • Tests: terminal agent_end posts for omp kind (with and without an explicit willContinue: false) and for runtime-detected OMP while isIdle stays false; a continuation (willContinue: true) keeps the pane active with no post and no pending timers until the next loop settles.

Why

OMP has no agent_settled hook and its ctx.isIdle can stay false through completion, so the existing idle-recheck fallback never fired and the pane stuck at "working". willContinue is OMP's terminal-signal contract, so keying off it settles status deterministically. OMP builds that predate willContinue fail open to "done" rather than stuck-at-working.

Linked Issue

Addresses the stuck-at-"working" completion path of #14278 (the first two expected behaviors: terminal agent_end posts once when willContinue !== true, and willContinue === true keeps the pane active). The issue's remaining items — OMP identity stability, structured ask prompts, and approval-event forwarding — are intentionally out of scope here and are implemented in #14279.

Visual Proof

N/A — main-process generated-extension logic; the only user-visible effect is the pane status settling to done instead of sticking at "working", which is covered by unit tests.

Testing

  • npx vitest run src/main/pi/agent-status-extension-source.test.ts — 36/36 pass (includes 4 new/updated OMP cases)

  • oxlint on changed files — clean (including the max-lines gate)

  • tsc --noEmit -p config/tsconfig.node.json — clean

  • Full pnpm lint / pnpm test / pnpm build left to CI

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Code review, tightening, and test additions done with Claude Code (Claude Fable 5).

AI review summary: cross-platform — the change is inside the generated string extension (plain JS, no platform APIs), macOS/Linux/Windows and WSL curl fallback untouched; SSH/remote — no wire change, payload shape identical (hook_event_name: 'agent_end'), loopback posting unchanged; agent compatibility — Pi and prime-agent paths are untouched, OMP without willContinue fails open to done; performance — removes the exponential idle-recheck timer loop for OMP entirely; security — strict === true check on an event field from the in-process hook, no new trust boundary.

Review

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

Author

  • X / Twitter: (add your handle)

🤖 Generated with Claude Code

dandaka and others added 2 commits August 13, 2026 19:44
…ablyai#14278)

OMP has no agent_settled event, and ctx.isIdle() can stay false through its
completion callback path, so the idle-recheck fallback never posts the final
agent_end and the pane stays stuck at working. Key the OMP-runtime path on
the documented willContinue signal: true = scheduled continuation (stay
active), otherwise terminal (post once). Pi agent_settled/idle logic is
unchanged.
…rage

Hoist clearPendingAgentEndCheck so both OMP paths drop any stale idle
recheck, cover an explicit willContinue:false terminal agent_end, and
assert no status posts while a continuation is pending.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a25e5646-2902-46da-a3d2-d16453153c5f

📥 Commits

Reviewing files that changed from the base of the PR and between 8ce52f9 and c526a56.

📒 Files selected for processing (1)
  • src/main/pi/agent-status-extension-source.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/pi/agent-status-extension-source.test.ts

📝 Walkthrough

Walkthrough

The agent_end handler now receives the event object. For OMP runtime, it cancels idle-recheck polling and posts completion only when willContinue is not true. Non-OMP handling keeps its existing settlement and idle-state logic. Tests separate Pi-family coverage from OMP coverage and verify terminal completion, continuation suppression, runtime detection, and single-event settlement.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR satisfies terminal and continuation behavior but does not implement identity, structured ask, or approval forwarding required by #14278. Implement the remaining #14278 requirements or link this PR to a narrower issue covering only willContinue completion behavior.
✅ Passed checks (4 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The changes are limited to OMP agent_end settlement logic and related tests, matching the stated willContinue objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely identifies the OMP terminal agent_end completion fix.
Description check ✅ Passed The description covers the required sections, linked issue, testing, scope, and behavior changes with sufficient detail.

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: Pro Plus

Run ID: a42660ce-5105-46d0-9674-3d2cba6c3413

📥 Commits

Reviewing files that changed from the base of the PR and between 99f9a3c and 8ce52f9.

📒 Files selected for processing (2)
  • src/main/pi/agent-status-extension-source.test.ts
  • src/main/pi/agent-status-handler-source.ts

@euclodius

Copy link
Copy Markdown

Cross-linking #13891 / #13890. This PR fixes the authoritative OMP completion path (agent_end.willContinue), while #13891 fixes two complementary fallback/cleanup gaps observed on Windows + WSL2:

  • OMP 17.2.12+ static native titles π :, π >, and π ! were misclassified by Orca's Pi-compatible title fallback.
  • A pane-scoped status clear could leave Orca's synthetic title spinner registered and rotating.

The production code does not overlap: #14330 changes the generated OMP status extension; #13891 changes shared terminal-title classification and main-process spinner cleanup. If #14330 (or the broader #14279) lands, #13891 remains useful for status resilience when hook delivery is missing, delayed, or cleared.

For maintainers: #14279 appears to be the broader competing implementation of this PR's willContinue fix, whereas #13891 is orthogonal rather than an alternative.

CodeRabbit review: undefined exercised the !event fallback, not a
willContinue-less event; the runtime-detected case still covers undefined.

Co-Authored-By: Claude Fable 5 <[email protected]>
@euclodius

Copy link
Copy Markdown

Completing the OMP status cross-links: #13891 and #13923 are competing implementations for the separate #13890 WSL/ConPTY native-title and stale-spinner root cause. This PR and #14279 remain the competing implementations for #14278 (agent_end / willContinue).

These pairs are complementary across distinct roots. Please choose the preferred implementation within each pair and prioritize landing the fixes; users are currently seeing the same disruptive stuck/misreported OMP status from both paths.

@nwparker

Copy link
Copy Markdown
Contributor

Superseded by #20603 (OMP terminal lifecycle settlement), which contains the current implementation and verification on . Closing this stale duplicate so review stays on the maintained PR.

@nwparker

Copy link
Copy Markdown
Contributor

Superseded by #20603.

@nwparker nwparker closed this Sep 19, 2026
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.

5 participants