Repository navigation
Description
Tests fails on main in this fork. The same commit passes on cluesmith/codev, so this is
something about our CI environment, not the code.
What fails
Run 32448538074, job
Tower Integration Tests, on commit ff855d3e7.
src/agent-farm/__tests__/tower-api.e2e.test.ts: 13 of 16 tests fail. Every failure is the
Tower API answering 401 where the test expected something else:
GET /api/workspaces/:encodedPath/status AssertionError: expected 401 to be 404
GET /api/workspaces/:encodedPath/status AssertionError: expected 401 to be 400
POST /api/workspaces/:encodedPath/activate AssertionError: expected 401 to be 400
POST /api/workspaces/:encodedPath/deactivate AssertionError: expected 401 to be 404
GET /api/workspaces AssertionError: expected false to be true
Every request is rejected as unauthorized, so the test never reaches the behaviour it is
checking.
Why it is our environment
cluesmith/codevCI is green on the identical SHAff855d3e7. BothTestsand
CLI Integration Testspass there.- The same file passes locally. Full
@cluesmith/codevsuite: 269 files, 5352 passed,
48 skipped, 0 failed. - We are on that commit only because we fast-forwarded to it during the upstream sync. We
wrote none of this code.
Probable cause
The shared-key auth that arrived in the sync. Tower generates a key at
~/.agent-farm/local-key and clients read it, with a CODEV_TOWER_KEY environment override
(packages/sdk/src/node/local-key.ts).
.github/workflows/test.yml references no secrets, so this is not the usual "forks do not
inherit repository secrets" problem. More likely the runner starts Tower and reads the key in
an order that races, or a cached ~/.agent-farm carries a key that no longer matches.
Worth checking first
- Whether the runner has a stale
~/.agent-farmfrom Actions cache. - Whether the test waits for Tower to write
local-keybefore its first request. - Whether setting
CODEV_TOWER_KEYexplicitly in the workflow makes it deterministic.
Why it matters
The cron check posts a CI alert on every failure, so this keeps firing until someone fixes or
silences it. It also hides real breakage: with main already red, a genuine regression in
Tests looks the same as this.
Activity
pseudoseed commentedon Aug 21, 2026
New datapoint from PR #7 (issue #4): this failure is intermittent, not deterministic per commit.
Same branch, two consecutive CI runs, no code change between them beyond a markdown edit to the
PR body:
tower-api.e2e.test.ts, 13 failures,expected 401 to be 404/expected 401 to be 400/expected false to be true.mainis also not uniformly red:Testsfailed atff855d3e7(the commit cited above) but haspassed at
ecd7be98dand73689ca54since.So the framing of "fails on
mainin this fork, passes upstream and locally" is right about theenvironment being the variable, but the failure is flaky within this environment rather than
pinned to a commit. Anything looking for a deterministic per-SHA difference will not find one —
a race in Tower auth setup during CI startup looks more likely than a missing/incorrect secret,
since a missing secret would fail every run.
PR #7 does not fix this. It touches no auth, Tower-server, CI, or e2e code, and was merged
with this check red, knowingly and with the human's approval.
Merge pull request #115 from pseudoseed/fix/6-local-key-race
pseudoseed commentedon Aug 24, 2026
Reopening: my fix in #115 closed the clobber and left a torn read. Round 2 in #133.
writeFileSync(..., { flag: 'wx' })is exclusive but not atomic — it creates the file and then writes it, so a concurrent caller'sexistsSyncsees a zero-byte file, skips the create branch, and reads''.Reproduced over 25 cold-start rounds of 8 processes:
Two callers got an empty key while the file held a correct one — worse than the mismatch
wxwas added to fix, because an empty key presents as no key at all.Found by CI on an unrelated PR (#132), in the test #115 itself added. Fixed with temp-file +
link, which is atomic and EEXIST-on-conflict: 100/100 rounds consistent.Merge pull request #133 from pseudoseed/fix/6b-local-key-torn-read
pseudoseed commentedon Aug 24, 2026
Fixed in #133. 100/100 cold-start rounds consistent.