Skip to content

fix(cipher): authenticated write-read round-trip probe; cipher-memory-smoke uses it - #3463

Merged
POWERFULMOVES merged 6 commits into
mainfrom
fix/cipher-fleet-wiring-revival
Nov 19, 2026
Merged

POWERFULMOVES merged 6 commits into
mainfrom
fix/cipher-fleet-wiring-revival

Conversation

@POWERFULMOVES

Copy link
Copy Markdown
Owner

Summary

Supersedes the cipher/fleet part of #3078 (chore/cli-prereq-preflight, stale since Sep 21). #3078 is left open.

cipher_preflight checks that the endpoint answers and accepts the bearer. cipher_identity checks which agent_id writes will carry. Neither one stores a record and reads it back. The only write-then-read check, make -C pmoves cipher-memory-smoke, could not pass under token enforcement for two reasons:

  • it sent no Authorization header, so the server returned 401;
  • it wrote as agentId cipher-memory-smoke, which no bearer resolves to, so assertAgentId returned 403.

This PR adds pmoves/tools/cipher_roundtrip_probe.py, which runs these steps:

  1. POST /api/memory
  2. GET /api/memory/{id}: the content must match what was written
  3. GET /api/memory/search, scoped to the agent: the record must come back
  4. DELETE (skipped with --keep)

How it authenticates:

  • The bearer comes from cipher_preflight.layered_environ(), the same environment the session sees. It is looked up by variable name and never passed on argv.
  • The agentId is the one auth.ts accepts for that bearer (cipher_identity.classify_token). A bootstrap token writes as bootstrap. A minted token writes as PMOVES_RESOLVED_IDENTITY; if that is unset the probe exits 3 instead of guessing.
  • Redirects are refused through the preflight's opener.

Exit codes match the preflight: 0 = ok, 1 = findings, 3 = could not measure. cipher-memory-smoke now runs the probe with --require-vector, so it keeps its embedding_id and score checks.

Per source commit (from chore/cli-prereq-preflight)

Commit Verdict Evidence
7b0cf6d4e round-trip probe + authenticated smoke Ported (adapted) The source probe was a one-shot session script: it hardcoded agent crush, a Z890 restore narrative and localhost. Replaced with a general probe built on main's preflight and identity design.
7b0cf6d4e preflight Bearer Already on main pmoves/tools/cipher_preflight.py:353 _resolve_headers reads the roster headers; layered_environ is at :230
7b0cf6d4e qdrant MSYS path fix Already on main pmoves/Makefile:4179, :4212
7b0cf6d4e CIPHER_BIND Already on main compose "${CIPHER_BIND:-127.0.0.1}:..." (docker-compose.yml:4249, docker-compose.agents.yml:977); documented in .claude/context/cipher.md:36. The env-example line belongs to the env-pipeline lane and was not ported.
7b0cf6d4e SKILL.md rewrite Not ported Its fleet narrative is outdated now that main has the per-agent token bind (#3449) and cipher_identity. Better done as a separate docs PR.
fd087cf31 cipher-api Supabase key + Neo4j Already on main docker-compose.agents.yml:942 (CIPHER_DB_SERVICE_KEY lineage), :965-968 NEO4J_URI/USER/PASSWORD; same in docker-compose.yml cipher-api block
fd087cf31 Pmoves-cipher gitlink Dropped main pins its own
6a0eeba2d agent-zero cipher MCP auth Already on main (other form) docker-compose.yml:3725 / docker-compose.agents.yml:142 send Authorization: Bearer ${CIPHER_API_TOKEN} over streamable-http. The source's CIPHER_AGENTZERO_TOKEN variable does not exist anywhere on main.
542270669 TS_4090 Already on main pmoves/scripts/tailscale-node-ips.sh:57 (pmoves-4090), deploy/provision/claude-pmoves.ps1:530
542270669 mcp.json cipher-local note Obsolete / not ported .claude/mcp.json is generated from pmoves/config/mcp_inventory.json. Main's model is that CIPHER_BIND is a per-node operator decision (CLAUDE.md, PATTERNS.md:248). The source's "Z890 publishes since 2026-09-09" depends on the node and is not a roster fact.
0ada1e52c SPARK identity Obsolete (superseded) main binds SPARK via claude_spark / spark-claude (pmoves/configs/node-vocabulary.yaml:74-77, agent_registry.yaml:238, signing card ...0014). spark-kimi covers Crush on SPARK (identity_vocabulary.yaml:256). Minting a new crush_spark card and glyph is Archon's lane.
0ada1e52c .vscode git watcher Not ported, needs operator decision It contradicts main's deliberate "git.autofetch": true from #1540 (.vscode/settings.json:67).
3d1421e10, 849b764d7, 36a9b89d6 gitlink bumps Dropped main pins its own

No protected files were touched, and no road is needed.

Test evidence

  • uv run --with pytest --with pyyaml python -m pytest pmoves/tests/tools/test_cipher_roundtrip_probe.py pmoves/tests/tools/test_cipher_preflight.py pmoves/tests/tools/test_cipher_identity.py -q: 114 passed.

  • The new tests run against an in-process fake cipher that enforces auth.ts/memory-routes rules (401 without a bearer, 403 on an agent mismatch). A guard makes any real-network access fail the test. They never read the real env.shared.

  • Mutation checks: each behaviour was reverted on its own, and the suite failed every time:

    Reverted behaviour Failed
    no bearer 4
    fixed agentId 2
    no read-back check 1
    no search-hit check 1
    no vector gate 1
    no env overlay 1
    unreachable counted as a pass 1
    no cleanup 2
    Makefile recipe reverted to main 1

    The files were restored byte-identical afterwards (checked with cmp).

  • python pmoves/tools/windows_encoding_ratchet.py: exit 0.

  • Not run against the live cipher service, by design.

🤖 Generated with Claude Code

…-smoke uses it

cipher_preflight proves the endpoint answers and accepts the bearer, and
cipher_identity proves which agent_id writes will carry, but nothing
stored a record and read it back. The only write->read check,
cipher-memory-smoke, could not pass under token enforcement: it sent no
Authorization header (401) and wrote as agentId "cipher-memory-smoke",
which no bearer resolves to (403 from assertAgentId).

New pmoves/tools/cipher_roundtrip_probe.py: POST /api/memory, GET
/api/memory/{id} (content must match), GET /api/memory/search scoped to
the agent (must return the record), DELETE (skip with --keep). Bearer is
read from cipher_preflight.layered_environ() by variable name, never
argv; agentId is what auth.ts accepts for that bearer
(cipher_identity.classify_token). Redirects are refused via the
preflight opener. Exit codes match cipher_preflight: 0 ok, 1 findings,
3 could not measure. --require-vector keeps the smoke's embedding_id /
score checks.

Revives the still-missing part of 7b0cf6d from #3078 (its one-shot
cipher_roundtrip_probe.py, generalised to main's preflight/identity
design).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1

  • coderabbit

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added docs Documentation governance AGNOTE register / agent definitions / damage-control hooks labels Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

