Skip to content

fix(agents): ship the credential write-back in the image that is actually built - #285

Merged
artempartos merged 1 commit into
developfrom
artempartos/wire-credential-sync
Sep 17, 2026
Merged

artempartos merged 1 commit into
developfrom
artempartos/wire-credential-sync

Conversation

@artempartos

Copy link
Copy Markdown
Contributor

What is wrong

#279's Layer 2a — the watcher that reports a token the CLI rotated, so an OOM-killed pod no longer takes the rotation with it — has never been in an image.

The code went into docker/shared/watcher/index.js. Every agent Dockerfile copies the other one:

docker/antigravity-cli/Dockerfile:37:  COPY base/watcher/index.js ./
docker/claude-code/Dockerfile:86:     COPY base/watcher/index.js ./
docker/codex/Dockerfile:37:           COPY base/watcher/index.js ./
        … all seven
check result
CREDENTIAL_SYNC_URL in shared/watcher/index.js present, line 54
the same in base/watcher/index.js absent
references to shared/watcher in docker/, .github/, Makefile none
app sets the env for it yes — agent_base_strategy.rb:166-168, plus SESSION_ID at :126

docker/shared/watcher/ is the old location, last touched before #279 by 82496d80; the live copy moved to base/ and this one stayed behind, three commits out of date, which is exactly what made it look like the file to edit.

Everything server-side was complete and green throughout — route, endpoint, derived per-session key, integration test. That is the point: a suite passes on unreachable code. The app has been setting CREDENTIAL_SYNC_URL, CREDENTIAL_SYNC_KEY and CREDENTIAL_SYNC_PATHS into every agent container for a reader that was not there.

What this does

Ports the block verbatim into docker/base/watcher/index.js — configuration, startCredentialSync(), and the boot call — and deletes docker/shared/ so the same mistake cannot be made twice.

The port is byte-identical to what #279 wrote; diff against f87c75db:docker/shared/watcher/index.js is empty for both the config block and the function.

Verification

End-to-end, in a node:24-alpine container with the watcher's real dependencies, a real file watch and a receiving HTTP server — the path that was dead:

RECEIVER|listening
[watcher] Credential sync watching /auth/.credentials.json
RECEIVER|method=POST|path=/agents/credentials|session=4242|key=derived-test-key
         |body={"files":{"/auth/.credentials.json":"{\"claudeAiOauth\":{\"accessToken\":\"ROTATED-v2\"}}\n"}}
[watcher] Credential sync: reported 1 file(s)

The rotation is detected, debounced, posted once, and the header names are the ones AgentCredentialSyncController reads (X-Session-Id at line 26, X-Agent-Key at line 28) against the route at config/routes.rb:28. node --check passes on the modified watcher.

No Ruby changed, so the backend suite is unaffected.

Note

This blocks the image publish. main-images is 83 commits behind develop, so the next push to it republishes all seven images — worth landing this first, or that release ships the redaction filters from #283 while the write-back stays dead and looks shipped.

🤖 Generated with Claude Code

…ally built

The watcher half of the write-back landed in docker/shared/watcher/index.js. Every
agent Dockerfile copies base/watcher/index.js, and nothing anywhere references
shared/ — so the feature has never been in an image. docker/shared/watcher is the
old location: the live copy moved to base/ long ago and this one was left behind,
three commits out of date, which is what made it look like the file to edit.

The server side was complete and green the whole time — the route, the endpoint, the
derived per-session key, its tests — and the app has been setting CREDENTIAL_SYNC_URL,
CREDENTIAL_SYNC_KEY and CREDENTIAL_SYNC_PATHS into every agent container for something
that was not there to read them. A suite cannot catch this: it passes on unreachable
code.

Port the block verbatim into base/watcher/index.js and delete docker/shared so the
same mistake cannot be made twice.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos merged commit bd4db29 into develop Sep 17, 2026
7 checks passed
aixle-com Bot pushed a commit that referenced this pull request Dec 2, 2026
…r (row 18) (#978)

* docs(runners): record the §12.5 staging validation of the coder runner (row 18) (#285)

Signed-off-by: Alex <[email protected]>

* docs(runners): qualify row 18 result and state quota refusal not attempted

Signed-off-by: Alex <[email protected]>

---------

Signed-off-by: Alex <[email protected]>
Co-authored-by: Alex <[email protected]>
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