Skip to content

Isolate Continuum prompt caches per user - #922

Merged
AnthonyRonning merged 2 commits into
masterfrom
codex-cache-salts-maple
Sep 14, 2026
Merged

AnthonyRonning merged 2 commits into
masterfrom
codex-cache-salts-maple

Conversation

@AnthonyRonning

Copy link
Copy Markdown
Contributor

Summary

Isolate Privatemode/Continuum prompt-prefix caches by authenticated OpenSecret user instead of falling back to a proxy-wide shared salt.

  • Derive separate Tinfoil and Continuum V2 namespaces from the existing encrypted client cache root and verified user UUID. Preserve the exact Tinfoil derivation and user_cache_secret contract; send Continuum's distinct 64-character hexadecimal namespace as cache_salt.
  • For V1 Continuum requests, derive user-bound salts from a cryptographically random 32-byte process-local secret. This enables same-user reuse within a backend process without using a publicly computable UUID hash, adding a database migration, or configuring another secret.
  • Apply the same backend-owned policy to ordinary chat, Responses model/tool turns, and server-selected image descriptions. Remove the separate per-description random-salt override. Continue stripping caller-supplied cache fields and never forward another provider's namespace.
  • Remove --sharedPromptCache from Nitro and local macOS launchers. Explicit request salts still enable reuse; an omitted salt now gets Privatemode's isolated per-request default.
  • Add namespace vectors, user/root/provider separation and request-rewrite tests, a Nix check against shared-cache launcher defaults, and V1/V2 lifecycle documentation.

Compatibility and scope

  • No client wire-format changes, dependency/submodule updates, migrations, new configured secrets, or changes to Tinfoil V1 behavior.
  • V2 reuse requires the same client root and verified user. Separate client roots intentionally create separate namespaces.
  • V1 Continuum namespaces rotate on backend restart and differ across replicas. This trades cross-process cache reuse for secret user isolation.
  • This partitions KV-prefix caching, not whole responses; it does not guarantee cache retention.
  • No deployment, EIF/PCR approval changes, signing, or live provider calls.

Validation

On macOS/aarch64, using the pinned component Nix shell with stateful PostgreSQL, environment, and container hooks disabled:

  • cargo fmt --all -- --check
  • RUSTFLAGS='-D warnings' cargo clippy --locked --all-targets --all-features -- -D warnings
  • RUSTFLAGS='-D warnings' cargo test --locked --all-features: 640 passed, 23 ignored
  • Final focused cargo test --locked --all-features cache: 61 passed
  • nix flake show --all-systems --no-update-lock-file '.?submodules=1'
  • nix flake check --no-update-lock-file --print-build-logs '.?submodules=1': current-host checks passed, including the new launcher-policy check
  • nix build --no-link --no-update-lock-file '.?submodules=1#default': passed, including 640 passed, 23 ignored package tests
  • Pinned Privatemode 4b72dcbb / v1.47.0: go test -mod=readonly -tags contrast_unstable_api ./privatemode-proxy/internal/server -run '^TestChatCompletionsPromptEncryption$' -count=1 passed against synthetic local HTTP fixtures
  • bash -n entrypoint.sh, Just recipe parsing, and git diff --check
  • Repository pre-commit hook: frontend formatting/build and 818 passing tests

The ignored database/live-provider tests were not run. Live cache-hit behavior, encrypted full-stack application smoke, Linux/Nitro artifacts, and deployed proxy-binary/source correspondence remain unverified. AI assistance was used for implementation and validation.

Derive provider-separated V2 namespaces from the encrypted client cache root
and bind legacy Continuum namespaces to verified users with a process-local
random secret. Apply the same cache policy to ordinary and internal model
turns, remove proxy-wide cache defaults, and cover isolation and compatibility
with regression tests and a Nix launcher-policy check.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Document pseudonymous correlation through the Privatemode shard header and
clarify that the proxy falls back to per-request salts when no user salt is
supplied. Keep cache derivation and runtime policy unchanged.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@AnthonyRonning
AnthonyRonning marked this pull request as ready for review September 14, 2026 23:17
@AnthonyRonning
AnthonyRonning merged commit ec2f83b into master Sep 14, 2026
20 checks passed
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