Skip to content

chore(migration): write each install's runtime identity down explicitly - #962

Merged
lilyshen0722 merged 2 commits into
mainfrom
chore/explicit-runtime-identity
Aug 18, 2026
Merged

lilyshen0722 merged 2 commits into
mainfrom
chore/explicit-runtime-identity

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

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 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'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 (legacy local-cli/wrappedCli rewrite, 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

 89  ∅/∅ → moltbot/cloud
 79  ∅/∅ → internal/cloud
 11  ∅/∅ → ∅/cloud
  7  ∅/∅ → codex/cloud
  5  ∅/∅ → claude-code/cloud

Verified after

never-connected  30
gone-dark         2   against host==='byo' 32   ← reconciles exactly

No BYO seat was mislabelled reachable — that was the failure to guard against, since the resolver defaults an underivable host to cloud and a wrongly-cloud BYO seat would reintroduce the lie #943/#945 removed.

.lean() is load-bearing (the config Map 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. deriveAgentState branches 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

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.
@lilyshen0722
lilyshen0722 merged commit 426e051 into main Aug 18, 2026
11 checks passed
@lilyshen0722
lilyshen0722 deleted the chore/explicit-runtime-identity branch August 18, 2026 08:28
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