Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .agent/autopsies/2026-08-12-tangle-retained-canary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Tangle cloud canary autopsy

## Run

The production checks used Braid commit `8f066cc` plus the retained-session worktree.
They used OpenCode, `tangle-router/glm-5.2`, Runtime through `0.132.12`, and Sandbox SDK `0.21.1`.
The checks used fresh bounded credentials that were revoked after each check.

## Verified findings

- The post-hardening retained canary failed before allocation in 4.695 seconds.
- The published provider lacks exact lookup after an unacknowledged dispatch.
- Active Sandboxes stayed at four.
- Total Sandboxes stayed at 9,241.
- Compute, GPU, and cost counters had zero measured change.
- The exact Braid owner-tag query matched zero resources.
- An earlier retained diagnostic reached an older sidecar and was rejected for its `runControlRef` field.
- That earlier attempt moved total Sandboxes from 9,239 to 9,240 but returned active count to four.
- A later ephemeral Braid canary timed out after 182.581 seconds with no environment identifier.
- The Braid run remained `streaming` after Runtime emitted only `backend_start`.
- A direct SDK create with the same route failed in 2.177 seconds.
- The outer response was HTTP 400 with `CONFIG_ERROR`.
- The nested response was HTTP 403 with `Service "sandbox" is not authorized for this endpoint`.
- The same key authenticated Sandbox usage and Router model discovery.
- Direct SDK account counts stayed at four active and 9,241 total Sandboxes.
- Runtime `0.132.12` still treats the permanent error as retryable because its message contains `provision failed`.
- Sandbox npm `latest` points at `0.21.0`, but Runtime `0.132.12` requires Sandbox `>=0.21.1 <0.22.0`.

## Classification

Retained mode is safely unavailable because the provider does not supply exact recovery lookup.
Ephemeral cloud creation is currently blocked by internal platform authorization.
Runtime then hides that terminal failure behind an excessive retry.
The npm tag can also install an incompatible SDK version.
These are three independent upstream failures.
Braid created no resource during either post-hardening canary.

## Action

Issue `tangle-network/agent-dev-container#5249` tracks the earlier missing-turn response mismatch.
Issue `tangle-network/agent-dev-container#5251` tracks the retained sidecar rollout.
Issue `tangle-network/agent-dev-container#5277` tracks the current platform authorization failure.
Issue `tangle-network/agent-dev-container#5278` tracks the incorrect npm tag.
Issue `tangle-network/agent-runtime#808` tracks permanent-error retry classification.
Braid keeps retained mode fail-closed and defaults new Sandbox connections to ephemeral mode.
The production canary must pass before the bounded durability cohort starts.

## Artifacts

- `artifacts/verification/live/tangle-sandbox-braid-retained-canary-production-20260812.json`
- `artifacts/verification/live/tangle-sandbox-braid-retained-safe-preflight-production-20260812.json`
- `artifacts/verification/live/tangle-sandbox-braid-retained-post-hardening-production-20260812.json`
- `artifacts/verification/live/tangle-sandbox-braid-execution-canary-post-hardening-production-20260812.json`
7 changes: 7 additions & 0 deletions .agent/critical-audit/2026-08-12T17-22-32Z/findings.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{"id":1,"severity":"HIGH","file":"scripts/live-required/tangle-sandbox-braid-stress.mjs","line":594,"defect":"Public cloud proof serialized raw customer and billing-owner identifiers.","scenario":"An authenticated live proof writes its account observation, then a committed public artifact discloses two real account identifiers.","status":"measured · resolved","evidence":"scripts/live-required/tangle-sandbox-braid-stress.mjs:588-594; actual artifact scan → 5/5 JSON files contain zero customerId or billingOwnerId keys","fix":"Compare raw identity only in memory and emit one SHA-256 identity digest.","verification":"public artifact credential-pattern scan → 5/5 pass; raw-account-key scan → 5/5 pass; pnpm check → 681 pass, 2 skip, 0 fail","costIfShipped":"2 account identifiers disclosed per published proof artifact","savedIfFixed":"2 of 2 account identifiers removed per artifact"}
{"id":2,"severity":"HIGH","file":"src/adapters/runtime/retained-execution.ts","line":75,"defect":"Detach during an unresolved cloud start reopened the event reader after start completed.","scenario":"A user detaches while start is pending, the provider returns a handle, then Braid reads a run the user already detached and can duplicate reconnect delivery.","status":"measured · resolved","evidence":"src/adapters/runtime/retained-execution.ts:66-76; test/retained-execution-lifecycle.test.ts:206-245","fix":"Persist detached state before aborting and stop streamTurn after the start promise resolves.","verification":"pnpm check → in-flight detach test passed; 681 pass, 2 skip, 0 fail","costIfShipped":"1 unintended reader per in-flight detached run","savedIfFixed":"1 of 1 unintended reader prevented per run"}
{"id":3,"severity":"MEDIUM","file":"src/adapters/runtime/tangle-sandbox-retention.ts","line":53,"defect":"The retained client wrapper dropped identity, usage, and subscription methods.","scenario":"A retained connection wraps a Sandbox client, then Braid cannot observe account identity or spend and reports three available provider surfaces as unknown.","status":"measured · resolved","evidence":"src/adapters/runtime/tangle-sandbox-retention.ts:53-55,89-91; test/tangle-retained-lifecycle.test.ts:142-173","fix":"Bind and preserve every optional account observation method on the wrapper.","verification":"pnpm check → retained account-observation test passed; 681 pass, 2 skip, 0 fail","costIfShipped":"3 account observation methods lost per wrapped client","savedIfFixed":"3 of 3 methods preserved per client"}
{"id":4,"severity":"MEDIUM","file":"scripts/live-required/tangle-sandbox-braid-stress.mjs","line":926,"defect":"A lost shutdown acknowledgement skipped process-tree cleanup proof.","scenario":"Shutdown RPC fails after delivery, then the stress runner throws before checking child exit and cannot prove that descendants stopped.","status":"measured · resolved","evidence":"scripts/live-required/tangle-sandbox-braid-stress.mjs:926-947; test/tangle-sandbox-braid-stress-runtime.test.mjs:123-157","fix":"Always close and verify the process tree, then attach that proof to the original shutdown error.","verification":"pnpm check → shutdown-failure cleanup test passed; live-required self-test 26/26 passed","costIfShipped":"1 process tree unverified per shutdown acknowledgement failure","savedIfFixed":"1 of 1 process tree verified per failure"}
{"id":5,"severity":"MEDIUM","file":"src/app/run-replay.ts","line":53,"defect":"Recovery replaced a typed dispatch failure when exact provider status was unavailable.","scenario":"Cloud provisioning returns CLOUD_PROVISION_REJECTED and status lookup is absent, then Braid shows a generic unknown-state message instead of the safe typed cause.","status":"measured · resolved","evidence":"src/app/run-replay.ts:53-55,76-82,104-110; test/w8-runs.test.ts:251-270","fix":"Carry the sanitized prior failure through reconnect and null-status reconciliation.","verification":"pnpm check → typed diagnostic test passed; 681 pass, 2 skip, 0 fail","costIfShipped":"1 actionable diagnostic lost per affected failed dispatch","savedIfFixed":"1 of 1 diagnostic retained per affected dispatch"}
{"id":6,"severity":"MEDIUM","file":"src/domain/invariants-profile.ts","line":140,"defect":"Non-Sandbox connections accepted Sandbox lifecycle fields.","scenario":"A CLI Bridge connection includes retained lifecycle and idle TTL, then validation accepts provider options that its adapter cannot implement.","status":"measured · resolved","evidence":"src/domain/invariants-profile.ts:140-145; test/domain-invariants.test.ts:199-206","fix":"Reject lifecycle and idle TTL unless the connection kind is tangle-sandbox.","verification":"pnpm check → domain invariant test passed; 681 pass, 2 skip, 0 fail","costIfShipped":"2 unsupported fields accepted per malformed connection","savedIfFixed":"2 of 2 unsupported fields rejected per connection"}
{"id":7,"severity":"LOW","file":"docs/05-profiles-and-connections.md","line":275,"defect":"Documentation claimed an operator-selectable retained control that the connection editor does not expose.","scenario":"A terminal user follows the setup documentation, then no retained lifecycle control exists in the five-field editor.","status":"measured · resolved","evidence":"src/views/tui/connection-metadata-editor-model.ts:15-21; docs/05-profiles-and-connections.md:273-277","fix":"Describe retained lifecycle as a connection configuration option until the provider path and editor control are available.","verification":"rg connection editor fields → kind, name, endpoint, region, account only; pnpm format:check passed","costIfShipped":"1 unavailable UI action claimed per reader path","savedIfFixed":"1 of 1 unavailable action claims removed"}
26 changes: 26 additions & 0 deletions .agent/critical-audit/2026-08-12T17-22-32Z/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"schemaVersion": 1,
"scope": "Braid retained Tangle Sandbox lifecycle, stress proof, and public evidence",
"files": 65,
"base": "8f066cc20c750579015bf47589d3d742d6bb0bc5",
"head": "8f066cc20c750579015bf47589d3d742d6bb0bc5",
"workingTree": true,
"diffSha256": "2389bc43d72a13cf9bbd348d57d8f7a9955b2673d844a3953d5856f3c4c9b067",
"projectType": "Node.js ESM package",
"reviewers": [
"A: retained lifecycle correctness, identity, cleanup, credentials, and races",
"B: runtime boundaries, module ownership, replay, and failure handling",
"C: callsites, documentation accuracy, dependency hygiene, and real-system proof"
],
"mode": "current working-tree review with serial local checks",
"verdict": "APPROVE",
"counts": {
"critical": 0,
"high": 2,
"medium": 4,
"low": 1,
"resolved": 7,
"unresolved": 0,
"dropped": 0
}
}
41 changes: 41 additions & 0 deletions .agent/critical-audit/2026-08-12T17-22-32Z/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Audit: Braid retained Tangle Sandbox lifecycle and proof — 8f066cc20c750579015bf47589d3d742d6bb0bc5..8f066cc20c750579015bf47589d3d742d6bb0bc5 — n=65 files, 7 findings

**Verdict:** APPROVE — 7 of 7 measured defects resolved · 0 CRITICAL / 2 HIGH / 4 MEDIUM / 1 LOW
**Worst:** #1 `scripts/live-required/tangle-sandbox-braid-stress.mjs:594` — public proof disclosed two account identifiers · cost if shipped 2 identifiers per artifact
**Next:** `/verify`

## Scope

| Field | Value |
|---|---|
| Files | n=65 via current working-tree diff |
| Base..head | `8f066cc20c750579015bf47589d3d742d6bb0bc5..8f066cc20c750579015bf47589d3d742d6bb0bc5` |
| Project type | Node.js ESM package |
| Reviewers | A,B,C · serial |
| Not inspected | Provider implementation outside Braid; live retained execution remains blocked by tracked upstream issues. |

## Findings — 7 of 7, ranked

| # | Sev | file:line | Defect | Failure scenario (input/state → wrong result) | Status | Evidence | Fix | Verification | Cost if shipped | Saved if fixed |
|---:|---|---|---|---|---|---|---|---|---:|---:|
| 1 | HIGH | `scripts/live-required/tangle-sandbox-braid-stress.mjs:594` | Public proof emitted raw account identity. | Authenticated proof → two identifiers published. | measured · resolved | actual artifacts: 5/5 have zero raw identity keys | Emit one digest. | public scans 5/5 pass | 2 identifiers/artifact | 2/2 removed |
| 2 | HIGH | `src/adapters/runtime/retained-execution.ts:75` | Pending detach reopened the event reader. | Detach before start resolves → detached run streams locally. | measured · resolved | `test/retained-execution-lifecycle.test.ts:206` | Stop after start when detached. | `pnpm check` test passed | 1 reader/run | 1/1 prevented |
| 3 | MEDIUM | `src/adapters/runtime/tangle-sandbox-retention.ts:53` | Wrapper dropped account methods. | Wrap client → identity, usage, and subscription become unknown. | measured · resolved | `test/tangle-retained-lifecycle.test.ts:142` | Preserve bound methods. | `pnpm check` test passed | 3 methods/client | 3/3 preserved |
| 4 | MEDIUM | `scripts/live-required/tangle-sandbox-braid-stress.mjs:926` | Shutdown error hid cleanup proof. | Lost acknowledgement → descendants remain unverified. | measured · resolved | `test/tangle-sandbox-braid-stress-runtime.test.mjs:123` | Verify close before rethrow. | live-required 26/26 | 1 tree/failure | 1/1 verified |
| 5 | MEDIUM | `src/app/run-replay.ts:53` | Recovery dropped the typed cause. | Failed dispatch plus no status → generic error. | measured · resolved | `test/w8-runs.test.ts:251` | Carry safe prior detail. | `pnpm check` test passed | 1 diagnostic/run | 1/1 retained |
| 6 | MEDIUM | `src/domain/invariants-profile.ts:140` | Other connections accepted Sandbox lifecycle fields. | CLI Bridge plus retained TTL → invalid configuration accepted. | measured · resolved | `test/domain-invariants.test.ts:199` | Restrict fields by kind. | `pnpm check` test passed | 2 fields/config | 2/2 rejected |
| 7 | LOW | `docs/05-profiles-and-connections.md:275` | Docs claimed a missing editor action. | User follows setup text → no retained control exists. | measured · resolved | `src/views/tui/connection-metadata-editor-model.ts:15` | State configuration boundary. | editor field inspection | 1 claim/reader | 1/1 removed |

0 dropped (no reproducible failure scenario / no actionable fix).

## Assumptions & unverified

