You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
runtime/flybot-image: recipe tests read the host's real /run/secrets model-api file and fail on a provisioned host #3490
agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a templateagent-workingAn agent has claimed this issue (the claim comment names the branch)
The recipe's own contract tests are not hermetic: test/model-api.test.js:66 assumes the machine has no default model-api secret file, so npm test inside runtime/flybot-image fails on any host that has been provisioned with the deployment secret.
Reproduce on a host that has run the runtime image at least once (secret owned by uid 1000):
ls -l /run/secrets/flybot-workspace-model-api.json
cd runtime/flybot-image && npm test
Expected: 29 pass. The test builds its own temporary secret files under a temp dir and only wants to prove the allowlist behaviour.
Actual: 28 pass, 1 fail.
not ok 4 - reads only allowlisted secret paths and skips a missing file
test/model-api.test.js:80
+ actual '/run/secrets/flybot-workspace-model-api.json'
- expected undefined
Cause: model-api.jsresolveModelApiPath walks the hard-coded DEFAULT_FILES (/run/secrets/flybot-workspace-model-api.json, /data/secrets/model-api.json) and returns the first that exists. test/model-api.test.js:80 asserts resolveModelApiPath({}) === undefined, which only holds on a machine without those files; the test's own comment admits the helper hard-codes the default paths.
Why CI stays green: GitHub-hosted runners do not have /run/secrets/..., so the same test passes there. The red only appears on the operator host the recipe is built for.
Scope: test isolation, not a product defect — loadModelApi / applyModelApi behave as designed. A fix has to make the default list injectable (or make the assertion depend on the file's real presence) instead of assuming a bare host.
Branch: dev/3490-hermetic-model-api-tests (from main a062ba2158261ed0e5e5e217723e19df290ff02a).
Plan: make the default candidate list an optional argument of resolveModelApiPath / loadModelApi, pass an explicit empty list from the test so it stops reading host state, and assert that every DEFAULT_FILES entry lives under an ALLOWED_PREFIXES directory so the invariant the old assertion was reaching for is still covered. Production callers keep the single-argument form.
Local readings on this host (which does have /run/secrets/flybot-workspace-model-api.json, 272 B), not CI: runtime/flybot-imagenpm test 29/29 pass after the change versus 28/29 on main a062ba21; repo root tests/*.test.mjs 974/974 pass.
1f62d02b1df63ca8bd5215c7469c39223f4d7406 — squash of #3492, single parent a062ba21, tree 74859f440f2584fde3954984e466eb4584ea7df0, 2 files +15/-8 (runtime/flybot-image/model-api.js 5/5, runtime/flybot-image/test/model-api.test.js 10/3).
resolveModelApiPath and loadModelApi now take an optional second argument (defaults = DEFAULT_FILES), so the recipe test asserts against an empty list instead of the host secret store; a new assertion keeps every entry of DEFAULT_FILES inside ALLOWED_PREFIXES. Production call sites (ds-bot-bridge.mjs:623, launch.mjs:10) still call with a single argument, so runtime behaviour is unchanged.
Local check on a host that does have /run/secrets/flybot-workspace-model-api.json (272 B): the package goes from 28/29 to 29/29 rc 0, and reverting the defaults turns the new assertions red again.
agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a templateagent-workingAn agent has claimed this issue (the claim comment names the branch)
Activity
Birfy commentedon Dec 2, 2026
Claiming this for one reviewable slice.
Branch:
dev/3490-hermetic-model-api-tests(from maina062ba2158261ed0e5e5e217723e19df290ff02a).Plan: make the default candidate list an optional argument of
resolveModelApiPath/loadModelApi, pass an explicit empty list from the test so it stops reading host state, and assert that everyDEFAULT_FILESentry lives under anALLOWED_PREFIXESdirectory so the invariant the old assertion was reaching for is still covered. Production callers keep the single-argument form.Local readings on this host (which does have
/run/secrets/flybot-workspace-model-api.json, 272 B), not CI:runtime/flybot-imagenpm test29/29 pass after the change versus 28/29 on maina062ba21; repo roottests/*.test.mjs974/974 pass.Birfy commentedon Dec 2, 2026
Implemented and merged.
1f62d02b1df63ca8bd5215c7469c39223f4d7406— squash of #3492, single parenta062ba21, tree74859f440f2584fde3954984e466eb4584ea7df0, 2 files +15/-8 (runtime/flybot-image/model-api.js5/5,runtime/flybot-image/test/model-api.test.js10/3).resolveModelApiPathandloadModelApinow take an optional second argument (defaults = DEFAULT_FILES), so the recipe test asserts against an empty list instead of the host secret store; a new assertion keeps every entry ofDEFAULT_FILESinsideALLOWED_PREFIXES. Production call sites (ds-bot-bridge.mjs:623,launch.mjs:10) still call with a single argument, so runtime behaviour is unchanged.Local check on a host that does have
/run/secrets/flybot-workspace-model-api.json(272 B): the package goes from 28/29 to 29/29 rc 0, and reverting the defaults turns the new assertions red again.Related #3492