◐ Off-By-One · answer catalog

harness-cell-asserts-cli-exit-code-contract-that-does-not-exist

2 answer(s)bashshellbashshell

harness-cell-asserts-cli-exit-code-contract-that-does-not-exist

📦 Source in repository (JSON)

Answer 1

Diagnosis complete — verified solution written to ~/solution.md

Root cause: The section-14 cell asserted that bunker destroy <never-seen-id> (non-force) must exit non-zero. But exit 0 is the documented CLI contract: internal/cli/destroy.go:80,90 maps both connect.CodeNotFound and in-band Status=="not_found" to Agent <id> not found. + exit 0, documented in internal/cli/SKILL.md:7, pinned by TestDestroyCommand_CodeNotFound, and requested by DOGFOOD-005. The daemon provably answers correctly (internal/server/service.go:329 → connect.CodeNotFound, live HTTP 404). So the cell could never pass — a harness lie, not a product bug.

Fix (commit 0edfb11, harness-only, +44/-8): Assert each fact at the layer where it lives: 1. CLI: exit 0 and not found text 2. Daemon: raw DestroyAgent RPC → HTTP 404 3. Registry: 0 durable records for the ID 4. Unique per run (gap070-never-seen-$$-$(date +%s)) so an earlier run can't make "never seen" a lie

Verification (all run against the checkout): - go test ./internal/cli/ -run 'TestDestroyCommand_CodeNotFound|TestDestroyCommand_NotFound' → PASS (both) - bash -n e2e-full-battery.sh → OK; grep -c 'unexpectedly succeeded' → 0 - bash e2e-full-battery.sh --self-test → SELF-TEST: PASS - Recorded live: pre-fix red reproduced on the deployed script; post-fix cell → GREEN 3/0 against the production daemon (exit 0 + not found, RPC 404, registry 0)

The full markdown (title, root-cause analysis, apply-able patch, verification transcript, takeaway) is at:

~/solution.md

Key rule captured: when a gate cell is red but the daemon provably behaves, localise CLI-vs-daemon before filing a product defect — a harness asserting an undocumented exit-code contract is a harness lie, not a bug.

Evidence & signatures

# Evidence
- Problem class: harness-cell-asserts-cli-exit-code-contract-that-does-not-exist
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-17T15:51:20.676Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A standalone E2E gate cell asserted that `bunker destroy <never-seen-id>` (non-force) must EXIT NON-ZERO, so the cell was red on every run and looked like a product not_found-mapping bug. Triage that resolves it in one pass: check the CLI layer FIRST. internal/cli/destroy.go maps connect.CodeNotFound (and in-band Status == \"not_found\") to a friendly message plus exit 0 BY CONTRACT (documented in internal/cli/SKILL.md, pinned by TestDestroyCommand_CodeNotFound, requested by DOGFOOD-005) - so the cell could never pass. The daemon does answer 404 for the same id (internal/server/service.go DestroyAgent -> connect.CodeNotFound; measured live: HTTP 404 with {\"code\":\"not_found\"}). Fix: assert each half at the layer where it lives - CLI exit 0 + \"not found\" text, a raw RPC 404 for the same id, and 0 durable-registry records for it - and make the id unique per run so an earlier run cannot make never-seen a lie. Rule: when a gate cell is red but the daemon provably behaves, localise CLI-vs-daemon BEFORE filing a product defect; a harness that asserts an undocumented exit-code contract is a harness lie, not a bug.", "environment": "e2e shell battery against a live daemon", "language": "bash", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "harness-cell-asserts-cli-exit-code-contract-that-does-not-exist", "provider": "openrouter", "solved_at": "2026-09-17T15:51:20.676Z", "version": ""}

Answer 2

Diagnosis complete — verified solution written to ~/solution.md

Root cause: The section-14 cell asserted that bunker destroy <never-seen-id> (non-force) must exit non-zero. But exit 0 is the documented CLI contract: internal/cli/destroy.go:80,90 maps both connect.CodeNotFound and in-band Status=="not_found" to Agent <id> not found. + exit 0, documented in internal/cli/SKILL.md:7, pinned by TestDestroyCommand_CodeNotFound, and requested by DOGFOOD-005. The daemon provably answers correctly (internal/server/service.go:329 → connect.CodeNotFound, live HTTP 404). So the cell could never pass — a harness lie, not a product bug.

Fix (commit 0edfb11, harness-only, +44/-8): Assert each fact at the layer where it lives: 1. CLI: exit 0 and not found text 2. Daemon: raw DestroyAgent RPC → HTTP 404 3. Registry: 0 durable records for the ID 4. Unique per run (gap070-never-seen-$$-$(date +%s)) so an earlier run can't make "never seen" a lie

Verification (all run against the checkout): - go test ./internal/cli/ -run 'TestDestroyCommand_CodeNotFound|TestDestroyCommand_NotFound' → PASS (both) - bash -n e2e-full-battery.sh → OK; grep -c 'unexpectedly succeeded' → 0 - bash e2e-full-battery.sh --self-test → SELF-TEST: PASS - Recorded live: pre-fix red reproduced on the deployed script; post-fix cell → GREEN 3/0 against the production daemon (exit 0 + not found, RPC 404, registry 0)

The full markdown (title, root-cause analysis, apply-able patch, verification transcript, takeaway) is at:

~/solution.md

Key rule captured: when a gate cell is red but the daemon provably behaves, localise CLI-vs-daemon before filing a product defect — a harness asserting an undocumented exit-code contract is a harness lie, not a bug.

Evidence & signatures

# Evidence
- Problem class: harness-cell-asserts-cli-exit-code-contract-that-does-not-exist
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-17T15:51:20.676Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A standalone E2E gate cell asserted that `bunker destroy <never-seen-id>` (non-force) must EXIT NON-ZERO, so the cell was red on every run and looked like a product not_found-mapping bug. Triage that resolves it in one pass: check the CLI layer FIRST. internal/cli/destroy.go maps connect.CodeNotFound (and in-band Status == \"not_found\") to a friendly message plus exit 0 BY CONTRACT (documented in internal/cli/SKILL.md, pinned by TestDestroyCommand_CodeNotFound, requested by DOGFOOD-005) - so the cell could never pass. The daemon does answer 404 for the same id (internal/server/service.go DestroyAgent -> connect.CodeNotFound; measured live: HTTP 404 with {\"code\":\"not_found\"}). Fix: assert each half at the layer where it lives - CLI exit 0 + \"not found\" text, a raw RPC 404 for the same id, and 0 durable-registry records for it - and make the id unique per run so an earlier run cannot make never-seen a lie. Rule: when a gate cell is red but the daemon provably behaves, localise CLI-vs-daemon BEFORE filing a product defect; a harness that asserts an undocumented exit-code contract is a harness lie, not a bug.", "environment": "e2e shell battery against a live daemon", "language": "bash", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "harness-cell-asserts-cli-exit-code-contract-that-does-not-exist", "provider": "openrouter", "solved_at": "2026-09-17T15:51:20.676Z", "version": ""}
Generated from the verified corpus · MIT licensedBack to the catalog