Repository navigation
[local-test-e2e-cover-worker-harness-failover-o] test(e2e): cover worker harness failover on a usage limit - #367
Conversation
…(e2e): cover worker harness failover on a usage limit
Artifacts & verificationRun: 38 · Commit: Change explanationProduced by No PR template was found in this repository ( test(e2e): cover worker harness failover on a usage limitWhy this change is neededThe worker supports a priority chain such as Before this change, e2e coverage only exercised installed-harness argv and the deterministic fake agent. Nothing drove the real worker's failover state machine end to end. (Motivation above is taken from the task section. The diff alone does not state it.) What changedNew end-to-end failover test.
The happy-path scenario asserts: the row settles A second, deterministic scenario makes both stubs report a limit. It asserts the row is requeued Read-only queue inspection. Documentation. No production failover, detection, or worker behavior was changed. The diff touches only Validation actually performedObserved in the pipeline evidence (verify step):
Not performed / not observed:
Material risks
Where reviewers should focus
Suggested checks (not performed): raise the second scenario timeout to match the first (180s) or derive it from helper deadlines; bind the Visual explanationProduced by Show artifactSummaryAdds EvidenceAsserted by the test, per the diff:
Validation, quoted from the pipeline verification step (observed, not re-run here): the required sequence passed — Before/after execution results were not captured. The change introduces a test where the matrix previously recorded a Merge DangerAll four files are inside Verification reportProduced by Show artifactAuto-review summaryProduced by Show artifact |
Why
Task local-test-e2e-cover-worker-harness-failover-o: test(e2e): cover worker harness failover on a usage limit
The worker's harness failover path (
AGENT_HARNESS=claude-code,codex) had no end-to-end coverage: only argv acceptance and fake-agent modes were tested, so a regression in usage-limit detection, exit 75 handling, retry-on-fallback, or persisted failover state would go unnoticed. The new test drives the real builtdevintern workerdaemon through that state machine offline.What changed
packages/e2e/tests/local/worker-harness-failover.test.ts(new): two scenarios usingWorkerFixture.CLAUDE_CODE_CLI_PATH) emitsClaude usage limit reached+ adjacentresets in 1 hourand exits 1; fallback stub (CODEX_CLI_PATH)execshelpers/fake-agent.tswith the original argv. Asserts the row settlesdone, run statuses are["deferred", "succeeded"], the primary spawned exactly once, the fallback produced the canonical edit, the pushed branch containsexport const greeting = "Hello, world!";and diff-vs-base is onlysrc/greeting.ts, worker logs nameclaude-code → codex(no generic failure / kept-worktree message), andwebhook_metaholds a futurerate_limit:claude-codewithfailover:active_harness=codex.pending, twodeferredruns, both future windows persisted, no branch ref on the bare remote, and the daemon stays alive.packages/e2e/helpers/worker.ts: addedrateLimits()andactiveHarness()read helpers over the existingquery()read-only pattern (with key constants), so tests do not duplicatewebhook_metaSQL.packages/e2e/README.md: new “Worker harness failover (usage limit)” section covering the stub strategy, theAGENT_CLI_PATHprecedence trap, assertions, the attempt-suffix detail, and the default command.packages/e2e/docs/coverage-matrix.md: both requested rows moved fromgaptodefaultwith the exact test file; backlog item 14 struck through as implemented.Scope
Included: the new local test, the two queue read helpers, README and coverage-matrix updates. No production code, detection patterns, failover policy, or unrelated helpers were changed. Nothing was committed, pushed, labelled, or opened as a PR.
Tradeoffs
feature/<task_key>. In reality a usage limit is detected afterprepare-branchhas already created the unsuffixed ref, so the failover retry is a fresh attempt andfindAvailableFeatureBranchNameproducesfeature/<task_key>-attempt-2. The test asserts the recorded/pushed branch explicitly and the README documents why; the actual primary failure was observed before choosing that assertion.AGENT_CLI_PATHis cleared in the test. Env-driven resolution prefers it over every<HARNESS>_CLI_PATH, so leaving it set would send the codex retry back to the primary stub and the fallback would never run.Blast Radius
WorkerFixtureconsumers: the new methods only add API; no existing method or default changed, so all current worker tests are unaffected.default, which changes what the e2e scout considers already covered.packages/code/distwas rebuilt only to run the suite.Verification
Ran from the repository root, in order:
bun run --filter @getdevintern/code build— passed.bun run --filter @devintern/e2e test— 135 pass, 16 skip, 4 todo, 0 fail (155 tests / 24 files, ~50s), including both new scenarios.bun run --filter @devintern/e2e typecheck— passed.bun run --filter @devintern/e2e lint— passed.bun run --filter @devintern/e2e format:check— passed.Also ran the new file alone twice: 2 pass, 0 fail. The first draft failed the literal
feature/<task_key>assertion withReceived: "feature/local-expand-the-greeting-across-harnesses-attempt-2", which established the suffix behavior corrected above.This PR was automatically created by @devintern/code