Repository navigation
fix(orchestration): let a worker brief wait for the agent to lead the foreground - #63
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Closed
7 of 9 tasks
DoozyX
added a commit
that referenced
this pull request
Nov 15, 2026
9 of 11 tasks
DoozyX
added a commit
that referenced
this pull request
Nov 23, 2026
Upstream origin/main 0b23e7a (388 commits) into fork main 6f98610. Accepted upstream's test-suite cut (stablyai#46786) and dead card components (stablyai#46833) on all 44 modify/delete conflicts. Fork-feature regression tests removed with it: - #63: federation-worker-brief-agent-in-front, orchestration-structured-worker-retry - #67: federated-release-safety, federated-transport-safety, worker-release - #69: worker-list-pagination - claude accounts: repo-update-host-guard, claude-session-account-move - git graph: hosted-review-creation-gitlab-self-hosted - passkeys: main-process-ready-persistence-cleanup - branch cleanup: remove-worktree-branch-cleanup, worktree-remove-branch-deletion, remove-worktree - test isolation: dependency-security-release Fork-only tests that imported upstream-deleted fixtures were removed too. Code conflicts keep both sides: - Claude background evidence helper now uses upstream's running-task map (stablyai#47081); status payload carries fork monitoredWork + upstream backgroundCommands. - Worker start: upstream bindTerminal/handOver split reads the re-minted pane handle from setupStage (#29/#61); fork deadline brief guard (#63) plus upstream abort checks in preamble delivery. - Status bar: fork per-account usage roster with upstream's unreachable-host gating (stablyai#42644); a null account owner now shows no roster instead of local accounts. - client-ui-params.ts: moved feature-interaction schemas to their own module to stay under max-lines with the fork's omp status-bar fields. Gates: install:release, mobile frozen install, pnpm tc, mobile typecheck and typecheck:tests, conflict-area tests (38 files), independent review (1 finding, fixed), check:changed vs fork parent (only finding: upstream's unchanged bot-run-results.test.ts casts).
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
When Orca starts a worker, it opens a terminal, launches the agent, and then types the task in. If the agent hadn't quite taken over the terminal yet, Orca gave up on the spot and left a failed start behind. Now Orca checks a few times a second, for up to 10 seconds, and types the task as soon as the agent is in front.
What Changed
Before:
orca orchestration worker-startcould fail withstage=dispatch_input/lastError=agent_not_in_foregroundbecause the worker brief was only allowed through after a single foreground read. The new terminal was left inresidualResources, and the same terminal became ready moments later.After: the worker-brief write guard resamples the foreground every 250 ms for up to 10 s, never past the start's remaining readiness budget, and writes once the launched agent leads. If a shell prompt returns while waiting, or time runs out, it refuses and the task is never pasted into a shell. The refusal text now names the last foreground sample and the elapsed time.
Mechanism:
createLaunchedAgentWriteGuardtakes an optionalsettleDeadlineMs. OnlycreateWorkerBriefWriteGuardsets it, from a newreadinessDeadlinethatdeliverWorkerDispatchPreambleand the federation attach path now pass in. Launch-prompt guards keep their single read and the exact bareagent_not_in_foregroundmessage thatexternal-conversation-send.tsmatches. The terminal identity and incarnation abort check frommainis kept and runs after every sample. The federation path keeps the reminted-handle rebinding from #61 and takes its deadline just before that wait.Why
Raising the readiness timeout would not help: the agent was ready, the read was just early. Skipping the check would type a task into a bare shell when the agent has exited, which is what the guard exists to prevent. A bounded resample inside the existing readiness budget keeps the guard and removes the race, without new flags, retries or failure semantics.
Linked Issue
Fixes #18
Supersedes #46, which carried the same change on an older base.
Visual Proof
N/A: runtime behaviour in worker start; no UI change.
Testing
pnpm tc:nodeexit 0 on the rebased branch.pnpm test src/main/runtime/rpc/methods/orchestration src/main/runtime/terminal/wait src/main/runtime/orchestration/legacy-remote --maxWorkers=2: 99 files, 629 tests passed. New case: a firstunknownread followed byagentwrites once after 250 ms; the shell-in-front test now waits out the settle window.pnpm check:changedagainstfork/main: see CI.Risk
Level: Medium
A worker whose agent really exited without the shell printing a prompt marker now fails after up to 10 s instead of immediately. The riskiest part is the loop's exit conditions; it is bounded by both the 10 s window and the readiness deadline. Plain revert backs it out.
Agent skill upstream boundary
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (typecheck and scoped tests ran locally; the rest is left to CI)