Skip to content

Make the nightly Full check green: one product race, the process-wide unbilled count, and test races - #3023

Merged
AbirAbbas merged 10 commits into
devfrom
w49/nightly-green
Dec 2, 2026
Merged

AbirAbbas merged 10 commits into
devfrom
w49/nightly-green

Conversation

@AbirAbbas

@AbirAbbas AbirAbbas commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

The nightly Full check on dev has failed every night since at least 11-16, with a different set of tests each night (runs 11-28 46170416581, 11-29 46289973210, 11-30 46524507020, 12-02 46826566078). The 11-30 and 12-02 runs are the same commit and failed on different tests, so most of these are races, not regressions. Each cause below was reproduced (or its straggler observed) against a baseline test binary built from dev, and the fix run against the same load. The load is a few niced CPU burners beside the test, to imitate the 4-shard CI runner.

What was wrong, and the fix

Test Cause Fix
TestTheSpendingTabIsTheSevenRowsAndNothingElse (every night) session.UnbilledCalls is a process-wide count that only grows. TestExportAfterCompactKeepsAllJournalTurns2685 leaves 13 calls unpriced (its fake stream has no usage block), so any internal/tui3 shard that runs it first draws an unbilled row. Shard 3 of 4 does, every night. Reproduced exactly at baseline. The Spending tab reads the count through a variable the test sets. A companion test pins when the row appears and where. Product behaviour is unchanged.
TestStartCrewConcurrentSameRequestSendsTheGoalOnce Product bug. CrewStart set b.starting after claims.create returned, but another caller can read the claim inside create. It saw an intent claim with no mark and answered uncertain, where the contract is busy. 21 failures in 1500 runs at baseline. Raise the mark before the claim can be read, and drop it again when the claim is another process's. 0 in 1500.
TestStorageOffSeatedTurnStopsWhenAnotherComputerContinuesIt (another computer) The test seats the chat a second time and nothing closes that seat. Its warm capture seals the first seat's unsaved call in the background. After the body returned, the store's wal, pack, catalog and workspaces/t-<hash> were still being written (8 files, 5 of 5 runs), which is the directory RemoveAll failed on. Drain the second seat. Afterwards only a daemon bookkeeping file changes. The test itself is not weakened.
TestAppWireCustomStorageFailureCanRetryWithoutDuplicate The test renames config.json, which only the start-up warm-up creates, in the background. With the warm-up delayed 300ms the old test fails every time with the CI message. The test settles the day limit itself first (idempotent, same lock as the warm-up). Passes with the same delay.
TestAppWireRegionSurvivesReopen The warm-up opens the process-wide engine half once a key exists, and its model discovery keeps writing under the profile; only closeEngineProcess joins it. model-catalog.json was seen changing after the cleanups. appProviderTest closes it after the backend, as the app's exit does. Not reproduced as a failure locally (1 straggler write in 6 runs at baseline, 0 in 6 after).
TestAppPassThroughTitleAndPreview The first agents.entries after the agent.changed event answered the local copy in 3 of 8 loaded runs. The test polls for the contract (the saved page at the remote head). 12 of 12 loaded runs pass. The product window itself (event dressed from the chat cache a step before the agent's own location) is left alone, see below.
TestTheBackgroundAfterClockKeepsTheCommandAndTheConversationMovesOn Wall-clock bound: the foreground turn must return within 4s of a 2s clock. The nightly measured 4.77s. The command now waits for a file the test creates after the turn returns, so only the clock can end the foreground wait. The lower bound stays.
TestC3AppHostedDisclosureWaitsForAcknowledgement/desktop_acknowledges Not resolved. One failure in four nights (timed out waiting for hosted background startup, 30s). Not reproduced in 8 loaded local runs. A startup that fails once retries after 5s, 10s, then 20s, so a second failure can outlast the 30s ceiling. Only the failure message now says whether the start was attempted, may retry and its retry wait. The next occurrence explains itself.

Not in this PR

Validation Contract

  • A same-request_id start that arrives while another is in flight is answered busy, never uncertain. uncertain is only for a claim another process holds or a start that stopped early.
  • The Spending tab shows its seven rows when no call went unpriced, and one unbilled row directly under the day, only when calls did.
  • A seated turn whose chat another computer continues stops, and no background seal outlives the fixture that started it.
  • A storage failure on keys.set reports an error, adopts no credential, and a retry persists exactly one row.
  • Once another computer holds a chat, agents.entries returns its saved page at that head.
  • A command promoted to a background job returns the foreground turn at the clock while the command is still running.

Each test maps to one line above. No test was reshaped to fit current output; the one product defect (the start mark) is fixed in the product.

What was driven

Drove the real bin/codeaf built from eabc825e3a over the codeaf app stdio wire, with a throwaway home and a scripted model. A fresh crews.create with start_manager starts once. A repeat of the same request is replayed, and the goal reaches the manager once. Two identical requests fired 0–40 ms apart, 160 pairs per run, two runs: every second caller was told busy or replayed, with 0 answered uncertain, and the goal was delivered once in all 320. The same sweep on dev a549981183 answered uncertain in 8 of 160.

🤖 Generated with Claude Code

AbirAbbas and others added 10 commits December 2, 2026 10:44
A same-request caller that read the intent claim inside claims.create, before
b.starting was set, was answered "uncertain" where the contract says "busy".
Reproduced 21 times in 1500 runs of TestStartCrewConcurrentSameRequestSendsTheGoalOnce
under load; 0 in 1500 with the mark raised first.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… config.json

Nothing in TestAppWireCustomStorageFailureCanRetryWithoutDuplicate created the
profile file it renames; the start-up warm-up does, in the background. Delaying
the warm-up 300ms makes the old test fail every time with the CI message.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…exit does

The warm-up opens the process-wide engine half once a key exists and its model
discovery keeps writing into the profile; only closeEngineProcess joins it.
Without it TempDir removal can race a late write (model-catalog.json was seen
changing after the cleanups).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The another-computer branch seats the chat a second time and nothing closes
that seat; its warm capture seals the first seat's unsaved call in the
background. After the body returns the store's wal, pack, catalog and
workspaces/t-<hash> were still being written (8 files, 5 of 5 runs); with the
second seat drained only a daemon bookkeeping file changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The first read after the agent.changed event answered the local copy in 3 of 8
loaded runs. The contract is the saved page at the remote head, so that is what
is waited for. 12 of 12 loaded runs pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The 2026-11-29 nightly timed out here with no state in the message. Report
whether the start was attempted, may retry and how long its retry wait is, so
the next occurrence explains itself.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…a gate

The test bounded the foreground turn at four seconds against a two-second clock
and the nightly measured 4.77s on a loaded runner. The command now waits for a
file the test creates after the turn returns, so only the clock can have ended
the foreground wait; the lower bound stays.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
session.UnbilledCalls is a process-wide count that only grows, and
TestExportAfterCompactKeepsAllJournalTurns2685 leaves 13 calls unpriced (its
stream carries no usage), so every nightly shard that ran it first drew an
unbilled row on the Spending tab. The count is now read through a variable the
test sets, and a companion test pins when the row appears.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@AbirAbbas
AbirAbbas merged commit 702282f into dev Dec 2, 2026
23 checks passed
@AbirAbbas
AbirAbbas deleted the w49/nightly-green branch December 2, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant