Repository navigation
Description
Summary
Some core command wrappers replace typed CLI errors with plain Error, so managed-job refusals lose their machine-readable error code. The write remains blocked. This is a P2 follow-up from the architecture panel of #5839, deliberately excluded from that safety fix.
Versions and environment
Source CLI at b1a3eadf7f20da98d76c227046a02704e864740d, Linux. Reproduced inside a real host-care job with all fetch calls stubbed; zero network calls occurred.
Steps to reproduce
Build @bb/cli with Turbo and save the intercepting fetch stub from #5838 as mock-fetch.mjs. Run:
env -u BB_CLI -u BB_PROJECT_ID -u BB_THREAD_ID -u BB_ENVIRONMENT_ID \
BB_CLI_ERROR_LOG=0 HOST_CARE_JOB_ID=guard-repro \
BB_SERVER_URL=http://127.0.0.1:38886 GUARD_PROBE_LOG="$PWD/requests.jsonl" \
node --import "$PWD/mock-fetch.mjs" apps/cli/dist/index.js \
thread archive thr-guard-fixture --jsonExpected vs actual
Expected: nonzero exit with managed_job_default_server_write and zero writes.
Actual: nonzero exit and zero writes, but a generic error code:
{
"ok": false,
"error": {
"code": "error",
"message": "Failed to archive thread thr-guard-fixture: Managed job refused POST http://127.0.0.1:38886; set BB_SERVER_URL to your isolated server and verify its exact dataDir with bb status --json before writing."
}
}Evidence
- Archive catches and wraps the original error.
- prependErrorContext replaces the typed error.
- Review and independent reproduction: PR Guard managed jobs against default-server CLI writes #5839.
What was ruled out
The transport guard still prevents the request. Unwrapped plugin config, SDK plugin enable, and both plugin CLI forms preserve the code. Duplicate search for prependErrorContext error code found no matching issue.
Suggested priority and effort
P2: preserve the typed refusal through contextual wrappers and add a built-CLI regression for a wrapped mutation. Done when its JSON code remains specific with nonzero exit and zero transmitted writes.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 20, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotcli.errorfor wrapped archive; both exit 1.prependErrorContextreplaces the typed error with plainError, so the action handler loses its code. The report includes the failing built-CLI regression and both runs’ output.partial-repro.origin/main; its prerequisite guard remains in open PR Guard managed jobs against default-server CLI writes #5839.