Repository navigation
fix(omp): reliably clear completion spinner - #18533
timaxlucas wants to merge 4 commits into
Conversation
📝 WalkthroughWalkthroughThe change adds run-generation tracking and bounded retries for failed OMP Merge Risk: 🟡 Moderate · up to Completion state can still remain stuck on WSL or be incorrectly cleared for a newer run. These lifecycle reliability gaps should be fixed before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
ℹ️ No critical issues — one scoping note inline.
Reviewed changes
- Terminal OMP spinner teardown —
getPiTitlebarExtensionSourcenow takes akindand, on a terminal OMPagent_end(willContinue !== true), stops the braille spinner synchronously instead of pollingctx.isIdle. - Bounded completion-hook retry — a failed terminal OMP
agent_endpost is retried at 250 ms / 1 s / 4 s, fenced by an incrementingrunGenerationso an old completion can never stop (or be mistaken for) a newer turn. - Delivery semantics —
postOncenow returns a boolean and treats non-2xx responses as undelivered; Pi/Prime behavior and non-OMP hooks are unchanged.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
e3d3884 to
0cc7e96
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Titlebar now uses runtime OMP detection — extracted
getPiAgentOmpRuntimeDetectionSourceLines(configuredOmp)fromagent-status-runtime-detection-source.tsand reused it in the titlebar, replacing the install-timeconst OMP_RUNTIME = ${kind === 'omp'}with the sameisOmpRuntime()the status extension uses. The status extension'sCONFIGURED_HOOK_PATH === '/hook/omp'short-circuit is now the equivalentCONFIGURED_OMP_RUNTIMEboolean, so status behavior is unchanged. - Routed-OMP regression coverage — the titlebar harness now passes
title/argvinto the VM context, and twoit.eachcases prove a terminalagent_endfrom a process-title or argv-routed OMP runtime stops the spinner synchronously without consultingctx.isIdle.
The prior scoping note is fully addressed: the titlebar and status extension now share one detector, so a bare-shell pi that later re-execs omp tears down its spinner the same way status reports it. Verified pnpm exec vitest run src/main/pi/titlebar-extension-source.test.ts src/main/pi/agent-status-extension-omp-delivery.test.ts — 18 tests pass.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/pi/agent-status-extension-source.ts (1)
196-196: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRetry only terminal OMP
agent_endevents.Line 196 retries every failed OMP
agent_end. An intermediate event withfailed.extra.willContinue === truepasses this guard. It can then arrive after later lifecycle events, despite the terminal-only retry requirement. Return before scheduling whenfailed.extra.willContinue === true. Add a regression test for this case.Proposed fix
- ' if (failed.hookEventName !== 'agent_end' || !failed.ompRuntime) return', + " if (failed.hookEventName !== 'agent_end' || !failed.ompRuntime || failed.extra.willContinue === true) return",
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 3b7797e3-6756-4c25-8345-a829aa16a66e
📒 Files selected for processing (7)
src/main/pi/agent-status-extension-omp-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-runtime-detection-source.tssrc/main/pi/agent-status-wsl-curl-source.tssrc/main/pi/titlebar-extension-source.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/pi/agent-status-extension-source.ts (1)
204-204: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftFence active retry requests by run generation.
When line 204 retries an
agent_endrequest andbeginAgentRun()starts a new run, the request remains active. The HTTP receiver processes it without a run identifier, so the late event normalizes todoneand can replace the new run’sworkingstatus. Include a monotonic run identifier in each payload and reject terminal events from non-current runs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 34efb243-741a-4832-a13d-45225a48e74c
📒 Files selected for processing (3)
src/main/pi/agent-status-extension-omp-lifecycle.test.tssrc/main/pi/agent-status-extension-source.tssrc/main/pi/titlebar-extension-source.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| ' if (!isWslRuntime()) return', | ||
| ' if (!isWslRuntime()) return false', | ||
| ' postViaWindowsCurl(body, ompRuntime)', | ||
| ' return true', |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions
Length of output: 29148
🏁 Script executed:
#!/bin/bash
set -eu
file='src/main/pi/agent-status-extension-source.ts'
printf '%s\n' '--- target hunk ---'
sed -n '220,315p' "$file"
printf '%s\n' '--- relevant symbols ---'
rg -n -C 5 'postViaWindowsCurl|drainPosts|scheduleOmpAgentEndRetry|pendingAgentEndRetry|runGeneration|curl' "$file"
printf '%s\n' '--- related tests/harness references ---'
rg -n -C 4 'postViaWindowsCurl|drainPosts|WSL|curl child|retry delays|AgentEndRetry|agent end retry' src test tests 2>/dev/null || trueRepository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -eu
file='src/main/pi/agent-status-extension-source.ts'
printf '%s\n' '--- target file size ---'
wc -l "$file"
printf '%s\n' '--- imports and declarations ---'
sed -n '1,140p' "$file"
printf '%s\n' '--- delivery and retry implementation ---'
sed -n '140,315p' "$file"
printf '%s\n' '--- exact tracked references ---'
rg -n -C 6 --glob '*.ts' --glob '*.tsx' \
'postViaWindowsCurl|drainPosts|scheduleOmpAgentEndRetry|pendingAgentEndRetry' \
src/main src/shared tests 2>/dev/null || true
printf '%s\n' '--- candidate harness filenames ---'
git ls-files | grep -Ei 'agent-status|omp|hook.*(test|harness)|wsl.*(test|harness)' | head -80Repository: stablyai/orca
Length of output: 25857
🏁 Script executed:
#!/bin/bash
set -eu
file='src/main/pi/agent-status-extension-source.ts'
sed -n '1,315p' "$file"
printf '%s\n' '--- exact references ---'
rg -n -C 6 --glob '*.ts' --glob '*.tsx' \
'postViaWindowsCurl|drainPosts|scheduleOmpAgentEndRetry|pendingAgentEndRetry' \
src/main src/shared tests 2>/dev/null || true
printf '%s\n' '--- candidate files ---'
git ls-files | grep -Ei 'agent-status|omp|hook.*(test|harness)|wsl.*(test|harness)' | head -80Repository: stablyai/orca
Length of output: 25606
🏁 Script executed:
#!/bin/bash
set -eu
file='src/main/pi/agent-status-wsl-curl-source.ts'
printf '%s\n' '--- helper size and source ---'
wc -l "$file"
cat -n "$file"
printf '%s\n' '--- spawn/process contract references ---'
rg -n -C 8 --glob '*.ts' --glob '*.tsx' \
'getPiAgentStatusWslCurlSourceLines|spawn\\(|spawnSync|curl\\.exe|resolveWindowsCurlPath' \
src/main src/shared tests 2>/dev/null | head -240
printf '%s\n' '--- exact agent-status test files ---'
git ls-files | grep -E '(^|/)(agent-status|pi-agent-status|.*wsl-curl.*)(\\.test)?\\.(ts|tsx|mjs|cjs)$' || trueRepository: stablyai/orca
Length of output: 4074
🏁 Script executed:
#!/bin/bash
set -eu
file='src/main/pi/agent-status-wsl-curl-source.ts'
wc -l "$file"
cat -n "$file"
printf '%s\n' '--- related references ---'
rg -n -C 8 --glob '*.ts' --glob '*.tsx' \
'getPiAgentStatusWslCurlSourceLines|spawn\(|spawnSync|curl\.exe|resolveWindowsCurlPath' \
src/main src/shared tests 2>/dev/null | head -240
printf '%s\n' '--- exact tests ---'
git ls-files | grep -E '(^|/)(agent-status|pi-agent-status|.*wsl-curl.*)(\.test)?\.(ts|tsx|mjs|cjs)$' || trueRepository: stablyai/orca
Length of output: 22868
Propagate WSL curl delivery failures.
When postOnce() falls back to postViaWindowsCurl(), return false if curl cannot spawn, emits error, or exits nonzero. drainPosts() currently receives true unconditionally at line 272, so it skips the OMP completion retries and can lose the event during an Orca restart. Add a harness case that forces child failure and checks all retry delays.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Retry timer now keeps the process alive —
pendingAgentEndRetry.unref()was removed, so a pending terminal-completion retry survives process teardown and is still bounded by the existing three-attempt[250, 1000, 4000]schedule. - Runtime detection consolidated —
getPiAgentOmpRuntimeDetectionSourceLineswas folded back into a singlegetPiAgentStatusRuntimeDetectionSourceLines(kind), reverting theCONFIGURED_OMP_RUNTIMEboolean short-circuit toCONFIGURED_HOOK_PATH === '/hook/omp'; the titlebar and status extension now spread the same function, and the titlebar only callsisOmpRuntime(). - WSL transport hardening reverted — the async curl close-observation and
-fflag fromfed0048were reverted, restoring fire-and-forget WSL delivery unchanged from the last reviewed state (0cc7e96). - Delivery tests merged —
agent-status-extension-omp-delivery.test.tswas folded intoagent-status-extension-omp-lifecycle.test.tswithtry/finallyfake-timer cleanup.
I re-checked the prior CodeRabbit concern (retrying intermediate agent_end): post('agent_end') is only reached for terminal OMP completion, since the intermediate willContinue === true path returns before postAgentEndOnce(), and the post carries no willContinue in extra. So the retry guard is already terminal-only and needs no additional willContinue check.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Current main already contains the verified fix via merged #20603, which covers both missed delivery and the received-done spinner case. Current-main evidence: 71 focused lifecycle/title/completion tests plus a real OMP HTTP 503 retry smoke. Closing this conflicting duplicate; credit to the original PR author for the retry/fencing direction. |
|
Correction: Current main already contains the verified fix via merged #20603, covering both missed final completion delivery and the received-done spinner case. Evidence: 71 focused lifecycle/title/completion tests plus a real OMP HTTP 503 retry smoke. This stale conflicting branch is superseded; credit to the original PR author for the retry and fencing direction. |

