Repository navigation
feat(cli): unexpected failures point to patchy feedback - #1219
Conversation
0ca4949 to
e2029ef
Compare
a531081 to
db1f7e9
Compare
e2029ef to
13fd67f
Compare
db1f7e9 to
89037f8
Compare
520fa1a to
06007d4
Compare
89037f8 to
9a2d5cb
Compare
06007d4 to
bf696f6
Compare
9a2d5cb to
7c3a02e
Compare
bf696f6 to
da5b403
Compare
Acceptance: PASS with notesChecked Rebase: passed. Range-diff evidenceRetained independent evidence The following evidence is carried forward from comment 6795635935, checked at Prior Done means, risks, focused checks and golden journeys — retained verbatimDone means
Actual forced-failure output, with the local origin replaced: $ patchy whoami
<instance> answered 500. Try again later, or tell the operator.
If Patchy got this wrong, tell Patchy's team: patchy feedback "<what you ran and what happened>"
exit 3
$ patchy whoami --json
{"ok":false,"error":"<instance> answered 500. Try again later, or tell the operator.","kind":"unreachable","feedbackHint":"If Patchy got this wrong, tell Patchy's team: patchy feedback \"<what you ran and what happened>\""}
exit 3Risks and focused checks
Golden journeys
Rollback answers: The answers match the diff. Optional diagnostic output and failure classification introduce no migration, persisted state or infrastructure. Revert leaves nothing new stored; existing exit codes and error fields remain compatible. No Current rollback check: passed; log read. Job 130523524462 reports “No migration or handler descriptor changed, so there is no rollback to rehearse.” This is the expected gate for this layer, not a separate full rehearsal. The inherited feedback migration’s four-stage rehearsal passed on #1217 at CI on the checked head Snapshot 2026-11-11 12:50 UTC: 24 passed, 2 skipped, 0 failed, 0 pending (26 reported checks). All results belong to the checked head. Passed: Skipped (not counted as passed):
The current-head Node 24 log reports 318 suites passed; 3,498 tests passed, 3 skipped, including all seven focused output/client/CLI/login/skill suites (72 tests) and the complete installed-CLI relay suite (49 tests). These are new-head CI results, separate from the retained forced-failure and real-server evidence. Not run
Notes
No code, branch, PR body or labels were changed, and nothing was pushed or merged. No local instance was started; production and the personal CLI state were not accessed. |
7c3a02e to
ee0d40a
Compare
da5b403 to
a0b7039
Compare
UnreachableError now says whether no answer arrived (transport), the answer was a status or state nothing describes (response), or its body could not be read (decode). Each site that creates one records it; exit codes are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After an unmodelled 5xx, an unreadable body or an Unexpected error, the output contract adds one line offering patchy feedback, or feedbackHint in the --json failure document. Transport failures, refusals, local mistakes and any failure of the feedback command itself carry none; the last keys off the running command's name, the same one the patchy-cli header records. A relayed failure from the installed CLI keeps the hint. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s response Effect reports both as a DecodeError. A body read that fails with the connection's error, rather than a SyntaxError, is now transport, so a dropped reply no longer offers patchy feedback. The generated client's fallback for an undeclared status, such as a 500, is now response; only a 2xx body that arrived and could not be read is decode. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A command that relays the installed CLI's failure rebuilt its Unexpected error as a plain LocalError and dropped the hint. LocalError now carries an unexpected marker from the relayed document's feedbackHint; it still exits 1 and offers patchy feedback. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The suppression set now holds real command names: feedback joined CliCommand with the command itself. A 500 on patchy request offers the hint; the same 500 on patchy feedback, a send or its list, doesn't. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A declared refusal status whose body can't be read is no answer, exit 3, recorded as decode, so a request offers the hint after it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…is response A declared refusal status whose body stopped arriving is no answer at all, so it offers no hint; one whose body arrived unreadable stays decode. On a send, an undeclared refusal status the CLI couldn't decode is the instance's answer, response, unless its body was cut off. Both reuse unreachableReason's check, now bodyCutOff. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n every command The generated client fails a declared refusal status whose body didn't decode with the status first and the body's failure after it, and Effect.catch hands Api.classify only the first: a cut-off 503 read as the instance's answer and offered the hint. The CLI's client now puts a body that stopped arriving first in the cause, through makeClient's new transformResponse, so classify records transport. submissionFailure reads the same first error instead of scanning the cause itself. Co-Authored-By: Claude Opus 5.5 <[email protected]>
a0b7039 to
fe5ba7e
Compare
|
Landing note: |
…ey shortcuts (#1421) ## What changed This adds release 42's What's new entry, written from `1cd6d12`. It covers everything merged since release 41's `through` (`a25a9c5`), and sets the `patchy` release to `0.42.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | New: Tell Patchy what it's missing | #1217, #1218, #1219, #1227, #1228 | | New: Turn off single-key shortcuts | #1276, #1279, #1301 | | Fixed: Typing reaches the patch again | #1407, #1412 | | Fixed: Dialogs in patches keep your place | #1420, #1255 | | Behind the scenes: plainer facts for agents building patches | #1249, #1256, #1297, #1418 | | Behind the scenes: Patchy stores teams and audiences ahead of teams | #1416 | | Patch changes: Mod+/ and `client.close()` in patchy/hotkeys; single-key shortcuts can be off; Tab wraps in plain modal dialogs | #1279, #1301, #1420 | #1376 is release 41's own entry. #1400, #1406, #1414, #1415, #1302, #1413 and #1419 are test, CI and dev tooling and need no line. The teams bridge (#1416) ships alone in this release so teams (#1417) can follow in the next one with a release to roll back to that reads its data closed. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - **Rollback safety, from the live commit `7f93b91` (release 41) to this PR's merge.** No PR in the range is labelled `one-way`, and every Release impact answer says release 41 still works: - **#1217** adds migration `0037_feedback`, a schema release 41 never reads. **#1227** and **#1228** write into it. - **#1276** adds migration `0038_single_key_shortcuts`, a column with a default that release 41 never selects. - **#1416** adds migrations `0039_company_teams` to `0041_connection_audiences`, which hold tables that stay empty until teams ship, and widens one scope check. Its CI rehearsal ran `7f93b91 → head → 7f93b91 → head` on one set of data, and all four steps passed. - **#1279**, **#1301**, **#1255** and **#1420** change the SDK and the shell. Patches built on this release carry a `shortcutSetting` manifest field that release 41 reads without refusing, and its shell names no frame, so every shortcut stays on. - **#1218** and **#1219** add CLI commands and an optional `feedbackHint` in `--json` failures. A CLI from this release refuses to publish to an older instance before sending anything, as any mismatched release does. - Everything else is skill text, docs, tests and CI. If this release misbehaves, roll back to `7f93b91` (release 41). Written by Claude Opus 5.5 in Claude Code, through T3 Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
Stacked on #1218; merge after it.
What changed
An agent that hits a real Patchy fault rarely goes looking for a feedback command, so the failure itself now says one exists. After an answer the CLI couldn't use, such as an unmodelled 5xx or an unreadable body, or after an
Unexpected error, the CLI adds one line:Under
--json, the same line goes in the failure document asfeedbackHint, so stderr still holds exactly one document. Network failures (including a reply cut off mid-body), refusals (exit 2), local mistakes (exit 1), sign-in states and failures ofpatchy feedbackitself carry no hint. Those are things the agent should fix itself, and hinting on them would flood the channel.To tell those cases apart,
UnreachableErrornow records why it happened, at the point where it's created:transport,responseordecode. Exit codes don't change.Closes #1213
Part of #1210.
Look at
1. An instance 500, before and after. The output is the real bundled CLI's, run against a stub that answers 500. The "before" is the exact stderr that main's exit-code ladder test asserts.
Before:
After:
These don't change:
2. How each
UnreachableErrorsite is classified. Every site that creates one:Api.classify,SchemaErrordecodeApi.classify,TransportErrortransportApi.classify, other responses that aren't 4xxresponsetransportdecodeLogin.poll, wait budgettransportProject.add,inventory: nullsource_unavailable)responseProject.installedFailureresponseif the document carriesfeedbackHint, elsetransport. Its hintedUnexpected errorstays aLocalErrormarkedunexpected, exit 1Dev.agentApi.classifysubmissionFailure(#1218)decoderequest: yes;feedback: nevertransportresponse, ortransportif its body was cut offrequest: yes;feedback: neverrequestorfeedbacksend's exit-3 message to say it may have been storedrequest: as classified;feedback: neverunreachableReasonswitches exhaustively over Effect's sixHttpClientErrorreasons, so a reason Effect adds later fails typecheck. Effect reports two different things as aDecodeError, and the function tells them apart:SyntaxError, istransport. That check isbodyCutOff.For a declared refusal status, the generated client fails with the status first and the body's failure after it, and
Effect.catchhandsclassifyonly the first. So the CLI's client (cutOffFirst, passed throughmakeClient's newtransformResponse) puts a body that stopped arriving first in the cause.classifyandsubmissionFailureboth read that first error; neither scans the cause itself.response, read from the status.A request that couldn't be built (
EncodeError,InvalidUrlError) was never answered, so it maps totransport.3. How
patchy feedback's own failures are suppressed. The check keys off the running command's name,Api.CurrentCommand. That's the same name thepatchy-cliheader records, and #1218 registersfeedbackandrequestwithwithCommandHeaderlike every other command. The check lives inunhintedCommandsinOutput.ts, aReadonlySet<Api.CurrentCommand["Service"]>holdingfeedback, so its subcommands (list,withdraw) are covered too.A 500 on
patchy requeststill offers the hint. A broken request route is a Patchy fault, andfeedbackis the channel that reports it. Iffeedbackis down too, its own failure stays quiet, so an agent that tries it costs at most one call.4. The skills. The failure-document summaries in the global
patchyskill and inpatchy-loopnow listfeedbackHintand say when it appears.skills-lock.jsoncarries the new hash.How it was verified
Api.undici.test.ts(new, Node only like the other undici suites) records the reason for each case, using the real generated client over the CLI's undici against a local server:response;decode;transport.Removing the cause rule fails the cut-off case, and removing the status rule fails the 500.
Output.test.ts(new) tests the contract in-process, with one case per path. The hint follows an unmodelled 5xx, an unreadable body, anUnexpected errorand the installed CLI's relayed one, each exactly once, in text mode and asfeedbackHint. It never follows no answer at all, aname_takenrefusal, a local mistake, or a failure (5xx or defect) ofpatchy feedbackitself. Two mutations were checked: forcing the hint ontotransportfails "never follows no answer at all", and ignoring the command name fails thefeedbackcase.The exit-code ladder in
cli.test.tsruns the bundled CLI. A 503 prints the hint once in text and--jsoncarriesfeedbackHint. A garbled 200 carries it too. Nothing listening,patchy.invalidfailing DNS, and a body cut off mid-stream carry none. The cut-off cases are a 200 onwhoami, and a declared 503 onpatchy list some-patch tasks, whose body the client reads. WithoutcutOffFirstthe 503 case fails, and so doescliFeedback's cut-off 422. The existing exit-1 (validate) and exit-2 (rejected key) cases still assert their exact output, with no hint.cliRepo.test.tscovers the relay. A 503 on generation, which runs in the installed CLI, comes back with the hint, while a dropped connection on the same route, a 401 and a 403 come back without it. Hardcoding the relay totransportfails the 503 case. A stand-in installed CLI that crashes with a hintedUnexpected errorcomes back fromrefreshas exit 1, still carryingfeedbackHint; without the relay fix it loses the hint.cliFeedback.test.tsruns the built CLI's real commands against a stub.patchy requestprints the hint after its "may have been stored" message, and its--jsoncarriesfeedbackHint.patchy feedbackandpatchy feedback listcarry no hint in text or--json.patchy requestexits 3 with the hint in text and--json.patchy requestexits 3 with the storage warning and no hint.requestsend now also carriesfeedbackHint.unhintedCommandsfails the test, recording the unreadable refusal astransportfails it, and so does removing thebodyCutOffcheck, which prints the hint after the cut-off 422.LocalErrors and print no hint. Run by hand against the built CLI, each exits 1 with no hint in text or--json,patchy requestincluded.cliDevAgent.test.ts: the dev runtime's 500 and its garbled 200 carry the hint.Login.test.ts: the login wait timeout, a sign-in state that exits 3, istransport, so it gets no hint.pnpm checkat this head passes format, lint, typecheck and synth. Its test stage passes every suite this PR touches,cliFeedbackand the skillLock test. The rest fails only in the shared-machine ways described below. Every conflict across the rebases onto feat(cli): patchy request and patchy feedback #1218 was in the CLI (submissionFailureandcliFeedback.test.ts), sopnpm verifylast ran before them, at this PR's review fixes.pnpm verify, run locally at the review fixes. Format, lint, typecheck, synth, postgres-concurrency, tier2-smoke and browser pass. On the bun stage, the classify cases came backtransportbecause Bun has no undici dispatcher, so they moved into the Node-onlyApi.undici.test.ts. Rerun after the move, every bun suite passes except two under full-suite load, both of which pass alone:RequestEvents(server, passes alone on Bun and Node);Supervisor(execution). It,EngineandLocalTaskProvider, which failed under load in earlier runs, pass 53/53 alone.The other failures come from this shared machine, not the change:
GET /to the CLI suites' stub servers. Each run, that breaks a different request-log assertion incliPublish,cliLifecycle,cliLookandcliRepoRecovery, and three bodiless-request parses indevExecution. The same files fail the same way onmain. Each failure passes on a rerun.packages/sdkinstall tests, theinstallstage and the last step ofcli-smoke) neednpmbeside the running Node, and this machine's system Node 26 has none. All three pass under Node 24.CI is the authority on both.
Review
GPT 6.1 Sol reviewed this PR at xhigh, three times.
First pass (ab85634): three findings, all fixed.
transport.Unexpected errorlost its hint. It now keeps the hint, still exit 1.decode. It's nowresponse.A fourth, the skill summaries missing
feedbackHint, waited for the rebase onto feat(cli): patchy request and patchy feedback #1218 and is fixed.Second pass (13fd67f): one finding, fixed. A declared 503 whose body was cut off still offered feedback, because
classifysaw only the status. The client now puts a cut-off body first in the cause, as described under Look at.Third pass (520fa1a): one finding, dismissed. An undeclared 5xx whose body is cut off still offers feedback, because Effect rejects an undeclared status from its headers without reading the body. That's intended. An unmodelled 5xx is the case the hint is for (feat(cli): unexpected failures point to patchy feedback #1213: "on response failures, meaning an unmodelled 5xx"): the status line already says Patchy failed, whether or not its body arrived whole. Detecting the truncation would mean reading every error body for no change in what the agent should do. The same pass found
makeClienthas one caller, the CLI, and that409 name_takenrefusals, SIGTERM → 130, and single sends are unchanged.Release impact
The change is additive. Text-mode stderr gains one line after unexpected failures; ADR-0004 already says line count isn't the contract. The
--jsonfailure document gains an optionalfeedbackHint.makeClientin@patchy/apigains an optionaltransformResponseargument, which only the CLI passes. Exit codes,kind,codeand every other field stay the same. The README and ADR-0004 document the field.Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code.