Skip to content

Real NATS JetStream durable spine + rivet baseline release handling#11

Open
avrabe wants to merge 3 commits into
mainfrom
rivet-baseline-release-handling
Open

Real NATS JetStream durable spine + rivet baseline release handling#11
avrabe wants to merge 3 commits into
mainfrom
rivet-baseline-release-handling

Conversation

@avrabe

@avrabe avrabe commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Two post-merge follow-ups, headlined by the core functionality: agora's durable spine is now real.

1. Real NATS JetStream durable spine (the main functionality)

The host no longer fakes the bus with a Vec — it runs on a real JetStream stream (AGORA, subjects agora.>):

  • Global ordering from the stream sequence (verified run: 8 messages, last seq 8).
  • Capability scoping is structural at the transport — each agent gets a durable pull consumer filtered to the subjects of its granted channels only; the ungranted secret-ops message is in the log but no consumer subscribes to it → never delivered (stronger than a runtime check).
  • Dedup + replayNats-Msg-Id idempotent publish + durable consumers (late-join replay) → REQ-AGORA-009 now implemented.
  • The in-memory run_simulation is retained #[cfg(test)] as the unit-tested reference oracle; cargo test still asserts the controls.

Run: nats-server -js & cd host && cargo run --release.

2. rivet baseline release handling

rivet's release-scope primitive is the schema-declared baseline: field + a baselines: block — release: is still REQ-214 (draft), which emitted "field not defined" INFO on every artifact. Switched to baseline:; INFO diagnostics 21 → 0, validate PASS, release scopes queryable ((= baseline "v0.1.0")).

Verification

  • cargo build --release clean (0 warnings) · cargo test 1 passed (reference oracle)
  • End-to-end over real nats-server -js: 8 msgs / last seq 8, converged, 6 facts, secret-ops in-log=true & undelivered
  • bazel build //agent:agent still green · rivet validate PASS (0 warnings)

🤖 Generated with Claude Code

avrabe and others added 3 commits June 27, 2026 11:43
…d release field

rivet's release-scope primitive is the schema-declared `baseline:` field plus a
`baselines:` block in rivet.yaml — `release:` is still REQ-214 (draft), which is
why it emitted "field not defined in schema" INFO on every artifact. Switch all
artifacts release: -> baseline: and declare v0.1.0/v0.2.0/v0.3.0 baselines.

Tested: `rivet list --filter '(= baseline "vX.Y")'` scopes each release;
v0.1.0 readiness = 7 verified / 3 implemented (REQ-002/006 sigil-blocked).
INFO diagnostics 21 -> 0; validate PASS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KutNHFvNmKa3nKydP6aoK2
…mory Vec)

Replace the faked in-memory bus with a real JetStream stream (`AGORA`, subjects
`agora.>`) — the substrate's core functionality, no longer stubbed:

- Global ordering from the stream sequence; durable pull consumers per agent.
- Capability channel-scoping is now STRUCTURAL at the subject filter: an agent's
  consumer is created only for the subjects of its granted channels, so the
  ungranted `secret-ops` message sits in the log but no consumer subscribes to it
  → never delivered (stronger than a runtime check). REQ-AGORA-003.
- Nats-Msg-Id dedup (idempotent publish) + durable-consumer replay — REQ-AGORA-009
  (global ordering / late-join replay), now implemented.

The in-memory `run_simulation` is retained, #[cfg(test)]-gated, as the unit-tested
reference oracle; `cargo test` still asserts the controls against it.

Run: `nats-server -js & cd host && cargo run --release`. Verified end-to-end:
8 messages in the stream (last seq 8), cascade converges at the hop limit, 6
signed facts, secret-ops in-log=true but undelivered.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KutNHFvNmKa3nKydP6aoK2
…ject injection

Address the push security-review findings (all map to agora's own STPA-Sec
hazards — the analysis was real):

1. Sender spoofing (SEC-HAZ-4) — the host now stamps `sender = me` on every emitted
   message instead of trusting the agent's self-reported `sender`, so an agent
   cannot publish under another persona. (Cross-publisher trust still needs the
   signed sigil identity, REQ-006 / sigil#164.)
2. YAML injection into the durable record (SEC-LOSS-3) — fact string fields are now
   JSON-encoded (a JSON string literal is a valid YAML scalar), so a payload with
   quotes/newlines/`- id:` can no longer inject forged artifacts. Verified: the
   facts file parses as valid YAML; round-trips losslessly.
3. Subject injection / emit-side capability bypass (SEC-HAZ-1) — an agent-supplied
   channel is validated (`is_safe_channel`: single `[A-Za-z0-9_-]` token) AND
   checked against the agent's granted channels before publish, so it cannot reach
   `secret-ops` or inject extra subject levels/wildcards. Capability scoping is now
   structural on BOTH consume and emit sides.

Adds unit tests: channel_validator_rejects_subject_injection,
fact_payload_cannot_inject_yaml. `cargo test` 3 passed; NATS run unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KutNHFvNmKa3nKydP6aoK2
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