gchandler: who is calling gc is what the server kept of the start #70

Merged
mikluko merged 1 commit from gc-identity-from-start into main 2026-11-16 09:27:25 +00:00
Owner

The handler sets the eleven identity variables from what the server kept of the session's start, not from the request. session.IdentityEnv is the list (it replaces the handler's own).

Where each comes from (the registry's marks of the session, written by operate.setMarks from the start config's environment):

  • GC_SESSION_ID, GC_RUNTIME_EPOCH, GC_INSTANCE_TOKEN: marks gc keeps current. At the pinned revision gc writes them only in stampAdoptedRuntime (the adoption barrier, SetMeta), when it adopts a running session that has none; they arrive as set-meta and the handler reads them at each call, so they are not stale.
  • GC_AGENT, GC_ALIAS, GC_SESSION_NAME, GC_TEMPLATE, GC_SESSION_ORIGIN, GC_CONTINUATION_EPOCH, GC_PROVIDER, GC_STARTUP_PROMPT_DELIVERED: fixed by the start. gc does not write them after it (no SetMeta for them in the source); a new start clears the marks and records its own.

Not taken from anywhere: GC_HOOK_DEADLINE (a call's own, in gc's list of session-scoped variables), BEADS_ACTOR, BEADS_HOLDER_TOKEN and CLAUDE_CODE_SESSION_ID (also in that list; the stand-in sends only GC_*, so bd's actor attribution through the stand-in is not this change's to settle).

A session started before this release has no record (a marker mark says one was made); for it the request's identity is taken as before, until it starts again. A record the server cannot read fails the call.

Tests: the record wins over a request that claims another identity and the request adds nothing the record lacks; the fallback for a session with no record; a read error; the registry's record, with the epoch moving as gc stamps it; the start records it.

The handler sets the eleven identity variables from what the server kept of the session's start, not from the request. `session.IdentityEnv` is the list (it replaces the handler's own). **Where each comes from** (the registry's marks of the session, written by `operate.setMarks` from the start config's environment): - `GC_SESSION_ID`, `GC_RUNTIME_EPOCH`, `GC_INSTANCE_TOKEN`: marks gc keeps current. At the pinned revision gc writes them only in `stampAdoptedRuntime` (the adoption barrier, `SetMeta`), when it adopts a running session that has none; they arrive as `set-meta` and the handler reads them at each call, so they are not stale. - `GC_AGENT`, `GC_ALIAS`, `GC_SESSION_NAME`, `GC_TEMPLATE`, `GC_SESSION_ORIGIN`, `GC_CONTINUATION_EPOCH`, `GC_PROVIDER`, `GC_STARTUP_PROMPT_DELIVERED`: fixed by the start. gc does not write them after it (no `SetMeta` for them in the source); a new start clears the marks and records its own. Not taken from anywhere: `GC_HOOK_DEADLINE` (a call's own, in gc's list of session-scoped variables), `BEADS_ACTOR`, `BEADS_HOLDER_TOKEN` and `CLAUDE_CODE_SESSION_ID` (also in that list; the stand-in sends only `GC_*`, so bd's actor attribution through the stand-in is not this change's to settle). A session started before this release has no record (a marker mark says one was made); for it the request's identity is taken as before, until it starts again. A record the server cannot read fails the call. Tests: the record wins over a request that claims another identity and the request adds nothing the record lacks; the fallback for a session with no record; a read error; the registry's record, with the epoch moving as gc stamps it; the start records it.
gchandler: who is calling gc is what the server kept of the start
All checks were successful
image / image (pull_request) Successful in 16s
test / changelog (pull_request) Successful in 4s
test / go (pull_request) Successful in 58s
0737cca304
The eleven variables by which gc knows the caller were the request's word, so a
session with a valid token could speak to gc as another. The server now keeps
them with the start, as the session's marks, and sets them from there.

Assisted-By: Claude <noreply@anthropic.com>
mikluko deleted branch gc-identity-from-start 2026-11-16 09:27:25 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/roomcity!70
No description provided.