Repository navigation
fix(server): make the upstream harnesses deterministic and require them in check - #311
Merged
Merged
Conversation
`/compact` after a turn never ended in own mode since #284: the Replay agent's session has no `thread.compact`, so the start publishes a failed `turn.terminal` on the session's stream, and the routing #284 ported takes a terminal only for the run's root provider turn, which no turn reported yet. The run waited for a terminal it had dropped. Upstream settles such a run with that terminal directly (`makeFailedTerminalEvent`), without routing it. The run now takes the terminal that names its failed provider turn, which is the attempt's own or one named for the failed attempt (`failedProviderTurnId`), as the start now names it too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The differential harnesses compared states that depended on which of two concurrent writes came first, or on how long a busy runner took: - A turn's start records the context handoffs it delivered once the provider took the prompt, while the session's stream ingests the turn's first events; either lands first, in upstream as in own mode. Table dumps now put such a handoff ahead of the ingested events it landed among (own_forks, own_imports, own_switch, own_rollback). - A runtime request's node, the request and its card are written one by one; a harness answered once the request was there, sometimes before its card. It now waits for the card (own_agent_threads, own_requests, own_fresh, own_recovery), and answers a request again once the next one waits, not 300 ms after the first answer. - Steering and Stop into a Replay turn counted on the agent's next frame coming 250 ms after the plan. fixtures/hold-replay-agent.mjs puts upstream's Replay agent behind a proxy whose turns hold at their plan, or before their first frame, until the client cancels them (own_steering, own_limit_stop). - A `subscribeThread` watcher returned before its snapshot was taken, so the snapshot held what the next message wrote or not, and stopped 500 ms after the last turn. It now waits for the snapshot, and stops once the stream carried the thread's last event (own_turns, own_requests, own_subagents, own_background_work). - The fake Claude CLI reported its MCP tool call before running it, so the link the tool writes and the call's items raced. It now runs the tool first (own_background_work). own_workspace's tests log the bridge, which hosts the terminals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The harnesses no longer depend on the runner's timing, so `check` needs them. A harness that fails fails the run, with no second try, and the ones skipped for being broken run again: own_commands, own_steering, and own_workspace::terminals on Linux. Each shard now reads its tests from the sources and builds only their targets, in the background while it restores upstream, so it does not build all forty test binaries after the restore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to it A stream sends its next chunk only once the client acknowledged the last. The terminals harness wrote to a terminal with a plain call on the socket that carried the terminal's stream, so when the shell's first prompt landed during the write, the call dropped it unacknowledged and the stream stopped: on Linux, where bash prints its prompt later than zsh, the echo never came. call_beside reads and acknowledges the stream while it waits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
opficdev
force-pushed
the
fix/harness-flakes
branch
from
December 5, 2026 18:14
33d8c54 to
4729b96
Compare
Each runner runs its share longest first, so short harnesses fill in beside the long ones, and the table holds the times measured on CI with the harnesses that now wait on conditions. pnpm sets up only when upstream has to be installed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Makes every upstream differential harness (
crates/server/tests/own_*.rs) deterministic and moves theharnessesjob intocheck. Follows up the flakes listed in #308.Each flake, its cause and its fix
own_forks,own_imports,own_switch,own_rollbackcontext-handoff.updatedit delivered while the session stream ingests the turn's first events. Either lands first, in upstream as in own mode.harness::order_delivered_handoffs). Every other event keeps its place.own_requestspending()waits for the request together with its waiting card.own_agent_threads,own_fresh,own_recoverywaiting.own_limit_stop,own_steeringfixtures/hold-replay-agent.mjsproxies the Replay agent, and its turns hold at their plan (HOLD_AFTER_PLAN) or before their first frame (HOLD_FROM_START) until the client cancels.own_steeringnow runs.own_turns,own_background_work,own_subagents,own_requestsharness::watch_threadwaits for the snapshot and stops once it saw the thread's last stored event.own_background_worktool_useand ran its MCP tool at the same time.own_workspace::terminals(Linux)harness::call_besidereads and acks the stream while the call waits. The test now takes 5 s instead of timing out at 30 s.own_commands/compacton a session withoutthread.compactpublishes a failed terminal for a turn that never started. Run routing then dropped that terminal, because it was not the root provider turn, so the run never ended.own_manual_continuation,own_mcp_sessionscheck./compactin own modeAs in upstream, a run whose turn could not start now ends with its
failedProviderTurnId. That is the attempt's provider turn, or one named for the failed attempt (ids::failed_provider_turn). Run routing accepts that turn's terminal as the end of the root turn.CI
harnessesis incheck'sneeds.check: the harness jobs took 137 to 172 s on the final head's three runs. Before, the harnesses alone took 200 to 270 s per Linux shard and 360 to 511 s on macOS. The floor comes from:docs/ci.mddescribes the required jobs, what keeps the harnesses still, and what stays manual.Verification
HOME,TERN_KEYCHAIN=offand Node 26.13.1, all passed. The last passes includeown_workspace::terminals.cargo fmt --all,cargo clippy --workspace --all-targets --locked -- -D warningsandcargo test --workspace --locked(1,460 tests) all pass.checkpassed three runs in a row on the final head.🤖 Generated with Claude Code