Skip to content

fix(tmp): partition context cache by request - #7397

Merged
bokelley merged 3 commits into
mainfrom
fix/tmp-context-cache-key
Sep 13, 2026
Merged

bokelley merged 3 commits into
mainfrom
fix/tmp-context-cache-key

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

  • replace the placement-only Context Match cache key with {provider_id, context_hash}
  • define context_hash as SHA-256 over RFC 8785 JCS of the complete provider-forwarded request, excluding only $schema and request_id
  • preserve array order and prohibit extra normalization that could collapse distinct requests
  • require routers to replace cached correlation IDs with the current request_id
  • document cache-data privacy and add regression coverage

Closes #7395.

Validation

  • npm run test:schemas
  • npm run test:examples
  • npm run test:docs-nav
  • npm run test:owned-links
  • node --test tests/trusted-match-offer-creative-data.test.cjs
  • npm run typecheck

The pre-commit unit phases passed. The full server-unit phase was not repeated to completion because the same three unrelated server/tests/unit/addie-router.test.ts baseline failures reproduced while preparing #7396; this PR does not change server implementation or Addie/router code.

@bokelley bokelley added signals Issue concerns the signals protocol domain sponsored-intelligence Issue concerns the sponsored-intelligence protocol domain needs-wg-review Blocked on a working-group decision — surface in WG meeting agendas labels Sep 10, 2026 — with conductor.build App

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — docs-only Trusted Match fix, no blocking or medium findings.

This PR updates the Context Match cache key from placement-only to {provider_id, context_hash} (RFC 8785 JCS → SHA-256 over the forwarded request), closing a real cross-session cache-leak. Reviewer verified schema↔docs coherence (all enumerated request members exist; request_id/cache_ttl present in response schemas), correct per-call request_id rewrite on cache hit, and consistency with the existing Identity Match dedup-cache pattern. No changeset required (path outside declared published surface), no oneOf/dist/V1 issues, no governance-precedent conflict.