ELI5
When OMP finishes, Orca now clears the terminal's working spinner immediately and retries the final completion signal if a brief hook-delivery failure occurs.
What Changed
agent_end; OMP'swillContinueflag distinguishes intermediate ends.agent_endhook posts after 250 ms, 1 s, and 4 s.Why
Issue #18262 records a completed, idle OMP turn whose final completion never became Orca
agent_stop, leaving the sidebar/tab inworkingstate. Completion is the one status transition that cannot be safely dropped. The direct title teardown removes the local visual dependency on a later idle poll, while bounded generation-fenced retries heal transient loopback delivery failures without creating an unbounded queue or affecting a newer run.Linked Issue
Fixes #18262
Visual Proof
After an Orca-managed OMP turn containing
sleep 5settled, the sidebar changed fromWorking Spinner PR visual - Running nowtoUnread agent completion Spinner PR visual, and the pane title no longer contained a braille spinner.Testing
pnpm exec vitest run src/main/pi— 7 files, 93 tests passed.pnpm tc:node— passed.pnpm check:code-quality:changed— passed with zero findings.git diff --check upstream/main...HEAD— passed.AI Disclosure
Implemented with OpenAI Codex GPT-5.6-Sol; manually reviewed and runtime-verified.
Review
Please focus on retry fencing around a new
before_agent_start/agent_startand OMP's terminalwillContinue !== truecontract.Agent skill upstream boundary
Notes
Checklist
pnpm lint,pnpm typecheck,pnpm test, andpnpm build(focused tests, node typecheck, and changed-code quality passed locally; CI will cover the full matrix)