ORGSIM-MIRROR drift check (advisory, fail-soft)

vv3 / 7 files / VERIFIED 122 / DRIFTED 9 / UNDECIDED 29 / digest 627ef9675679

Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py

POWERFULMOVES and others added 2 commits November 19, 2026 13:45
…ip probe

The vector-path guard read the cipher-memory-smoke recipe text for
embedding_id / "score" / agentId. The recipe now delegates to
tools/cipher_roundtrip_probe.py --require-vector, so the "score" check
moved into the probe and the guard went red (python-tests, the one new
failure vs baseline).

The guard now ignores @# comment lines (prose about a check is not the
check -- the old recipe comments alone satisfied the embedding_id
assertion), and when the recipe invokes the probe it requires
--require-vector and asserts the checks in the probe source. Controls:
main's Makefile passes, this branch passes, this branch with the flag
stripped fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016aNs4pigYBVLWd7VqZNHsQ
@github-actions

Copy link
Copy Markdown
Contributor

ORGSIM-MIRROR drift check (advisory, fail-soft)

vv3 / 8 files / VERIFIED 124 / DRIFTED 10 / UNDECIDED 29 / digest b575a8d4429d

Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py

@POWERFULMOVES
POWERFULMOVES marked this pull request as ready for review November 19, 2026 19:12
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T19:14:15.399086Z f736486 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f73648655c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pmoves/tools/cipher_roundtrip_probe.py Resolved
cipher_preflight.layered_environ() lays env.shared over the process env
(cipher_preflight.py:275-289, env[key] = value for every file key), and
env.shared carries the node bootstrap CIPHER_API_TOKEN. Inside a launched
session that clobbered the per-agent token claude-pmoves.sh deliberately
re-binds AFTER loading env.shared ("CIPHER TOKEN BIND"), so the probe
tested writes as 'bootstrap' instead of the session identity.

_process_session_wins() mirrors the launcher's precedence: a non-empty
bearer already in the process wins, and the identity variables travel
with it; env.shared only fills a gap. Tests use fixture env files only.
Both new tests fail against the previous probe (checked in a throwaway
worktree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016aNs4pigYBVLWd7VqZNHsQ
@github-actions

Copy link
Copy Markdown
Contributor

ORGSIM-MIRROR drift check (advisory, fail-soft)

vv3 / 8 files / VERIFIED 124 / DRIFTED 10 / UNDECIDED 29 / digest 0e0245730567

Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py

@github-actions

Copy link
Copy Markdown
Contributor

ORGSIM-MIRROR drift check (advisory, fail-soft)

vv3 / 8 files / VERIFIED 124 / DRIFTED 10 / UNDECIDED 29 / digest 4d273bf04d21

Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py

@github-actions

Copy link
Copy Markdown
Contributor

ORGSIM-MIRROR drift check (advisory, fail-soft)

vv3 / 8 files / VERIFIED 124 / DRIFTED 10 / UNDECIDED 29 / digest f8e7d26d4d53

Zero-LLM deterministic audit - unreachable = UNDECIDED, never dead - scripts/runbook_drift.py

@POWERFULMOVES
POWERFULMOVES merged commit 13360b4 into main Nov 19, 2026
35 checks passed
@POWERFULMOVES
POWERFULMOVES deleted the fix/cipher-fleet-wiring-revival branch November 19, 2026 22:09
POWERFULMOVES added a commit that referenced this pull request Nov 19, 2026
Re-anchor after three register-row appends on main (#3439, #3463, #3444) left the PR BEHIND; ort auto-merges, no lane file touched.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016aNs4q8tajdg1rcgaacrWS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation governance AGNOTE register / agent definitions / damage-control hooks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant