feat(runtime): unify durable retained interactions - #31
Merged
Conversation
Carry the selected mode and capability-derived interaction map through admission, receipts, retries, and retained turns. Keep provider-boundary tests active until the upstream Runtime and CLI Bridge releases forward the map.
This was referenced Aug 20, 2026
cli-bridge 0.9.4 binds a native retained session to its exact creation request digest. A run-scoped environment idempotency key changed the provider metadata on every turn and broke session continuation after a restart. The key now derives from the provider session id, which matches the Tangle retained path.
The fixture now serves GET /v1/capabilities with the Pi native and generic documents, returns complete exact run coordinates on dispatch, events, status, and cancel, and implements the native retained session protocol (POST /v1/sessions, GET /v1/sessions/:id, POST /v1/sessions/:id/turns). Tests that asserted the 0.7.x chat-only wire shape now assert the session binding, the ownership-key-only provider metadata from runtime 0.142, and the advertised Pi interaction kinds.
The literal 1.0.0 went stale on every interface upgrade. The test now compares the resolved package version with the dependency pin in package.json, which also catches a hoisted or stray installation.
CLI Bridge execution moved to CliBridgeRetainedExecutionPort, so the frozen-profile, cancellation-acknowledgement, portable-model and runner-prefix contracts are now asserted through that port and through resolveProductionCliBridgeConnection. One test also proves the ephemeral resolver refuses a CLI Bridge connection.
Runtime 0.142 writes only the environment ownership key into provider metadata, so a lookup keyed on turn and process identity found nothing after a restart. The lookup now matches the ownership marker and proves run identity from the session's own run control reference. The retained and observed Sandbox client wrappers also forward the backend catalog, which provider 0.13.0 reads to decide which interaction kinds the environment may claim.
Runtime 0.142 fails a sandbox turn inside its executor and reports the provider's own message, which can carry a credential. Both execution ports now redact the terminal reason and error message with the repository's text redactor, so every consumer of the event sees safe text, not only the journal.
…values The Tangle live scope reported LIVE-08 through the matrix adapter, so no built-in check ran, and its proof script imported two helpers the stress module never exported. LIVE-08 now runs the interactive proof directly, and the stress module exports the exact retained-resource observation and cleanup it already implements. A literal secret must now be at least eight characters. A one-character control value such as CLAUDE_CODE_CHILD_SESSION=1 is not a credential, and matching it rewrote release evidence: row LIVE-10 became LIVE-[REDACTED]0. Credential shapes stay redacted at any length.
The report asked whether the provider object carried respondToInteraction, which is false for every published provider because the operation lives on the environment and session. CLI Bridge 0.9.4 and the Tangle provider advertise interactions.responseIdempotency instead, which is the fact the runtime gates on, so both the run path and the connection report now read it through one predicate. The unused provider-method field and the test that reproduced the old duck check are deleted.
Runtime 0.143 and sandbox 0.31 derive one terminal outcome from the published Sandbox contract, so Braid deletes its own event-level parser. A blocked turn now names the exact Braid refusal: this route deletes its environment after the turn, so an interaction cannot be answered. The terminal metadata carries the provider's raw payload, so it takes the same structured redaction as every other provider value Braid keeps. Docs record the shipped cohort and a dated verification observation, and one migration test proves a journal written before the intent phase still restores its retained run.
pnpm licenses list reports the optional binaries installed for the current platform, so a macOS regeneration swaps three entries and the Linux check fails. The checked-in inventory stays the Linux one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Outcome
Braid runs CLI Bridge and Tangle Sandbox turns through one durable retained path. Exact process identity, control claims, restart recovery, detach, reconnect, cancellation, and interaction state survive a Braid restart.
The branch now installs the shipped cohort: interface
1.3.0, runtime0.143.0, eval0.149.0, CLI Bridge adapter0.9.4, Tangle adapter0.13.0, sandbox0.31.0.Architecture
What changed in this pass
GET /v1/capabilities?model=…with the Pi native and generic documents, returns complete exact run coordinates, and implements the native retained session protocol (POST /v1/sessions,GET /v1/sessions/:id,POST /v1/sessions/:id/turns).CLAUDE_CODE_CHILD_SESSION=1is not a credential, and matching it rewrote rowLIVE-10asLIVE-[REDACTED]0.respondToInteraction, which is false for every published provider because the operation lives on the environment and session. Both paths now readinteractions.responseIdempotency, the fact the runtime gates on.Proof
pnpm checkon CI (verify, ubuntu)node scripts/test.mjson CInode scripts/test.mjs(macOS, real TMPDIR)production default state isolates workspaces and config identities across restart— macOS-only: it setsXDG_DATA_HOME, andsrc/bin/state-path.tsuses~/Library/Application Support/braidon darwin. It passes on Linux CI.pnpm test:live:required:selfpnpm test:live:bridge:matrixpnpm check:releasepnpm run typecheckpnpm run lintpnpm run boundariespnpm run dependencies:checkpnpm run licenses:checkBefore this pass the suite failed 36 tests and the release self-check failed 2. CI run: https://github.com/tangle-network/braid/actions/runs/32449537251
Simplification
Simplification: deleted
src/adapters/runtime/sandbox-result-projection.ts(the second Sandbox event parser) now that runtime 0.143 publishes one terminal outcome; collapsed the interaction-response rule into one predicate used by both the run path and the connection report, and deleted the deadConnectionProviderMethods.respondToInteractionfield; collapsed three copies of the secret-collection filter into oneliteralSecretsrule.Net: +1,348 / −869 lines across 122 files (this pass), 3 duplicated paths removed, 1 module deleted.
Tests: +2 (a migration test proving a pre-
intentjournal still restores its retained run; a capability-document test pinning the CLI Bridge 0.9.4 route contract), −1 deleted (the duck-check reproduction the new gate makes meaningless).Not done here: recording a fresh product GIF needs a packed 0.2.0 binary, a ready Pi backend, and paid model calls.
Live rows
LIVE-03andLIVE-08were attempted through their built-in checks. Both reportunavailable: this environment holds no CLI Bridge interaction credential and no Tangle Sandbox credential, and a built-in check refuses to claim a row it cannot execute.LIVE-06,LIVE-07,LIVE-09, andLIVE-10are unavailable for the same reason. No live claim here comes from a simulated provider.docs/08-verification.mdcarries the dated record.Visual evidence
artifacts/demo/braid-live.gifis historical Braid0.1.3evidence from Local CLI Bridge and Claude Codeopus. It is not a recording of this branch's native interactive flow, and README says so. The deterministic W6 state captures at 40×12, 80×24, 120×40, and 200×60 are the checked-in rendering evidence for this branch.Known platform quirk
pnpm licenses list --prodreports the optional binaries installed for the current platform, so regeneratingTHIRD_PARTY_LICENSES.jsonon macOS swaps three entries (@dataiku/uv,@koromix/koffi,@napi-rs/keyring) and fails the Linux check. The checked-in inventory stays the Linux one. Making the inventory platform-independent is its own change and is not smuggled in here.