Repository navigation
fix(omp): acknowledge completion delivery and retire stale retries - #20603
Conversation
📝 WalkthroughWalkthroughThe OMP agent-status extension now uses a shared serialized post queue. Failed completion deliveries retry with bounded backoff and stop at session lifecycle boundaries. HTTP errors and WSL curl failures propagate into retry handling. The WSL curl bridge now reports missing configuration, timeouts, process errors, and non-zero exits. OMP titlebar completion handling skips idle polling. Unit, end-to-end, native HTTP smoke, and workflow coverage was added. Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to After Orca restarts, WSL completion notifications may keep failing and leave the response shown as busy. Refresh the Windows-host fallback coordinates before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 12 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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: fcaecaa4-e820-4d59-b801-712a67993cb0
📒 Files selected for processing (13)
.github/workflows/pi-owner-runtime.ymlsrc/main/pi/agent-status-completion-delivery.test.tssrc/main/pi/agent-status-extension-source.test.tssrc/main/pi/agent-status-extension-source.tssrc/main/pi/agent-status-extension-test-harness.tssrc/main/pi/agent-status-handler-source.tssrc/main/pi/agent-status-post-queue-source.tssrc/main/pi/agent-status-ui-prompt-source.tssrc/main/pi/agent-status-wsl-curl-source.tssrc/main/pi/titlebar-extension-source.test.tssrc/main/pi/titlebar-extension-source.tstests/e2e/omp-completion-retry-status.spec.tstests/tools/omp-completion-runtime-smoke.mjs
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| ' if (!isWslRuntime()) return', | ||
| ' postViaWindowsCurl(body, ompRuntime)', | ||
| ' if (!isWslRuntime()) throw error', | ||
| ' await postViaWindowsCurl(body, ompRuntime)', |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Refresh the Windows host coordinates used by the WSL fallback.
resolveHookCoords() returns guest relay coordinates in WSL. Do not pass those coordinates to postViaWindowsCurl(); the fallback must target the Windows host.
An existing PI process retains its PTY environment after an Orca restart, while the server generates a new hook token. The OMP retry path calls postOnce() again, but the fallback still uses stale process.env.ORCA_AGENT_HOOK_PORT and process.env.ORCA_AGENT_HOOK_TOKEN. Retries can therefore fail authentication or target an obsolete host port.
Refresh a separate Windows-host coordinate source after restart and use it in postViaWindowsCurl().
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline. The retry state machine and the WSL acknowledgment path both hold up under tracing.
Reviewed changes
- Retry queue extracted —
agent-status-post-queue-source.tsadds revision/attempts/delivered tracking; failed OMP posts retry 3× (250/500/1000ms), and any newerpost()or session boundary retires older retries. - Failure now propagates —
postOncethrows on non-2xx and rethrows non-WSL fetch errors; WSL falls back to curl. - Lifecycle retirement —
resetPostQueue()+clearPendingAgentEndCheck()onsession_shutdown; OMPsession_switchalso resets and refreshes session metadata. - WSL curl acknowledged —
postViaWindowsCurlawaits childclose, adds--fail, rejects on non-zero exit, and has an 11s kill watchdog. - Titlebar — final OMP
agent_end(willContinue !== true) stops the spinner without consultingctx.isIdle(). - Tests/CI — new completion-delivery unit suite, titlebar OMP test, hidden-electron retry e2e, cross-platform runtime smoke, and the
pi-owner-runtimeworkflow widened tosrc/main/pi/**.
I verified the queue interleavings (newer post vs. in-flight settle vs. retry timer vs. reset) and the WSL promise settlement paths; I found no way to re-deliver an obsolete completion or permanently drop a latest one. pnpm test on the three touched files passed (95 tests), pnpm tc:node is clean, and the changed-code quality gate reports 0 findings.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| ' revision: ++postRevision,', | ||
| ' attempts: 0,', | ||
| ' delivered: false,', | ||
| " hookEventName: ompRuntime && hookEventName === 'model_select' && previousCompletion ? 'agent_end' : hookEventName,", |
There was a problem hiding this comment.
This branch can never run: no generated handler ever calls post('model_select') — the only event names posted are session_start, before_agent_start, agent_start, tool_execution_start, tool_call, tool_execution_end, tool_approval_requested/resolved, message_end, agent_end, and ui_prompt_*. So previousCompletion (and the comment's protection) is dead. If OMP emits model_select and you meant to preserve an unacknowledged completion across it, a pi.on('model_select', ...) handler is missing; otherwise the branch and the previousCompletion computation should be removed.

ELI5
When OMP finishes a response, Orca should stop showing it as busy. A failed completion notification now gets bounded retries, and starting another turn or switching sessions cancels retries for the old work.
What Changed
agent_end, using OMP'swillContinuecontract.Why
A single lost completion left Orca displaying the previous turn as working indefinitely. Retrying only while the snapshot remains current repairs transient delivery failures without submitting an old completion after a new turn has begun.
Linked Issue
Addresses #18262. Secondary source comparison: #18533. Tim Maximilian Lucas is credited as co-author for the matching completion/title approach; this branch also covers WSL acknowledgment and in-process session switches.
Visual Proof
Hidden Electron test forwards generated OMP hooks through a real HTTP proxy to Orca's hook server. The proxy rejects the first final completion with 503; the retry succeeds, the rendered working indicator disappears, and the authoritative pane state becomes
done.Before completion:

After recovery:

Scope: synthetic OMP lifecycle callbacks, actual generated HTTP transport, and rendered Orca. This is not a full model conversation. WSL process outcomes are covered by deterministic tests.
Testing
git diff --checkpass.Review
Independent agent review identified false WSL acknowledgment and stale retries after
session_switch; both are repaired and regression-tested. Independent final review of implementation commitfd7f7a10d2afound no blocking findings, with 95 focused tests passing. Subsequent commits add runtime and rendered test coverage only. OMP source at~/projects/oh-my-piwas read only.Agent skill upstream boundary
Head
3eca1bcfc54passes full CI, including all unit-test shards, static analysis, typecheck, Linux/Windows packaging, and native completion HTTP smoke on Linux/macOS/Windows. Ready for review.Notes
Retries are bounded and cannot recover a permanently unavailable receiver. Sender cancellation cannot retract an HTTP request already accepted by a receiver before timeout; receiver ordering is outside this patch. Status still flows through the execution host's existing hook store. No RPC schema or stream opcode changes; folder workspaces use the same pane-scoped transport.