| Assumption | Finding it would flip | Check that settles it |
|---|---|---|
| The provider will add exact retained-run lookup without changing the six-field control reference. | The current adapter contract could require a new shared field. | Resolve upstream runtime issue 800 and provider issue 146, then rerun the retained stress command. |
| The current Sandbox authorization regression is external to Braid. | A Braid credential-routing defect could be present. | Resolve ADC issue 5277, then rerun both direct SDK and Braid canaries with one new key. |

## Self-gate

9/9 passed — failed: none.
1 verdict = decision + 1 number · 2 every finding has file:line · 3 concrete failure scenario · 4 status label · 5 evidence is a pointer · 6 cost both sides · 7 fix + verification per row · 8 zero adjectives standing in for counts · 9 148 words ≤600 outside tables.
10 changes: 10 additions & 0 deletions .agent/skill-runs.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@
{"skill":"/harden","ts":"2026-08-12T03:42:22Z","project":"braid-transcript-first-wt","target":"provider-neutral retained execution lifecycle, exact provider identity, recovery, cancellation, and event binding n=11 files","operatorPrompt":"","durationMin":null,"verdict":"APPROVE","dispatchedTo":"/critical-audit","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/critical-audit","ts":"2026-08-12T03:42:23Z","project":"braid-transcript-first-wt","target":"provider-neutral retained execution lifecycle and provider-owned identity binding n=11 files","operatorPrompt":"","durationMin":null,"verdict":"APPROVE","dispatchedTo":"/stop","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/converge","ts":"2026-08-12T12:53:14Z","project":"braid-transcript-first-wt","target":"Braid full release check performance failure","operatorPrompt":"","durationMin":null,"verdict":"PASS","dispatchedTo":"/review-to-green","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/sandbox-sdk-integration","ts":"2026-08-12T14:30:51Z","project":"braid-retained-v2-wt","target":"Braid retained Tangle sandbox execution through the published SDK and provider","operatorPrompt":"","durationMin":null,"verdict":"PASS","dispatchedTo":"/ground-truth","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/ground-truth","ts":"2026-08-12T14:30:51Z","project":"braid-retained-v2-wt","target":"production retained cloud create, dispatch, reconnect, cleanup, usage, and latency path n=1","operatorPrompt":"","durationMin":null,"verdict":"EXTERNAL_BLOCKER_CONFIRMED","dispatchedTo":"/diagnose","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/diagnose","ts":"2026-08-12T14:30:51Z","project":"braid-retained-v2-wt","target":"retained Tangle canary failure n=1","operatorPrompt":"","durationMin":null,"verdict":"ROOT_CAUSE_CONFIRMED","dispatchedTo":"/autopsy","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/autopsy","ts":"2026-08-12T14:30:51Z","project":"braid-retained-v2-wt","target":"production retained canary and direct start traces n=2","operatorPrompt":"","durationMin":null,"verdict":"INFRA_BUG","dispatchedTo":"/verify","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/bp-ops","ts":"2026-08-12T14:30:51Z","project":"braid-retained-v2-wt","target":"Sandbox production health, deploy history, and resource cleanup","operatorPrompt":"","durationMin":null,"verdict":"DEPLOY_BLOCKED","dispatchedTo":"/adc-infra-triage","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/adc-infra-triage","ts":"2026-08-12T14:30:52Z","project":"braid-retained-v2-wt","target":"production and staging ADC revisions versus exact retained-run revision","operatorPrompt":"","durationMin":null,"verdict":"ROOT_CAUSE_CONFIRMED","dispatchedTo":"/verify","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/report","ts":"2026-08-12T14:30:52Z","project":"braid-retained-v2-wt","target":"Braid retained Tangle production status and stress evidence","operatorPrompt":"","durationMin":null,"verdict":"PASS","dispatchedTo":"/stop","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/harden","ts":"2026-08-12T17:28:15Z","project":"braid-retained-v2-wt","target":"Braid retained Tangle lifecycle, public proof redaction, replay races, and cleanup n=65 files","operatorPrompt":"","durationMin":null,"verdict":"APPROVE","dispatchedTo":"/critical-audit","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/critical-audit","ts":"2026-08-12T17:28:16Z","project":"braid-retained-v2-wt","target":"Braid retained Tangle lifecycle, stress proof, and public evidence n=65 files","operatorPrompt":"","durationMin":null,"verdict":"APPROVE","dispatchedTo":"/verify","operatorOverride":null,"transcriptPath":null,"traceDir":null}
{"skill":"/verify","ts":"2026-08-12T17:28:16Z","project":"braid-retained-v2-wt","target":"Braid retained Tangle source, 683 tests, packed terminal, cloud proof contracts, and CLI Bridge matrix","operatorPrompt":"","durationMin":null,"verdict":"PASS","dispatchedTo":"/ship","operatorOverride":null,"transcriptPath":null,"traceDir":null}
Loading