Repository navigation
plan: session-scoped agent identity (Plan / Interface) - #1815
Merged
Merged
Conversation
jhrozek
reviewed
Sep 24, 2026
jhrozek
left a comment
Contributor
There was a problem hiding this comment.
Traced the plan against the actual code it cites (agentdefs.go, root_authority.go, service.go, modelhook, project_ingestion.go, engine/session, engine/agent/dispatch.go) rather than reviewing the prose in isolation. Most of the plan holds up well and several claims are verified accurate (proto field numbers, mintRootAuthority vs the RootAuthority closure, the modelhook Pre-phase gap). The comments below are the places where the plan's text and the code it's built on currently disagree, plus one substantive design finding on Scenario 3's enforcement strategy. Posting as COMMENT, not a merge-gate verdict — these are inputs for plan/interface review, not blockers I'm asserting unilaterally.
kantord
force-pushed
the
plan/session-scoped-agent-identity
branch
from
September 28, 2026 10:20
329e60d to
8233526
Compare
Durable behavioral and interface contract for ADR 0353 (Session-scoped agent identity, merged as #1783). Architectural work classification; 3 scenarios, 25 acceptance criteria, 7 open human decisions (keeps the plan draft). Drafted via /to-acceptance-plan, reviewed by one devils-advocate pass and two specialist spot-checks (secure-code-reviewer, software-architect), all folded in: - devils-advocate: fixed a contradiction between AC2.5's original claim and the ADR's own text vs. actual code (memory:project placement), surfaced a hidden Limits zero-value decision, removed a task-shaped AC, added missing no-fs composition coverage. - software-architect: confirmed the buildAgentDefEngine split and the new AgentDefSessionEngineFactory's shape, flagged a 15-argument positional-prefix duplication risk and a provider/model resolver delegation opportunity for the eventual implementation. - secure-code-reviewer: found a CRITICAL, code-verified guardrail bypass (a definition hook's mutated payload is never re-inspected by the guardrail checker today) and a HIGH-severity mistargeted fail-closed guard (the real choke point is needsRehydration()/engineAndEnvironmentFor, not rehydrateSession, and RetryFailedRun/CompactSession/resumeFromAwaiting share the same exposure) - both now explicit ACs and human decisions. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Directing human resolved every open decision: - PermissionMode ordinal: local table now. - AgentDefSessionEngineFactory: never accepts a widening parameter. - Restart/MCP-resume: fail closed for v1, keep #1796 separate. - memory:project: implement placement-aware resolution (real new work; the exploratory Slice A branch doesn't do this yet). - Limits zero-value: means "inherit" for agent-bound sessions only, narrow carve-out, pre-existing convention elsewhere untouched. - Guardrail-mutation-inspection gap: fix in scope (a false security claim is worse than a wider diff). - Explicit tools: widening: correct the ADR wording instead of widening code, for v1. Ready for plan/interface review and merge. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Intermediate commit before rebasing onto main (which moved ~55 commits since this branch diverged) to re-verify Scenario 3 claims against current code, notably GrantToolAuthority (landed via #1673/ADR 0355 after this branch's merge-base - not visible in the stale checkout this commit's Scenario 3 text was verified against). Co-Authored-By: Claude Sonnet 5 <[email protected]>
Rebased onto main (55+ commits since branch diverged) and re-verified every code claim against current state, not the stale checkout the first review pass was drafted against. This surfaced a real gap in the previous fold-in: GrantToolAuthority (engine/session/principal.go) landed on main via #1673/ADR 0355 after this branch's merge-base, so it was invisible to earlier verification - it is a second, real, currently-unguarded authority-widening method alongside CompleteWorkspaceEnrollment, and both are now covered by the Ceiling requirement (AC3.1/AC3.2). Also folds the rest of jhrozek's round-1 review: - Fixed real factual errors: ADR 0352->0353 typo and stale draft/proposed status in docs/acceptance/README.md's index entry. - Corrected ADR 0353's stale "lists them explicitly" sentence to match actual code (an explicit tools: entry outside the base set is silently dropped, not granted) - done in this PR per review recommendation rather than deferred. - Fixed AC1.11's "if and only if" overstatement (no-fs profile still removes mutation tools even when the def allows them). - Expanded AC1.14 to name all 5 cases of the provider/model resolution algorithm, not just 2 of 5. - Corrected the Limits human-decision's premise (server code already treats zero as "unset", not "unlimited" - the .proto doc comment was the stale one, not the reverse). - Extended AC1.7/AC1.8's guardrail-mutation-inspection fix to cover PostToolUse (result mutation), not just PreToolUse (args mutation). - Extended AC2.5's memory:project placement fix to require the root-aware trust admission check (projectIngestionAdmittedForRoot), not the bare global-flag check resolveAgentMemoryHead calls today. - Noted #1741/#1809's parallel, in-flight redesign of CompleteWorkspaceEnrollment's internals as a coordination point, written so this plan's Ceiling requirement composes with either landing order rather than redesigning that work here. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Round-3 PR #1815 review (high severity, verified not a hallucination): modelhook.Runner no longer exists on main - ADR 0363 replaced hook-decorator guardrails with dispatch-level contextual review (reviewAction/prepareInboundAssessment, engine/agent/dispatch.go). Re-verified directly: both already inspect the effective/post-mutation payload (pre.effective for PreToolUse, the post-postHook result for PostToolUse), closing the exact gap AC1.7/AC1.8 were drafted against. AC1.7/AC1.8 are now pinning regression tests against the real current mechanism (confirming an agent-bound session inherits it via ordinary main-session Deps, AC1.6) rather than a fix targeting removed code. Retired Human decision 6's premise accordingly. Also fixed the moderate finding: AC1.12 now states the zero-value clause Human decision 5 resolved, so it's traceable to a verify: line. Co-Authored-By: Claude Sonnet 5 <[email protected]>
kantord
force-pushed
the
plan/session-scoped-agent-identity
branch
from
September 28, 2026 13:25
8233526 to
c7559c9
Compare
code-review (Standards + Spec) caught real self-inflicted staleness:
- Human decision 7's "tracked below in Deferred decisions" pointed to
a section that doesn't contain it - the ADR fix was already done in
this branch's own diff, not deferred. Same bug repeated in AC1.16's
parenthetical ("separate documentation follow-up, not this AC").
- The Deferred-decisions bullet still called AC1.7/AC1.8 an open
conditional ("if the corresponding Human decision keeps it in
scope") after that decision was already resolved to "retired" in
the previous commit. Dropped them from the bullet per review
recommendation.
Also fixed the judgment calls:
- Trimmed the GrantToolAuthority/CompleteWorkspaceEnrollment
mechanism description duplicated near-verbatim between the
Interface contract and Scenario 3 - Scenario 3 now references the
Interface contract instead of restating it.
- Added a proper AGENTS.md markdown link for the "mutate Session
through aggregate methods" citation, matching this doc's own
citation convention everywhere else.
- Removed a stray double blank line in docs/acceptance/README.md.
- Added AC1.17 for the "no special-casing by discovery mechanism"
claim, which previously had prose but no verify: line.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Systematic pass per the directing human's request: extracted every internal cross-reference (all 29 AC mentions, all Human-decision pointers, every numeric enumeration) and verified each against its actual target, plus re-verified external PR/issue status. Found and fixed: - "either of the two extra grant channels" (opening summary) - undercounted; now names all four (RootAuthority, MCPBroker, GrantToolAuthority, CompleteWorkspaceEnrollment). - "beyond the four originally named" (Scenario 3 intro + Interface contract, same bug in two places) - the real original count was six (SetMode, LoadSessionWithMCP, StartRunContent, RetryFailedRun, CompactSession, resumeFromAwaiting), not four. Both now say six and name them. - Scenario 1's "three channels this exploration found" - stale from the very first draft, before rounds 2/3 found more channels; now scoped correctly to what Scenario 1 itself proves, pointing to Scenario 3 for the rest. - "Deferred decisions" bullet 1 was missing the Ceiling/ GrantToolAuthority/CompleteWorkspaceEnrollment mechanism entirely - the biggest thing ADR 0353's text doesn't name yet, discovered in the latest review round, never folded back into this earlier bullet. - External state drift: PR #1741 (workspace-enrollment-authority) MERGED 2026-09-24 - was still described as "proposed, not yet approved" in two places (Scenario 3 + Interface contract, same stale phrase in both). Re-verified CompleteWorkspaceEnrollment's actual code is still unimplemented (naive full-replace) despite the approved contract, so this plan's technical claims still hold. - PR #1730 already renumbered itself again (0351->0365) - fixed two "still-unnumbered"/"pending renumbering" mentions. All AC cross-references (29 ACs), all Human-decision pointers, and all remaining enumerated counts verified correct on this pass. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Merged
2 tasks
kantord
added a commit
that referenced
this pull request
Sep 30, 2026
… (ADR 0353, Task C) Implements ADR 0353's 5-case provider/model pair resolution (resolveAgentDefRootProviderModel) and tighten-only Limits/PermissionMode clamps (tightenLimits, clampPermissionMode) for an agent-bound session, wired into agentDefSessionEngineFactory in place of the placeholder resolveChildProvider call (whose def-wins-over-parent, silent-fallback contract is wrong for case 5 — an unavailable def-pinned provider must fail session creation, never silently fall back). Case 1 delegates to the existing resolveProviderModel for its base-pair computation, per the plan's own implementation guidance; cases 2-5 are fresh logic against the request's own ProviderSelector. Pins AC1.12 (TestSessionScopedAgentIdentity_Scenario1_LimitsTightenOnly), AC1.13 (TestSessionScopedAgentIdentity_Scenario1_PermissionModeClampedNotRaised), AC1.14 (TestSessionScopedAgentIdentity_Scenario1_ProviderModelPairResolution). Plan / Interface PR: #1815 (merged, a9dfd84) Co-Authored-By: Claude Sonnet 5 <[email protected]>
kantord
added a commit
that referenced
this pull request
Oct 8, 2026
Adds the CreateSessionRequest.agent_definition_name / CreateSessionResponse .resolved_agent_definition_name wire fields, a write-once AgentDefinitionName label on session.Session and sessnap.Snapshot, and verbatim echo on the response. Plumbing only: no catalog restriction, provider/model/limits/ permission-mode resolution, or validation is wired from this field yet — that is later work in docs/acceptance/session-scoped-agent-identity.md. Pins AC2.1 (TestSessionScopedAgentIdentity_Scenario2_PersistsAcrossSnapshotRoundTrip) and AC2.2 (TestSessionScopedAgentIdentity_Scenario2_ResponseEchoesBoundName). Plan / Interface PR: #1815 (merged, a9dfd84) Co-Authored-By: Claude Sonnet 5 <[email protected]>
kantord
added a commit
that referenced
this pull request
Oct 8, 2026
… (ADR 0353, Task C) Implements ADR 0353's 5-case provider/model pair resolution (resolveAgentDefRootProviderModel) and tighten-only Limits/PermissionMode clamps (tightenLimits, clampPermissionMode) for an agent-bound session, wired into agentDefSessionEngineFactory in place of the placeholder resolveChildProvider call (whose def-wins-over-parent, silent-fallback contract is wrong for case 5 — an unavailable def-pinned provider must fail session creation, never silently fall back). Case 1 delegates to the existing resolveProviderModel for its base-pair computation, per the plan's own implementation guidance; cases 2-5 are fresh logic against the request's own ProviderSelector. Pins AC1.12 (TestSessionScopedAgentIdentity_Scenario1_LimitsTightenOnly), AC1.13 (TestSessionScopedAgentIdentity_Scenario1_PermissionModeClampedNotRaised), AC1.14 (TestSessionScopedAgentIdentity_Scenario1_ProviderModelPairResolution). Plan / Interface PR: #1815 (merged, a9dfd84) Co-Authored-By: Claude Sonnet 5 <[email protected]>
kantord
added a commit
that referenced
this pull request
Oct 13, 2026
Adds the CreateSessionRequest.agent_definition_name / CreateSessionResponse .resolved_agent_definition_name wire fields, a write-once AgentDefinitionName label on session.Session and sessnap.Snapshot, and verbatim echo on the response. Plumbing only: no catalog restriction, provider/model/limits/ permission-mode resolution, or validation is wired from this field yet — that is later work in docs/acceptance/session-scoped-agent-identity.md. Pins AC2.1 (TestSessionScopedAgentIdentity_Scenario2_PersistsAcrossSnapshotRoundTrip) and AC2.2 (TestSessionScopedAgentIdentity_Scenario2_ResponseEchoesBoundName). Plan / Interface PR: #1815 (merged, a9dfd84) Co-Authored-By: Claude Sonnet 5 <[email protected]>
kantord
added a commit
that referenced
this pull request
Oct 13, 2026
… (ADR 0353, Task C) Implements ADR 0353's 5-case provider/model pair resolution (resolveAgentDefRootProviderModel) and tighten-only Limits/PermissionMode clamps (tightenLimits, clampPermissionMode) for an agent-bound session, wired into agentDefSessionEngineFactory in place of the placeholder resolveChildProvider call (whose def-wins-over-parent, silent-fallback contract is wrong for case 5 — an unavailable def-pinned provider must fail session creation, never silently fall back). Case 1 delegates to the existing resolveProviderModel for its base-pair computation, per the plan's own implementation guidance; cases 2-5 are fresh logic against the request's own ProviderSelector. Pins AC1.12 (TestSessionScopedAgentIdentity_Scenario1_LimitsTightenOnly), AC1.13 (TestSessionScopedAgentIdentity_Scenario1_PermissionModeClampedNotRaised), AC1.14 (TestSessionScopedAgentIdentity_Scenario1_ProviderModelPairResolution). Plan / Interface PR: #1815 (merged, a9dfd84) Co-Authored-By: Claude Sonnet 5 <[email protected]>
kantord
added a commit
that referenced
this pull request
Oct 13, 2026
Adds the CreateSessionRequest.agent_definition_name / CreateSessionResponse .resolved_agent_definition_name wire fields, a write-once AgentDefinitionName label on session.Session and sessnap.Snapshot, and verbatim echo on the response. Plumbing only: no catalog restriction, provider/model/limits/ permission-mode resolution, or validation is wired from this field yet — that is later work in docs/acceptance/session-scoped-agent-identity.md. Pins AC2.1 (TestSessionScopedAgentIdentity_Scenario2_PersistsAcrossSnapshotRoundTrip) and AC2.2 (TestSessionScopedAgentIdentity_Scenario2_ResponseEchoesBoundName). Plan / Interface PR: #1815 (merged, a9dfd84) Co-Authored-By: Claude Sonnet 5 <[email protected]>
kantord
added a commit
that referenced
this pull request
Oct 13, 2026
… (ADR 0353, Task C) Implements ADR 0353's 5-case provider/model pair resolution (resolveAgentDefRootProviderModel) and tighten-only Limits/PermissionMode clamps (tightenLimits, clampPermissionMode) for an agent-bound session, wired into agentDefSessionEngineFactory in place of the placeholder resolveChildProvider call (whose def-wins-over-parent, silent-fallback contract is wrong for case 5 — an unavailable def-pinned provider must fail session creation, never silently fall back). Case 1 delegates to the existing resolveProviderModel for its base-pair computation, per the plan's own implementation guidance; cases 2-5 are fresh logic against the request's own ProviderSelector. Pins AC1.12 (TestSessionScopedAgentIdentity_Scenario1_LimitsTightenOnly), AC1.13 (TestSessionScopedAgentIdentity_Scenario1_PermissionModeClampedNotRaised), AC1.14 (TestSessionScopedAgentIdentity_Scenario1_ProviderModelPairResolution). Plan / Interface PR: #1815 (merged, a9dfd84) Co-Authored-By: Claude Sonnet 5 <[email protected]>
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.
Summary
Stage: Plan / Interface. Durable behavioral and interface contract for ADR 0353 (Session-scoped agent identity, merged in #1783). This does not implement anything — it is the plan/interface review checkpoint before autonomous TDD implementation.
verify:lines.draftuntil a reviewer resolves them. Each carries a recommendation.Relates to #1053.
Review already performed
Per
/to-acceptance-plan, this draft already went through onedevils-advocatepass and two specialist spot-checks before this PR opened, all folded in:resolveAgentMemoryHead) doesn't support — plus a hiddenLimitszero-value decision, a task-shaped (non-observable) AC, and missingprofile:"no-fs"composition coverage. All fixed.buildAgentDefEnginesplit and the newAgentDefSessionEngineFactory's shape are sound; flagged a 15-argument positional-prefix duplication risk between the two engine-builder functions and a provider/model-resolver delegation opportunity, both now implementation guidance in "Deferred decisions."PreToolUsepayload is never re-inspected by the guardrail checker today (modelhook.Runner.checkreads the stale pre-mutation event) — and a HIGH-severity mistargeted fail-closed guard (the real shared choke point isneedsRehydration()/engineAndEnvironmentFor, notrehydrateSession;RetryFailedRun/CompactSession/resumeFromAwaitingshare the same exposure and weren't originally named). Both are now explicit ACs (AC1.7/AC1.8, AC3.2) and open Human decisions.What needs a decision before this can move to
proposedThe 7 open Human decisions, in short:
PermissionModeclamp ordinal — local table now vs. block on PR plan(permissions): one named permission-mode vocabulary and two admission gates #1730.AgentDefSessionEngineFactoryever accept a tool-widening parameter? (Recommended: never.)memory: project— thread the session's own placement in, or keep today's process-wide behavior? (Recommended: thread it in — it's real work, but it's also what the ADR already claims is true.)Limitszero-value semantics on an agent-bound session — inherit vs. explicit-unlimited? (Recommended: inherit.)Test plan
bash .claude/skills/to-acceptance-plan/scripts/check-acceptance-plan.sh docs/acceptance/session-scoped-agent-identity.md— passed with warnings (advisory only: noTestADR_NNNN_*/TestInvariant_*names, which is expected — this plan's ACs use theTest<Plan>_Scenario<N>_*convention instead)bash .claude/skills/to-acceptance-plan/scripts/check-acceptance-plan-test.sh— fixture regression suite passedtask docs— matlatl strict check: 0 broken links/anchors/orphans across 450 documentsFully or partially written by an AI agent.
🤖 Generated with Claude Code