Decision-table walk: no critical/high findings (row 1 n/a); gated_paths=false (row 2 n/a); high_risk=false, no deletions (rows 3,5 n/a); no medium findings (rows 4,8 n/a); no prior escalation (row 6 n/a); no no-auto-approve team match (row 7 n/a). Falls through to row 9 → approve. review_decision is REVIEW_REQUIRED, but with gated_paths=false that does not block. The change is editorial/clarifying to docs, not a breaking-class protocol change, so the breaking-change hard gate does not apply.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean docs-only spec fix (#7395) with no blocking findings.

What I checked:

  • Cache-key change: replaces the placement-only Context Match cache key with {provider_id, context_hash}, with context_hash defined as SHA-256 over RFC 8785 JCS of the forwarded request (excluding only $schema and request_id), and the request_id swap mandated on cache hit.
  • Schema↔docs coherence: all cited fields exist in context-match-request.json; request_id is required in the response schema. No stale placement-only key remains.
  • The experimental x-status downgrades classification, and no changeset is owed on docs/trusted-match/**.

Gate checks:

  • No no-auto-approve team match.
  • gated_paths: false — row 2 does not apply despite review_decision: REVIEW_REQUIRED.
  • high_risk: false; no deletions or modifications to sensitive files.
  • No critical/high/medium findings; nothing normative or breaking-class here (docs-only clarification, no schema source edits).

No findings triggered rows 1–8; falls through to row 9.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — docs-only Context Match caching fix under docs/trusted-match/**.

Checked:

  • No schema files (static/schemas/source/**) touched — schema↔docs coherence not implicated; context_hash is router-internal, not a wire field.
  • No changeset required: docs/trusted-match/** is out of published protocol scope.
  • The three doc pages are mutually consistent and every test assertion matches live doc text.
  • The fix replaces an unsafe placement-only cache key with {provider_id, context_hash} (SHA-256 over RFC 8785 JCS of the forwarded request minus $schema/request_id) and requires replacing cached correlation IDs on hit — closing a real cross-session response leak. Regression coverage added.

No Critical/High/Medium findings. No high-risk paths, no gated paths, no author-team gate. gated_paths is false, so the REVIEW_REQUIRED status does not force escalation. Falls through to row 9.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Sep 10, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — docs-only TMP security fix (#7397).

This PR partitions the Context Match response cache by {provider_id, context_hash} instead of the placement-only key, closing a cross-session response leak. Verified:

  • Field names match context-match-request.json
  • request_id is the sole per-call response field, so the cache-hit rewrite is complete
  • JCS+SHA-256 cache-key construction mirrors the existing Identity Match pattern
  • No changeset required — docs/trusted-match/** is out of protocol scope (published surface is static/schemas/source/, docs/reference/, etc.)
  • Added test assertions match the shipped doc text

No blocking or Medium findings. high_risk is false, gated_paths is false, no no-auto-approve team match, and no prior decision. Rows 1–8 do not fire, so this falls through to row 9.

Note: review_decision is REVIEW_REQUIRED, but since gated_paths is false, the row-2 hard gate does not apply.

@EvgenyAndroid EvgenyAndroid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed. The key change is right: geo alone makes a placement-only key collide across sessions, and hashing the whole forwarded request with RFC 8785 JCS is the pattern the Identity Match dedup cache in the same section already uses. Three notes:

  1. With geo in the preimage, a geo-varying placement misses the cache on every distinct geo value; under the 5-minute default that is close to no caching. That is the safe direction, but the section should say it. The triage note that cache_ttl: 0 fits viewer-variable placements and the 5-minute default is sized for context-invariant ones did not make it into the text; the only cache_ttl: 0 guidance in the section today is for provider config propagation.

  2. The sharding note from triage (routers MAY prefix context_hash with property_rid for storage sharding without changing the partition) also did not land. One line, so nobody folds property_rid back into the key by hand.

  3. Same branch question as #7396: base is main; the triage said 3.1.x first, forward-merge to main.

Approving; nothing here changes the wire.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Sep 11, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean delta pass with no findings.

This PR adds a single clarifying paragraph in docs/trusted-match/specification.mdx (property_rid sharding-prefix guidance), a related doc touch in the trusted-match docs set, and two matching test assertions. The reviewer confirmed all terms are coherent with established definitions, the sharding prefix does not weaken the {provider_id, context_hash} partitioning, tests match the prose, and there is no schema/wire change and no changeset obligation.

Gate checks:

  • No no-auto-approve team match.
  • gated_paths: false — row 2 does not apply despite review_decision REVIEW_REQUIRED (the deterministic path gate is not triggered).
  • high_risk: false — no deleted/modified sensitive-file triggers.
  • No critical/high/medium findings.
  • The docs touched are under docs/trusted-match/**, not docs/reference/** or static/schemas/source/**, so schema↔docs coherence and changeset obligations are not engaged. No breaking-class protocol change.

Prior decision was also approve with no findings; this delta remains clean. Rows 1–8 do not fire; falls through to row 9 → approve.

bokelley commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks — addressed both operational notes in 64c3a4d: the caching section now says viewer-variable geo/session context can drive a low hit rate and makes cache_ttl: 0 appropriate, and it permits a property_rid storage-sharding prefix without weakening {provider_id, context_hash}.

For the branch question, #7425 is now open directly against 3.1.x; this PR remains the main / 3.2 forward port.

Copy link
Copy Markdown
Contributor Author

Independent security and protocol review found one additional observability hardening gap, fixed in 1b0158f: deterministic context_hash values and retained preimages must not appear in logs, metric labels, or traces, and receive the same access and retention controls as Context Match request data.

The cache identity, JCS canonicalization, current-request request_id rewrite, sharding guidance, and cache_ttl: 0 guidance otherwise reviewed cleanly. A regression assertion covers the new rule.

@bokelley
bokelley removed the request for review from EvgenyAndroid September 11, 2026 12:11
aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Sep 11, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean, additive privacy-tightening delta.

This subsequent pass extends the cache-privacy MUST NOT in docs/trusted-match/specification.mdx to cover context_hash and any retained hash preimage in logs/metrics/traces, with a matching verbatim regression assertion in tests/trusted-match-offer-creative-data.test.cjs. The change is fail-closed and additive: no schema/wire change, no static/schemas/source/** edits (so no schema↔docs coherence concern), no oneOf discriminator impact, and no released-artifact mutation. Docs touched are under docs/trusted-match/**, outside docs/reference/**, so no changeset is required.

No Critical/High/Medium findings. Prior decision was approve with no findings; no prior blockers to re-surface.

Gate checks: gated_paths is false; high_risk is false; no no-auto-approve team match. Although review_decision is REVIEW_REQUIRED, row 2 only fires when gated_paths is true — it is not — so this falls through to row 9 (approve). No breaking-class protocol change is present.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — docs-only trusted-match spec clarification with a supporting regression test.

Checked:

  • No static/schemas/source/** changes — no schema↔docs coherence risk and no oneOf discriminator concern.
  • Diff touches only docs/trusted-match/** and a test file; reviewer confirmed the changeset-protocol-scope gate does not fire for these paths, so no changeset is required.
  • The clarification repartitions the Context Match cache key by {provider_id, context_hash} to close a cross-session cache-leak; reviewer verified hash-input completeness (only request_id/$schema excluded, no volatile per-call fields dropped/retained) and cross-doc consistency across specification/router-architecture/data-protection plus test↔docs coherence.
  • Not a breaking-class wire change; no governance-precedent contradiction identified.

Gates: gated_paths=false; high_risk=false; no no-auto-approve team match. review_decision is REVIEW_REQUIRED, but with no gated paths that does not force escalation. No Critical/High/Medium findings.

Prior decision was also approve with no findings — this run confirms the clean pass. Rows 1–8 do not fire; falls through to row 9.

@bokelley
bokelley merged commit a6e4bfd into main Sep 13, 2026
35 checks passed
@bokelley
bokelley deleted the fix/tmp-context-cache-key branch September 13, 2026 11:52
bokelley added a commit that referenced this pull request Sep 13, 2026
…rtition

The {provider_id, context_hash} partitioning shipped in v3.1.22 via #7397
without a changeset on main (3.2.0-rc.1 had already been cut when #7397
merged). This adds the release record so the 3.2 changelog captures the
prerequisite step that cache_namespace enforcement builds on. Companion
to the .changeset/correct-v3-1-22-context-cache-release-record.md added
on 3.1.x by #7451.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XXFNKsdZRbx3qxQgSD1vJK
@aao-release-bot aao-release-bot Bot mentioned this pull request Sep 13, 2026
bokelley added a commit that referenced this pull request Nov 11, 2026
…rtition

The {provider_id, context_hash} partitioning shipped in v3.1.22 via #7397
without a changeset on main (3.2.0-rc.1 had already been cut when #7397
merged). This adds the release record so the 3.2 changelog captures the
prerequisite step that cache_namespace enforcement builds on. Companion
to the .changeset/correct-v3-1-22-context-cache-release-record.md added
on 3.1.x by #7451.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XXFNKsdZRbx3qxQgSD1vJK
bokelley added a commit that referenced this pull request Nov 12, 2026
* fix(tmp): isolate context caches by evaluation namespace

* docs(tmp): notice breaking cache migration

* chore(changeset): record v3.1.22 request-aware Context Match cache partition

The {provider_id, context_hash} partitioning shipped in v3.1.22 via #7397
without a changeset on main (3.2.0-rc.1 had already been cut when #7397
merged). This adds the release record so the 3.2 changelog captures the
prerequisite step that cache_namespace enforcement builds on. Companion
to the .changeset/correct-v3-1-22-context-cache-release-record.md added
on 3.1.x by #7451.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XXFNKsdZRbx3qxQgSD1vJK

* docs(release): align TMP notice with RC.2

* fix(tmp): refresh evaluation-namespace isolation for 3.3

Integrate the once-pinned main df2446f. Focused/feature checks and typecheck pass. Broad local hooks were blocked by overloaded-host startup and worker timeouts. The named isolated replays still hit the unchanged hosted-compliance-echoed-release beforeAll timeout and governance-agent-credentials import/setup timeout. Per the release coordinator, record with --no-verify and publish for exact-head GitHub CI; do not change budgets or merge automatically.

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-wg-review Blocked on a working-group decision — surface in WG meeting agendas signals Issue concerns the signals protocol domain sponsored-intelligence Issue concerns the sponsored-intelligence protocol domain

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trusted-match: Context Match response cache key must vary with request context

2 participants