Skip to content

fix(intercept): name the sessionId namespace in ledger deny hints#307

Merged
LanNguyenSi merged 1 commit into
masterfrom
fix/ledger-deny-namespace-hint
Jun 25, 2026
Merged

fix(intercept): name the sessionId namespace in ledger deny hints#307
LanNguyenSi merged 1 commit into
masterfrom
fix/ledger-deny-namespace-hint

Conversation

@LanNguyenSi

Copy link
Copy Markdown
Owner

What

Ledger-gate deny "to satisfy" hints now name the sessionId namespace the unblocking ledger entry must be written under.

before: ... To satisfy: record an evidence-ledger entry containing `review:42` (session `sess-1`).
after:  ... To satisfy: record an evidence-ledger entry containing `review:42`, under this runtime session's id `sess-1` (not the agent-tasks task UUID).

Why

Two ledger namespaces exist: the runtime session id (harness runtime MCP gates) and the agent-tasks task UUID (the CI merge-approval GitHub Check). The deny hint showed the session id value but never named which namespace it was, so an agent holding both a session id and a task UUID could write under the wrong one. An entry under the task UUID never satisfies a harness runtime gate, which reads, writes, and hints under the same resolveSessionId value. This caused a real production failure (2026-05-17, PRs #174/#175): the first write under the task UUID was rejected, the second under the session id passed.

How

  • src/runtime/intercept.ts: the hintSuffix now names the namespace identity. Naming an identity is not a producer verb, so the deny path stays neutral on producer choice (agent-tasks/88ca4bb3); the recordHint contract in src/policies/requires.ts is unchanged.
  • The ux: agent-facing path and the sibling understanding-gate denies are out of scope (different surface, and no task-UUID ambiguity there).

Tests / verification

  • New mutation-checked test asserts both the required tag and the namespace clause are present (drop the clause and it goes red).
  • The two exact-string deny tests are updated.
  • tsc clean; full vitest 2468 passed / 1 skipped; integration 1 passed; ug-schema-drift OK.

Review

Independent reviewer subagent: APPROVE (accept_with_notes), no high or critical findings. The one in-scope low finding (missing CHANGELOG entry) is addressed; the wording nit is applied.

Refs: discovery-2026-06-24/ledger-deny-namespace-hint (cdc60d56)

The ledger-gate deny "To satisfy" hint showed the session id value but
did not name which namespace it is. An entry written under the
agent-tasks task UUID never satisfies a harness runtime gate, which keys
off the runtime session id. That ambiguity caused a production failure
(2026-05-17, harness PRs #174/#175: first attempt used the task UUID and
was rejected, second used the session id and passed).

The hint now reads "..., under this runtime session's id `<id>` (not the
agent-tasks task UUID)". Naming an identity is not a producer verb, so it
keeps the deny path neutral on producer choice (agent-tasks/88ca4bb3).

Adds a focused, mutation-checked test asserting both the required tag and
the namespace clause are present; updates the two tests that pinned the
old string; adds a CHANGELOG [Unreleased] entry for the message-format
change.

Refs: discovery-2026-06-24/ledger-deny-namespace-hint (cdc60d56)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@LanNguyenSi LanNguyenSi merged commit 0ff1950 into master Jun 25, 2026
1 check passed
@LanNguyenSi LanNguyenSi deleted the fix/ledger-deny-namespace-hint branch June 25, 2026 10:01
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.

2 participants