Repository navigation
chore(migration): write each install's runtime identity down explicitly - #962
Merged
Merged
Conversation
191 of 333 active installs carried no explicit runtimeType — the read path filled it from AGENT_TYPES[agentName]. So for the majority the runtime was a function of the agent's NAME, and the name is also the memory key (agentName, instanceId). There was nowhere to record "this seat runs BYO now" except by renaming it, which moves its memory. That is why ADR-022's "persona and runtime are chosen separately" was a migration rather than a refactor: until the runtime is a field, a user cannot change it without changing who the agent is. Behaviour-preserving by construction: the script does not reimplement the derivation, it calls sanitizeRuntimeConfig — the exported read path every consumer already goes through — and writes back exactly what it returns. A reimplementation would be a second copy of a subtle rule (the legacy local-cli/wrappedCli rewrite, LEGACY_RUNTIME_RENAME, the cloud default) and would drift the first time either changed. Applied to production 2026-08-16: 191 of 191 active rows modified, re-run reports 0 remaining in scope. Verified after: never-connected 30 and gone-dark 2 unchanged against host==='byo' 32 — no BYO seat was mislabelled reachable, which was the failure to guard against. Note for whoever picks this up: 192 active installs still derive `unknown`, unchanged by this migration. deriveAgentState branches only on native / push-webhook / byo and has no branch for cloud-hosted non-native runtimes (internal, moltbot). This migration does not fix that — it makes fixing it possible, because there is now a field to branch on. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8
lilyshen0722
added a commit
that referenced
this pull request
Aug 18, 2026
tsc's default moduleDetection treats a file without import/export as a global script. Our operational scripts use `const x = require(...)`, so they were modelled as sharing one scope — a scope they never share at runtime, where Node and ts-node give each file its own module scope. So backfill-byo-host-stamp.ts had claimed `mongoose`, `APPLY` and `main` repo-wide, and the next script written the same way failed TS2451. #953 and #962 each added one and each went red on the other's names, which reads as 'my PR is broken' rather than 'the model is wrong'. scripts/ is in tsconfig.build.json as well, so the next merge would have broken `npm run build` and the deploy — not only the CI gate. Verified before landing: 7 files repo-wide are modelled as global scripts, all standalone scripts plus jest.setup.js, no server runtime file. The sole emit change is an added "use strict"; shebangs stay on line 1. None of the affected .js scripts use sloppy-mode constructs. Full typecheck and a full build both ran clean with the flag.
lilyshen0722
added a commit
that referenced
this pull request
Aug 18, 2026
…#975) tsc's default moduleDetection treats a file without import/export as a global script. Our operational scripts use `const x = require(...)`, so they were modelled as sharing one scope — a scope they never share at runtime, where Node and ts-node give each file its own module scope. So backfill-byo-host-stamp.ts had claimed `mongoose`, `APPLY` and `main` repo-wide, and the next script written the same way failed TS2451. #953 and #962 each added one and each went red on the other's names, which reads as 'my PR is broken' rather than 'the model is wrong'. scripts/ is in tsconfig.build.json as well, so the next merge would have broken `npm run build` and the deploy — not only the CI gate. Verified before landing: 7 files repo-wide are modelled as global scripts, all standalone scripts plus jest.setup.js, no server runtime file. The sole emit change is an added "use strict"; shebangs stay on line 1. None of the affected .js scripts use sloppy-mode constructs. Full typecheck and a full build both ran clean with the flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applied to production 2026-08-16 — 191 of 191 active rows modified, re-run reports
in scope (active only): 0.Why
191 of 333 active installs carried no explicit
runtimeType; the read path filled it fromAGENT_TYPES[agentName]. So for the majority the runtime was a function of the agent's name — and the name is also the memory key(agentName, instanceId). There was nowhere to record this seat runs BYO now except by renaming it, which moves its memory.That's why @pod-architect's finding made ADR-022's "persona and runtime are chosen separately" a migration and not a refactor.
Safety property
It does not reimplement the derivation. It calls
sanitizeRuntimeConfig— the exported read path every consumer already goes through — and writes back exactly what it returns. A reimplementation would be a second copy of a subtle rule (legacylocal-cli/wrappedClirewrite,LEGACY_RUNTIME_RENAME, the cloud default) and would drift the first time either changed.Rows stop deriving what they now state. Nothing observable changes.
Transitions applied
Verified after
No BYO seat was mislabelled
reachable— that was the failure to guard against, since the resolver defaults an underivable host tocloudand a wrongly-cloud BYO seat would reintroduce the lie #943/#945 removed..lean()is load-bearing (theconfigMap trap that shipped as #948); the script is defensive both ways and documents why.Finding for whoever picks this up
192 active installs still derive
unknown, unchanged by this migration.deriveAgentStatebranches only on native / push-webhook / byo and has no branch for cloud-hosted non-native runtimes (internal,moltbot). This migration doesn't fix that — it makes fixing it possible, because there's finally a field to branch on.🤖 Generated with Claude Code
https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8