Skip to content

feat(cli): patchy request and patchy feedback - #1218

Merged
allisonmahmood merged 8 commits into
mainfrom
feedback/cli
Nov 11, 2026
Merged

allisonmahmood merged 8 commits into
mainfrom
feedback/cli

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #1217; merge after it.

What changed

When an agent finds Patchy can't do something the person needs, or Patchy behaves oddly, the signal dies in that session. #1217 gave Patchy a place to store requests and feedback; this gives agents the way in. patchy request and patchy feedback send them from the CLI in one call, without prompts, and read well under --json. The global patchy skill says when to use each, and patchy-loop points to it.

Closes #1212
Part of #1210

How it works

  • patchy request "<what Patchy should do>" [--why "<need>"] stores the request and exits 0 even with matches, since a failure exit would invite a retry and a retry is a real duplicate. --json is { ok, id, similar: [{ id, title, status, note?, link }], next }: each match's link is the exact patchy request link <id> <match-id> command, each id one shell word, quoted when it needs it, and next says nothing else is required, to link only a match that fully meets the need, and, when one has shipped, to tell the person using its note. Text prints the id, then the matches.
  • request link <id> <match-id> [--why], request unlink <id>, feedback "<text>", request|feedback list [--cursor] and request|feedback withdraw <id> print feat(feedback): Patchy stores requests and feedback #1217's success documents. Any text, or --why, may be - to read stdin, one per call.
  • Inside a patch repo a send names patchy.json's patch. It is read leniently: a missing or broken patchy.json names none and never stops the send.
  • request and feedback join CliCommand, so the Patchy-Cli header records them for every subcommand (feat(cli): unexpected failures point to patchy feedback #1213 reads this to keep its hint off feedback).
  • Checked before sending, exit 1 with nothing sent: a request outside 3–200 characters once whitespace collapses, a why or feedback over 4,000 (the store's bounds, now exported from @patchy/api), stdin that isn't UTF-8 or passes the bound (reading stops there), and a path id that isn't of the shape the store mints (SubmissionId: req_/fbk_ and 24 lowercase letters and digits). A match id rides in the body, so a general request's id stays the instance's to judge.
  • Refusals are exit 2 in the instance's words, with their code: contains_secret, invalid_text, rate_limited, not_found, invalid_link.
  • Version skew. An instance from before feat(feedback): Patchy stores requests and feedback #1217 answers these routes with the API's catch-all 404 ({ ok: false, error: "Not found." }, no code). The CLI turns that into exit 2, " doesn't take requests yet." The new routes' own 404 always carries not_found, and ids are checked locally first, so an overlong id can't reach the router's catch-all and pass for skew. Nothing is gated on an exact release, and an older CLI simply has no such commands.
  • Lost answers. Sends never retry. A dropped connection, a 5xx, an unreadable body, a refusal status whose body doesn't decode, or any answer that isn't a decoded refusal (such as an empty 403 from a proxy) stays exit 3, and its message says the submission may have been stored and to run patchy request list (or feedback list) before sending again, instead of the usual "run the same command again".

The skill text (skills/patchy/SKILL.md; its description: gains "or tell Patchy's team what it lacks or got wrong"):

patchy request and patchy feedback reach Patchy's team, the people who build Patchy: not the company, a patch's owner or your harness's own feedback tool. A patch's own bug, or an agent tool it lacks, goes to that patch's owner.

  • Request when Patchy can't do what the person needs, such as an integration, a command or an SDK capability, even after a workaround. Name the capability, not a guessed command, and put the need and its constraints in --why: patchy request "Gmail integration" --why "Sales tracks replies in the pipeline patch; reading is enough" --json. It stores the request and exits 0 with up to three similar requests. Run a match's link command, with --why, only when it is the same need. A shipped match's note says how to use it now; next says what is left.
  • Feedback when Patchy did something wrong, surprising or harder than it should be. Say what you ran, what you expected and what happened: patchy feedback "Ran patchy publish --json; expected a URL; got exit 3, then the same publish worked" --json.

Send once per problem, when you finish or give up, and tell the person the id. Patchy attaches the person, company, agent and CLI version; the rest is your own words about the problem. Leave out keys, connection strings, rows, file contents, other people's personal details and pasted logs. contains_secret names the field to rewrite. Text or --why of - reads stdin. After exit 3 the send may have been stored: check patchy request list or patchy feedback list before sending again. withdraw <id> deletes one.

It says nothing either way about asking the person first. patchy-loop gains one line: "When Patchy itself can't do what the person needs, or gets something wrong, follow Requests and feedback in the global patchy skill, or in node_modules/patchy/skills/patchy/SKILL.md where that skill isn't installed." The packed patchy tarball carries package/skills/patchy/SKILL.md, so that path exists in any installed repo, a fresh clone included.

Look at

The commands on real instances. Before is #1217's head, whose CLI has no such commands; after is this branch. The credential in the third line is postgres://app:[email protected]/app; the transcript's sanitizer redacted part of it as an email address.

Transcript requests-and-feedback

Before is b4f5880 (where this branch left feedback/store) and after is db1f7e9 (feedback/cli), both on the team scenario, from pnpm dev transcript.

Each line ran in its own bash -c from the side's agent workspace, as the scenario's signed-in CLI, with stdin closed. Each side's origin reads <origin>, its environment folder <env>, its checkout <checkout> and the home folder ~; nothing else is normalized. Redacted before writing: email addresses outside the scenarios' example domains.

9 of 9 lines changed.

File a request, then a similar one: the second lists the first as a match

Changed. Before, exit 1 in 0.2 s; after, exit 0 in 0.2 s.

$ patchy request "Postgres connection over TLS only" --why "Our auditors want encryption in transit"
Sent request req_02h4wyjsgc6dwrx3yp6u5cid to Patchy's team.
Nothing else is required.
-DESCRIPTION
-  Build patch repos and publish patches to a Patchy Cloud instance.
-
-USAGE
-  patchy <subcommand> [flags]
-
-GLOBAL FLAGS
-  --help, -h                                                          Show help information
-  --version, -v                                                       Show version information
-  --wizard                                                            Start wizard mode for a command
-  --completions <bash|zsh|fish|powershell|sh|pwsh>                    Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh)
-  --log-level <all|trace|debug|info|warn|warning|error|fatal|none>    Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none)
-  --json                                                              Print the result as one JSON document on stdout
-  --api-url string                                                    The Patchy Cloud instance to talk to (its API base URL)
-
-SUBCOMMANDS
-  login       Log this machine in; relay the URL and code, then use --complete [code].
-  logout      Forget this machine's publishing key, then revoke it as a courtesy.
-  auth        Manage CLI authentication.
-  whoami      Check the configured Patchy Cloud credentials.
@@ 14 lines cut @@
-  refresh     Upgrade the pinned release and refresh the managed files as one transaction.
-  list        Discover patches, their primitives and reads, and company connections.
-  look        Show the company's look and its history; --json includes the files' contents.
-  add         Add members, a Postgres, PostHog, Pidgeon or Attio connection, shared-table or shared-store declaration and generate its files.
-  remove      Remove a declaration and its unused skill, preserving fixtures. Members requires no member columns.
-[stderr]
-Unknown subcommand "request" for "patchy"
-Unrecognized flag: --why in command patchy
+Sent request req_02h4wyjsgc6dwrx3yp6u5cid to Patchy's team.
+Nothing else is required.

14 of 44 lines are cut from the middle. --json has it all.

Changed. Before, exit 1 in 0.2 s; after, exit 0 in 0.2 s.

$ patchy request "Postgres connection encrypted with RSA" --why "Our auditors require RSA" --json
{"ok":true,"id":"req_8ds6nrib4mz5lwz1xyv2opse","similar":[{"id":"req_02h4wyjsgc6dwrx3yp6u5cid","title":"Postgres connection over TLS only","status":"open","link":"patchy request link req_8ds6nrib4mz5lwz1xyv2opse req_02h4wyjsgc6dwrx3yp6u5cid"}],"next":"Nothing else is required. Link a match only when it fully meets the need: run its link command, with --why saying why it does."}
-[stderr]
-{"ok":false,"error":"Unknown subcommand \"request\" for \"patchy\"\nUnrecognized flag: --why in command patchy","kind":"local"}
+{"ok":true,"id":"req_8ds6nrib4mz5lwz1xyv2opse","similar":[{"id":"req_02h4wyjsgc6dwrx3yp6u5cid","title":"Postgres connection over TLS only","status":"open","link":"patchy request link req_8ds6nrib4mz5lwz1xyv2opse req_02h4wyjsgc6dwrx3yp6u5cid"}],"next":"Nothing else is required. Link a match only when it fully meets the need: run its link command, with --why saying why it does."}
A credential is refused, naming the field and kind, and nothing is stored

Changed. Before, exit 1 in 0.2 s; after, exit 2 in 0.2 s.

$ patchy request "Postgres connection encrypted with RSA" --why "Connect with postgres://app:[redacted]/app" --json
[stderr]
{"ok":false,"error":"Nothing was stored: `why` holds a password in a URL. Remove it, or replace it with <token>, and send it again.","kind":"rejected","code":"contains_secret"}
 [stderr]
-{"ok":false,"error":"Unknown subcommand \"request\" for \"patchy\"\nUnrecognized flag: --why in command patchy","kind":"local"}
+{"ok":false,"error":"Nothing was stored: `why` holds a password in a URL. Remove it, or replace it with <token>, and send it again.","kind":"rejected","code":"contains_secret"}
Feedback, and a long note from stdin

Changed. Before, exit 1 in 0.2 s; after, exit 0 in 0.2 s.

$ patchy feedback "Ran patchy list connections --all; expected Gmail among the offered integrations; it isn't there" --json
{"ok":true,"id":"fbk_4vuob676g1anz7d8rgbq2lxq"}
-[stderr]
-{"ok":false,"error":"Unknown subcommand \"feedback\" for \"patchy\"","kind":"local"}
+{"ok":true,"id":"fbk_4vuob676g1anz7d8rgbq2lxq"}

Changed. Before, exit 1 in 0.2 s; after, exit 0 in 0.2 s.

$ printf 'Ran patchy publish page.html.\nExpected its URL; it printed nothing and exited 0.\n' | patchy feedback -
Sent feedback fbk_hckdvf4gwzkjsf69zvprymba to Patchy's team.
-DESCRIPTION
-  Build patch repos and publish patches to a Patchy Cloud instance.
-
-USAGE
-  patchy <subcommand> [flags]
-
-GLOBAL FLAGS
-  --help, -h                                                          Show help information
-  --version, -v                                                       Show version information
-  --wizard                                                            Start wizard mode for a command
-  --completions <bash|zsh|fish|powershell|sh|pwsh>                    Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh)
-  --log-level <all|trace|debug|info|warn|warning|error|fatal|none>    Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none)
-  --json                                                              Print the result as one JSON document on stdout
-  --api-url string                                                    The Patchy Cloud instance to talk to (its API base URL)
-
-SUBCOMMANDS
-  login       Log this machine in; relay the URL and code, then use --complete [code].
-  logout      Forget this machine's publishing key, then revoke it as a courtesy.
-  auth        Manage CLI authentication.
-  whoami      Check the configured Patchy Cloud credentials.
@@ 12 lines cut @@
-  pull        Copy a patch's repo into a new folder, set up to run and change: the served version, or --version.
-  dev         Start this patch repo's local runtime over fixtures (detached and idempotent).
-  refresh     Upgrade the pinned release and refresh the managed files as one transaction.
-  list        Discover patches, their primitives and reads, and company connections.
-  look        Show the company's look and its history; --json includes the files' contents.
-  add         Add members, a Postgres, PostHog, Pidgeon or Attio connection, shared-table or shared-store declaration and generate its files.
-  remove      Remove a declaration and its unused skill, preserving fixtures. Members requires no member columns.
-[stderr]
-Unknown subcommand "feedback" for "patchy"
+Sent feedback fbk_hckdvf4gwzkjsf69zvprymba to Patchy's team.

12 of 42 lines are cut from the middle. --json has it all.

Link a request to its match, then unlink it

Changed. Before, exit 1 in 0.2 s; after, exit 0 in 0.9 s.

$ patchy request "Calendar integration" --why "Book customer calls from the CRM" >/dev/null && r=$(patchy request "Google Calendar integration" --json) && patchy request link $(echo "$r" | jq -r .id) $(echo "$r" | jq -r '.similar[0].id') --why "Same need: any Google calendar" && patchy request unlink $(echo "$r" | jq -r .id)
Linked req_7s26vb2g5y3ua90paj9dp32k to req_l0buxugz2bpcvvo00j8wjthk  open  Calendar integration
req_7s26vb2g5y3ua90paj9dp32k has no link.
-[stderr]
-Unknown subcommand "request" for "patchy"
-Unrecognized flag: --why in command patchy
+Linked req_7s26vb2g5y3ua90paj9dp32k to req_l0buxugz2bpcvvo00j8wjthk  open  Calendar integration
+req_7s26vb2g5y3ua90paj9dp32k has no link.
What I sent, and withdrawing one

Changed. Before, exit 1 in 0.2 s; after, exit 0 in 0.2 s.

$ patchy request list
req_7s26vb2g5y3ua90paj9dp32k  2026-11-03T19:22:17.553Z  open  Google Calendar integration  (cli, unknown)
req_l0buxugz2bpcvvo00j8wjthk  2026-11-03T19:22:17.339Z  open  Calendar integration  (cli, unknown)
req_8ds6nrib4mz5lwz1xyv2opse  2026-11-03T19:22:16.488Z  open  Postgres connection encrypted with RSA  (cli, unknown)
req_02h4wyjsgc6dwrx3yp6u5cid  2026-11-03T19:22:16.273Z  open  Postgres connection over TLS only  (cli, unknown)
-DESCRIPTION
-  Build patch repos and publish patches to a Patchy Cloud instance.
-
-USAGE
-  patchy <subcommand> [flags]
-
-GLOBAL FLAGS
-  --help, -h                                                          Show help information
-  --version, -v                                                       Show version information
-  --wizard                                                            Start wizard mode for a command
-  --completions <bash|zsh|fish|powershell|sh|pwsh>                    Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh)
-  --log-level <all|trace|debug|info|warn|warning|error|fatal|none>    Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none)
-  --json                                                              Print the result as one JSON document on stdout
-  --api-url string                                                    The Patchy Cloud instance to talk to (its API base URL)
-
-SUBCOMMANDS
-  login       Log this machine in; relay the URL and code, then use --complete [code].
-  logout      Forget this machine's publishing key, then revoke it as a courtesy.
-  auth        Manage CLI authentication.
-  whoami      Check the configured Patchy Cloud credentials.
@@ 15 lines cut @@
-  list        Discover patches, their primitives and reads, and company connections.
-  look        Show the company's look and its history; --json includes the files' contents.
-  add         Add members, a Postgres, PostHog, Pidgeon or Attio connection, shared-table or shared-store declaration and generate its files.
-  remove      Remove a declaration and its unused skill, preserving fixtures. Members requires no member columns.
-[stderr]
-Unknown subcommand "request" for "patchy"
+req_7s26vb2g5y3ua90paj9dp32k  2026-11-03T19:22:17.553Z  open  Google Calendar integration  (cli, unknown)
+req_l0buxugz2bpcvvo00j8wjthk  2026-11-03T19:22:17.339Z  open  Calendar integration  (cli, unknown)
+req_8ds6nrib4mz5lwz1xyv2opse  2026-11-03T19:22:16.488Z  open  Postgres connection encrypted with RSA  (cli, unknown)
+req_02h4wyjsgc6dwrx3yp6u5cid  2026-11-03T19:22:16.273Z  open  Postgres connection over TLS only  (cli, unknown)

15 of 45 lines are cut from the middle. --json has it all.

Changed. Before, exit 1 in 0.2 s; after, exit 0 in 0.2 s.

$ patchy feedback list --json
{"submissions":[{"id":"fbk_hckdvf4gwzkjsf69zvprymba","createdAt":"2026-11-03T19:22:17.129Z","surface":"cli","agent":"unknown","kind":"feedback"},{"id":"fbk_4vuob676g1anz7d8rgbq2lxq","createdAt":"2026-11-03T19:22:16.917Z","surface":"cli","agent":"unknown","kind":"feedback"}],"nextCursor":null}
-[stderr]
-{"ok":false,"error":"Unknown subcommand \"feedback\" for \"patchy\"","kind":"local"}
+{"submissions":[{"id":"fbk_hckdvf4gwzkjsf69zvprymba","createdAt":"2026-11-03T19:22:17.129Z","surface":"cli","agent":"unknown","kind":"feedback"},{"id":"fbk_4vuob676g1anz7d8rgbq2lxq","createdAt":"2026-11-03T19:22:16.917Z","surface":"cli","agent":"unknown","kind":"feedback"}],"nextCursor":null}

Changed. Before, exit 1 in 0.4 s; after, exit 0 in 0.6 s.

$ id=$(patchy request "Slack integration" --json | jq -r .id) && patchy request withdraw "$id" && patchy request list --json | jq -c '[.submissions[].title]'
Withdrew req_u6bexxfzgn8mq197ppu4jv5b: it is deleted.
["Google Calendar integration","Calendar integration","Postgres connection encrypted with RSA","Postgres connection over TLS only"]
-DESCRIPTION
-  Build patch repos and publish patches to a Patchy Cloud instance.
-
-USAGE
-  patchy <subcommand> [flags]
-
-GLOBAL FLAGS
-  --help, -h                                                          Show help information
-  --version, -v                                                       Show version information
-  --wizard                                                            Start wizard mode for a command
-  --completions <bash|zsh|fish|powershell|sh|pwsh>                    Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh)
-  --log-level <all|trace|debug|info|warn|warning|error|fatal|none>    Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none)
-  --json                                                              Print the result as one JSON document on stdout
-  --api-url string                                                    The Patchy Cloud instance to talk to (its API base URL)
-
-SUBCOMMANDS
-  login       Log this machine in; relay the URL and code, then use --complete [code].
-  logout      Forget this machine's publishing key, then revoke it as a courtesy.
-  auth        Manage CLI authentication.
-  whoami      Check the configured Patchy Cloud credentials.
@@ 14 lines cut @@
-  refresh     Upgrade the pinned release and refresh the managed files as one transaction.
-  list        Discover patches, their primitives and reads, and company connections.
-  look        Show the company's look and its history; --json includes the files' contents.
-  add         Add members, a Postgres, PostHog, Pidgeon or Attio connection, shared-table or shared-store declaration and generate its files.
-  remove      Remove a declaration and its unused skill, preserving fixtures. Members requires no member columns.
-[stderr]
-{"ok":false,"error":"Unknown subcommand \"request\" for \"patchy\"","kind":"local"}
-Unknown subcommand "request" for "patchy"
+Withdrew req_u6bexxfzgn8mq197ppu4jv5b: it is deleted.
+["Google Calendar integration","Calendar integration","Postgres connection encrypted with RSA","Postgres connection over TLS only"]

14 of 44 lines are cut from the middle. --json has it all.

Version skew, on real instances. This branch's CLI, copied out of the build, against an instance at main (before, no #1217) and at this branch (after):

Transcript request-version-skew

Before is 5bbf22a (--base origin/main) and after is db1f7e9 (feedback/cli), both on the team scenario, from pnpm dev transcript.

Each line ran in its own bash -c from the side's agent workspace, as the scenario's signed-in CLI, with stdin closed. Each side's origin reads <origin>, its environment folder <env>, its checkout <checkout> and the home folder ~; nothing else is normalized. Nothing in it matched a collected secret (each side's CLI state, machine-token, login-code, API-key and access-token shapes, email addresses outside the scenarios' example domains, secret-named variables, and any accounts the run acts as).

3 of 3 lines changed.

This branch's CLI against each side's instance: before has no requests yet

Changed. Before, exit 2 in 0.2 s; after, exit 0 in 0.2 s.

$ node /tmp/patchy-cli-head/index.js request "Gmail integration" --why "Sales tracks replies in the pipeline patch"
Sent request req_jgw1ulmcpwp5ntt0294qpnej to Patchy's team.
Nothing else is required.
-[stderr]
-<origin> doesn't take requests yet.
+Sent request req_jgw1ulmcpwp5ntt0294qpnej to Patchy's team.
+Nothing else is required.

Changed. Before, exit 2 in 0.2 s; after, exit 0 in 0.2 s.

$ node /tmp/patchy-cli-head/index.js feedback "Ran patchy publish; expected a URL; it printed nothing" --json
{"ok":true,"id":"fbk_9ikr48k8zhc8li4vnzcxmcaj"}
-[stderr]
-{"ok":false,"error":"<origin> doesn't take feedback yet.","kind":"rejected"}
+{"ok":true,"id":"fbk_9ikr48k8zhc8li4vnzcxmcaj"}

Changed. Before, exit 2 in 0.2 s; after, exit 0 in 0.2 s.

$ node /tmp/patchy-cli-head/index.js request list
req_jgw1ulmcpwp5ntt0294qpnej  2026-11-03T19:22:41.024Z  open  Gmail integration  (cli, unknown)
-[stderr]
-<origin> doesn't take requests yet.
+req_jgw1ulmcpwp5ntt0294qpnej  2026-11-03T19:22:41.024Z  open  Gmail integration  (cli, unknown)

Checked before sending. Before is this PR's head before review, d6b8507, which sent each of these and left the instance to answer.

Transcript request-local-checks

Before is d6b8507 (--base) and after is db1f7e9 (feedback/cli), both on the team scenario, from pnpm dev transcript.

Each line ran in its own bash -c from the side's agent workspace, as the scenario's signed-in CLI, with stdin closed. Each side's origin reads <origin>, its environment folder <env>, its checkout <checkout> and the home folder ~; nothing else is normalized. Nothing in it matched a collected secret (each side's CLI state, machine-token, login-code, API-key and access-token shapes, email addresses outside the scenarios' example domains, secret-named variables, and any accounts the run acts as).

5 of 5 lines changed.

Checked before anything is sent: an empty request from stdin, and one over 200 characters

Changed. Before, exit 2 in 0.2 s; after, exit 1 in 0.2 s.

$ printf '' | patchy request - --json
[stderr]
{"ok":false,"error":"The request must be 3–200 characters; it is 0. Nothing was sent.","kind":"local"}
 [stderr]
-{"ok":false,"error":"Nothing was stored: `text` must be 3–200 characters, with no control characters.","kind":"rejected","code":"invalid_text"}
+{"ok":false,"error":"The request must be 3–200 characters; it is 0. Nothing was sent.","kind":"local"}

Changed. Before, exit 2 in 0.2 s; after, exit 1 in 0.2 s.

$ patchy request "$(head -c 201 /dev/zero | tr '\0' x)" --json
[stderr]
{"ok":false,"error":"The request must be 3–200 characters; it is 201. Nothing was sent.","kind":"local"}
 [stderr]
-{"ok":false,"error":"Nothing was stored: `text` must be 3–200 characters, with no control characters.","kind":"rejected","code":"invalid_text"}
+{"ok":false,"error":"The request must be 3–200 characters; it is 201. Nothing was sent.","kind":"local"}
An id the store couldn't have minted, which an instance's router also turns away

Changed. Before, exit 2 in 0.2 s; after, exit 1 in 0.2 s.

$ patchy request unlink "req_$(head -c 97 /dev/zero | tr '\0' a)" --json
[stderr]
{"ok":false,"error":"\"req_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" isn't a request id: those are req_ and 24 lowercase letters and digits, as patchy request list shows them. Nothing was sent.","kind":"local"}
 [stderr]
-{"ok":false,"error":"<origin> doesn't take requests yet: it runs a Patchy release from before them.","kind":"rejected"}
+{"ok":false,"error":"\"req_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" isn't a request id: those are req_ and 24 lowercase letters and digits, as patchy request list shows them. Nothing was sent.","kind":"local"}
stdin that isn't UTF-8, and stdin past the 4,000-character bound

Changed. Before, exit 0 in 0.2 s; after, exit 1 in 0.2 s.

$ printf 'Publish failed in the caf\351 patch' | patchy feedback - --json
[stderr]
{"ok":false,"error":"stdin isn't valid UTF-8. Nothing was sent.","kind":"local"}
-{"ok":true,"id":"fbk_6bqzzstyzdeirtjyz9i2vvac"}
+[stderr]
+{"ok":false,"error":"stdin isn't valid UTF-8. Nothing was sent.","kind":"local"}

Changed. Before, exit 2 in 0.2 s; after, exit 1 in 0.2 s.

$ head -c 1000000 /dev/zero | tr '\0' y | patchy feedback - --json
[stderr]
{"ok":false,"error":"The feedback on stdin is longer than 4,000 characters. Nothing was sent.","kind":"local"}
 [stderr]
-{"ok":false,"error":"Request body is too large.","kind":"rejected"}
+{"ok":false,"error":"The feedback on stdin is longer than 4,000 characters. Nothing was sent.","kind":"local"}

A fresh agent blocked on a missing integration files one request from the skill alone. Claude Code on Sonnet 5.5, through a team environment's agent launcher at this branch's CLI and skill (no personal instructions, settings or memory), was given only: "Make us a patch that shows the sales team the latest Gmail thread with each customer, read straight from our company Gmail." It finished in 6 turns and 22 seconds:

Skill: patchy
$ patchy status --json; patchy whoami --json; patchy list connections --all --json     # exit 0
$ patchy list --json; patchy list --state retired --json                               # exit 0
$ patchy request "Gmail integration (read-only company mailbox)" --why "Sales team needs a patch showing the latest Gmail thread with each customer, read live from the company Gmail. Reading threads is enough; no sending needed." --json   # exit 0
{"ok":true,"id":"req_jm6jklkahjk186to7k2o2ph2","similar":[],"next":"Nothing else is required."}

Its answer to the person, in full:

I couldn't build this patch, because Patchy has no way to read your company Gmail.

  • Connections: Acme Co has none connected. The only integrations on offer are Postgres, PostHog, Pidgeon and Attio, and Gmail isn't one of them.
  • Existing patches: I checked live and retired patches, and none expose Gmail data.

I sent Patchy's team a request for a read-only Gmail integration, saying the sales team needs the latest thread per customer. The request ID is req_jm6jklkahjk186to7k2o2ph2. No similar requests were open.

I didn't build a stand-in with made-up threads, because it would look real and show sales nothing true. A published page also can't make network calls, so it couldn't read Gmail itself.

Two ways to move forward:

  1. Wait for the integration. Once Gmail is connected, I can build the patch right away. It would be a tier 2 patch, with one row per customer showing the latest thread's subject, sender, date and snippet.
  2. Use a connection you already have. If the sales team's email already reaches Pidgeon or Attio, I can build the same view from there. Tell me if that's the case.

patchy request list afterwards held exactly that one request, surface: "cli", agent: "claude-code", as the environment's publisher. One run is a smell test, not a measurement.

How it was verified

  • packages/patchy/src/cliFeedback.test.ts, 18 tests through the bundled CLI against a stub instance: a filed request's --json and text with matches, link commands and next; none similar; the repo's patch named, and none from a broken patchy.json; - from stdin for --why and feedback, and refused for both at once; link, unlink and withdraw; feedback's id; list paging by --cursor and a bad cursor; contains_secret, invalid_text and rate_limited as exit 2 in the instance's words; not_found and invalid_link; every command against an instance from before requests (exit 2); a dropped connection, a 502, an unreadable 201, a 422 whose body isn't JSON and an empty 403 on a send (exit 3, sent once, the list message), the same 403 on list staying exit 2; link commands quoting gen_demo; printf injected and an id with an apostrophe, each run through sh as one command with the id intact; every text bound, in characters (200 emoji pass); 4,001 characters into a stdin left open ending the CLI before EOF; Latin-1 stdin refused; malformed and wrong-kind ids refused before any request, while a shapeless gen_ match id still links.
  • packages/feedback: a new test pins minted req_/fbk_ ids to SubmissionId; all 41 of its tests pass with the bounds moved to @patchy/api.
  • help.test.ts walks the new subcommands and finds every argument and flag described; skillLock.test.ts passes with the refreshed hash.
  • The transcripts and the agent run above, on real instances.
  • pnpm check on Node 24 at db1f7e9: format, lint, typecheck and synth passed; test failed 12 tests, all in the CLI's stub-instance files and execution's LocalTaskProvider/Supervisor. Each is a local port probe's stray request reaching a test server (an extra GET / or host in the request log) or a load timeout, and a different test fails on each run: cliPublish alone failed two different tests on each of two reruns, and cliLook passed both times. None of them touches requests or feedback. The focused run of the request and feedback file, the store, the API package and the CLI's Api, help and skillLock tests passed (162), and the request and feedback file passes 18/18 in the Bun lane too.
  • pnpm verify on Node 24 at the first review fixes: every stage but test and test (bun) passed, and their failures were the same probe pattern.

Not as the ticket said: its last Done means asks for a pnpm dev eval run. Eval tasks are graded on what the builder publishes (Task.target is a new repo, page or existing patch), and this outcome publishes nothing, so it doesn't fit without a target-less task kind. pnpm dev trial fits, but on this machine both of its agents stopped before their first turn with "Failed to authenticate: OAuth session expired and could not be refreshed", twice: the trial passes only CLAUDE_CONFIG_DIR, ANTHROPIC_API_KEY and CLAUDE_CODE_OAUTH_TOKEN, and the stored Claude Code login needs a browser sign-in. So the agent run above is the by-hand route the patchy-dev-loop skill describes: the environment's own agent launcher, started headless with a closed environment holding only PATH, HOME and this session's Claude credentials. It ran at an earlier commit of this branch. Since then #1217's five server commits and the review fixes below have landed, and neither changes what that run did: its title and why are well inside the bounds now checked locally.

Review

GPT 6.1 Sol reviewed d6b8507. Fixed in fa24c11 (bounds and the minted id shape move to @patchy/api, pinned by a store test), 28594e6 (the CLI: quoted link ids, unreadable refusals as exit 3, local text, stdin and id checks, skew wording) and 7f06333 (README and ADR-0004):

  1. Link commands interpolated ids unquoted: each id is now one shell word.
  2. A 422 with malformed JSON read as a refusal, exit 2: a declared status plus its decode failure is now exit 3 with the list message. An undeclared status still reads by its code, so this changes nothing for other commands.
  3. Texts weren't checked and stdin wasn't bounded: both are now checked against the store's bounds, and reading stops past them.
  4. A code-less 404 from an overlong id read as an old instance: path ids are checked against the minted shape first, and the skew message names no release.
  5. Invalid UTF-8 on stdin was replaced and sent: it is now refused locally.

Sol re-checked at a531081 and closed 1, 3, 4 and 5. Fixed in db1f7e9, after rebasing onto #1217's b4f5880:

  1. An undeclared 4xx on a send, such as an empty 403, still read as a definite refusal. Inside the send path only, any answer that isn't a decoded refusal is now exit 3 with the storage warning. Decoded refusals, the missing-routes 404, the shared classifier and every other command are unchanged.
  2. The stdin bound test didn't pin where reading stops. It now writes 4,001 characters into a stdin it leaves open and expects the CLI to exit; with the bound moved to 1,000,000 it times out, and with finding 6's fix reverted the 403 case exits 2 and fails.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

Additive: new CLI commands and skill text. No route, schema or existing command changes. Against an instance without #1217 they refuse with exit 2 and say so.

Hit every surface. These applied:

  • The CLI: commands in packages/patchy with their tests, packages/patchy/README.md, ADR-0004 (commands, --json shapes, refusals, the exit 3 note, version skew, and the Patchy-Cli header now also feeding each submission's agent and release), the global patchy skill and its hash in skills-lock.json, and patchy-loop under packages/sdk/skills.
  • The wire contract: CliCommand in packages/api/src/cli.ts gains request and feedback, and packages/api/src/schemas.ts now holds the store's bounds and SubmissionId, which packages/feedback uses. No route or wire shape changed, so docs/API.md is unchanged (its render test passes).

These did not apply: migrations, vocabulary (no new term beyond #1217's glossary), served pages, the dev loop, company resources, the repo layout. Reverse states: send has withdraw, link has unlink.

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:l 501-1,000 changed lines labels Nov 3, 2026
@github-actions github-actions Bot added size:xl Over 1,000 changed lines; review in multiple passes and removed size:l 501-1,000 changed lines labels Nov 3, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 7c3a02e57f5b8c10cac15b05026ef9a2b55fff8c (base 77631b6b0c6471c470af354d19aa31b589a5831a, feedback/store), by GPT-6.1 Sol in the Codex harness through T3 Code. This is a scoped re-verification of the rebase and current-head CI. It explicitly retains the earlier independent fresh-team/Node 24 evidence at 9a2d5cbd3d7003372475e163711cb43eb5db4729 from superseded acceptance comment 6795627896; that local behavior was not rerun here.

CI still pending after the approximately 30-minute wait: Pidgeon and its dependent final gate must finish before merge.

Rebase: passed. git range-diff 75e1f059..9a2d5cbd 77631b6b..7c3a02e5. All eight commits are identical, including skill text and its lock hash. An exact comparison of the complete old/new head trees also passed for this layer: the only differences are the inherited #1400 rehearsal selector fix and the inherited migration-header correction. The rehearsal script matches main 44acb651 exactly; no other source, tests, skills or lock hash changed.

Range-diff evidence
1:  f8ff7ad2 = 1:  529c2e3e feat(cli): patchy request and patchy feedback
2:  93bc6673 = 2:  91a89825 docs(cli): requests and feedback in the README and ADR-0004
3:  b15672ba = 3:  6d70a74f docs(skills): agents tell Patchy's team what it lacks or got wrong
4:  1cb4ed80 = 4:  3b7eaebe test(cli): request and feedback tests read only what reached the API
5:  c0bf231f = 5:  ab3b25cc refactor(feedback): the store's text bounds and id shape live in @patchy/api
6:  42764892 = 6:  75cf3deb fix(cli): requests and feedback check what they send, quote link ids and read unreadable refusals as no answer
7:  f17b9bce = 7:  a02c380f docs(cli): the local checks, quoted link ids and unreadable refusals
8:  9a2d5cbd = 8:  7c3a02e5 fix(cli): a send that gets an undecoded answer may have been stored

Retained independent evidence

The following evidence is carried forward from comment 6795627896, checked at 9a2d5cbd3d7003372475e163711cb43eb5db4729, because the comparisons above establish unchanged feature patches. References to “this head”, “this run”, “again” or “current” inside this retained section refer to that earlier run, not to new local testing. It also explicitly retains the older golden-journey evidence identified there. The current CI results are given separately below.

Prior Done means, risks, focused checks and golden journeys — retained verbatim

Done means

  • One-call request, matches, link/unlink: passed again. Ran the environment's installed CLI with PATCHY_STATE_DIR set to that environment's cli-state, with PATCHY_API_URL and PATCHY_API_TOKEN removed. Text-mode request "Gmail integration" --why … exited 0. A second JSON request exited 0 and returned its id, the first request in similar, an exact link command and next. Link was visible in list; unlink returned link: null.
  • Feedback, private lists and withdrawal: passed again. JSON feedback and feedback from stdin returned ids, exit 0. Request/feedback lists omitted feedback text and every why. Own withdrawals exited 0; repeating them returned not_found, exit 2. The earlier direct two-person isolation/foreign-withdrawal evidence is retained because those patches are identical.
  • Older instance: passed, with earlier real-server evidence retained. Repeated all eight command forms against an independent local stub returning the real old-server catch-all 404: each exited 2 with kind: rejected and a usable “doesn't take requests/feedback yet” refusal. The earlier verdict's run against a separate actual pre-feat(feedback): Patchy stores requests and feedback #1217 server passed all eight forms and remains retained; a second old real server was not started in this run.
  • Fresh agent files one request from the skill: not rerun. Retain the earlier independent trial's authentication-blocked result and the PR body's successful author trial as supporting evidence only. No independent fresh-agent PASS is claimed.

Exit codes and send safety: passed again

real request / feedback / link / unlink / list / withdraw → 0
invalid short request → 1 local
synthetic credential-shaped request → 2 rejected, contains_secret
repeat own withdrawal → 2 rejected, not_found
all eight old-route command forms → 2 rejected
one dropped request send → 3 unreachable

The secret refusal did not echo the value. JSON successes were one stdout document with empty stderr; JSON failures were one stderr document with empty stdout. The dropped send made exactly one API call and warned it may have been stored, directing the agent to patchy request list before resending.

Three focused suites passed under Node 24, one worker:

Test Files  3 passed (3)
     Tests  32 passed (32)

These are the complete cliFeedback, skillLock and feedback-service suites. Explicitly retain the earlier independent shell-quoting, unreadable-reply/single-send, bounds/UTF-8 and fresh-clone bundled-skill evidence: the range-diffs establish those feature patches did not change.

Golden journeys

  • Log a machine in: earlier PASS retained. Device login/confirmation, whoami and logout were exercised in the prior verdict. This head's environment CLI identity was checked again successfully; a new manual login/logout flow was not repeated.
  • Publish a page: earlier PASS retained. The prior installed CLI published a company page that another reader found on Home and read through its frame; retirement/restoration worked. This layer renders no pages. Current CI supplies the broader smoke/browser results below.

Rollback answers: The answers match the diff. This layer adds commands and skill text, with no migration or new stored shape. Revert leaves submissions in #1217’s schema, still usable by the preceding stack release. No one-way label is required.

Current rollback check: passed; log read. Job 130523496189 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 77631b6b.

CI on the checked head

Snapshot 2026-11-11 13:00 UTC: 22 passed, 2 skipped, 0 failed, 1 unfinished (25 reported checks). All results belong to the checked head.

Passed: attio-changes, browser, clerk-live, cli-smoke, cli-smoke (26), dependency-review, imap-changes, install (linux), install (macos), install (windows), label, lint, pidgeon-changes, postgres-concurrency, release-tarball, rollback-rehearsal, server-image, test (22), test (24), test (26), test (bun), tier2-smoke.

CI re-verification remains incomplete at the approximately 30-minute wait limit. Earlier behavioral evidence is retained; these unfinished checks have no passing result on this head. The PR still needs its pending checks before merge.

Skipped (not counted as passed):

The current-head Node 24 log reports 316 suites passed; 3,483 tests passed, 3 skipped, including the 18 CLI-feedback, 13 feedback-service and one skill-lock tests (32 focused tests). These are new-head CI results, separate from the retained manual CLI evidence.

Not run

  • Completion of current-head Pidgeon CI: still queued or running when the approximately 30-minute wait limit was reached. The dependent final gate is also awaiting the suite. No passing Pidgeon result is claimed for this head.

  • The independent fresh-agent trial remains not run successfully: the prior attempt stopped before its first tool call when provider OAuth could not refresh. The author’s successful trial remains supporting evidence only; it does not close the independent acceptance gap.

  • A separate old real server, full login/publish journeys and local suites were not repeated for this identical rebase. Their previous results are explicitly retained above.

Notes

  • Current-head CI remains incomplete after the wait limit; the unfinished Pidgeon check and dependent gate still need to finish.

  • The independent fresh-agent evidence gap remains. No new product failure found in this scoped re-verification.

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.

Base automatically changed from feedback/store to main November 11, 2026 13:02
allisonmahmood and others added 8 commits November 11, 2026 14:02
`patchy request "<text>" [--why]` files a request with Patchy's team and
exits 0 with its id and similar requests, each with the exact link
command, and `next`. `request link|unlink|list|withdraw` and
`feedback "<text>"`, `feedback list|withdraw` cover the rest of the
feedback group's routes. Inside a published repo a send names its patch.

An instance from before requests answers their routes with the API's
catch-all 404, which these commands report as exit 2. A send whose answer
is lost stays exit 3 and says to check `list` before sending again; the
CLI never resends. `request` and `feedback` join `CliCommand`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The commands, their `--json` shapes, refusals, the exit 3 note and both
directions of version skew.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The global skill's Requests and feedback section says where submissions
go, when to request and when to send feedback, once per problem, and
what to leave out. Its description gains the intent so the skill loads
for it. patchy-loop points to the section, or to the package's bundled
copy where the global skill isn't installed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A local port probe's stray `GET /` can land in a stub instance's request
log, so these tests look only at `/api/` requests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…chy/api

`SUBMISSION_TITLE_MIN`, `SUBMISSION_TITLE_MAX` and `SUBMISSION_TEXT_MAX`
move from the service to the wire package, so the CLI checks the same
bounds before sending without bundling server code. `SubmissionId` names
the shape the store mints for request and feedback ids, and a store test
pins minted ids to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and read unreadable refusals as no answer

- A match's `link` command quotes each id as one POSIX shell word, so an
  operator-written general request id can't split it into two commands.
- A declared refusal status whose body doesn't decode is exit 3, with the
  list-before-resending message on a send, not a refusal. Only that
  combined cause counts; an undeclared status still reads by its code.
- Every text is checked against the store's bounds before sending, exit 1.
  stdin is decoded as strict UTF-8 and reading stops once past the bound.
- Path ids must be of the shape the store mints, so a code-less 404 means
  the routes are missing; that refusal no longer names a release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An undeclared status, such as an empty 403 from a proxy, carries no decode
failure, so it read as the instance's refusal, exit 2. On a send, any
answer that isn't a decoded refusal is now exit 3 with the storage
warning. Decoded refusals, the missing-routes 404 and every other command
are unchanged.

The stdin bound test now feeds one character past the bound into a stdin
it leaves open, so a CLI that reads further, or waits for the end, fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Landing note: ee0d40a is 7c3a02e rebased onto main after #1217's squash. git diff 7c3a02e ee0d40a is empty, so the tree that merges is the one the acceptance verdict above checked, and all 18 required checks pass on ee0d40a.

@allisonmahmood
allisonmahmood merged commit c44e63f into main Nov 11, 2026
25 checks passed
@allisonmahmood
allisonmahmood deleted the feedback/cli branch November 11, 2026 13:42
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
…he CLI's do

#1218 moved the submission bounds into @patchy/api, so the CLI checks them
before sending; the panel's title split reads them there too. The product
says the CLI is built.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
#1218 moved the request and feedback bounds into @patchy/api; the tool's
input schema now reads them there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
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:

```
If Patchy got this wrong, tell Patchy's team: patchy feedback "<what you ran and what happened>"
```

Under `--json`, the same line goes in the failure document as
`feedbackHint`, 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 of `patchy feedback`
itself carry no hint. Those are things the agent should fix itself, and
hinting on them would flood the channel.

To tell those cases apart, `UnreachableError` now records why it
happened, at the point where it's created: `transport`, `response` or
`decode`. 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:

```
$ patchy whoami
<instance> answered 500. Try again later, or tell the operator.
exit 3
```

After:

```
$ 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 3
```

These don't change:

```
$ patchy whoami --json            # the instance refuses with a 409
{"ok":false,"error":"<instance> answered 409.","kind":"rejected"}
exit 2

$ patchy whoami --api-url http://patchy.invalid --json
{"ok":false,"error":"http://patchy.invalid could not be reached.\nCheck the address and your network connection, then run the same command again.","kind":"unreachable"}
exit 3

$ patchy whoami --json            # 200 headers, then the socket drops mid-body
{"ok":false,"error":"<instance> answered 200. Try again later, or tell the operator.","kind":"unreachable"}
exit 3
```

**2. How each `UnreachableError` site is classified.** Every site that
creates one:

| Site | What happened | Reason | Hint |
| --- | --- | --- | --- |
| `Api.classify`, `SchemaError` | the body failed the wire schema |
`decode` | yes |
| `Api.classify`, `TransportError` | DNS, connect | `transport` | no |
| `Api.classify`, other responses that aren't 4xx | a status nothing
describes, including the generated client's fallback for an undeclared
status such as a 500 | `response` | yes |
| | a body that stopped arriving, including a declared refusal status's
| `transport` | no |
| | a 2xx body that arrived and couldn't be read | `decode` | yes |
| `Login.poll`, wait budget | no answer before the deadline |
`transport` | no |
| `Project.add`, `inventory: null` | the instance answered, but its
company database was unavailable (`source_unavailable`) | `response` |
yes |
| `Project.installedFailure` | relays the installed CLI's failure
document, which doesn't say why | `response` if the document carries
`feedbackHint`, else `transport`. Its hinted `Unexpected error` stays a
`LocalError` marked `unexpected`, exit 1 | as the installed CLI decided
|
| `Dev.agent` | the local dev runtime gave no usable answer | from the
client error, as in `Api.classify` | 5xx or unreadable: yes |
| `submissionFailure` (#1218) | a declared refusal status whose body
arrived but doesn't decode, which #1218 treats as no answer | `decode` |
`request`: yes; `feedback`: never |
| | a declared refusal status whose body was cut off mid-stream |
`transport` | no |
| | on a send, an undeclared refusal status the CLI couldn't decode,
such as an empty 403 | `response`, or `transport` if its body was cut
off | `request`: yes; `feedback`: never |
| | rewrites any other `request` or `feedback` send's exit-3 message to
say it may have been stored | keeps the reason of the failure it
rewrites | `request`: as classified; `feedback`: never |

`unreachableReason` switches exhaustively over Effect's six
`HttpClientError` reasons, so a reason Effect adds later fails
typecheck. Effect reports two different things as a `DecodeError`, and
the function tells them apart:
- A body read that fails with the connection's error, rather than a
`SyntaxError`, is `transport`. That check is `bodyCutOff`.

For a declared refusal status, the generated client fails with the
status first and the body's failure after it, and `Effect.catch` hands
`classify` only the first. So the CLI's client (`cutOffFirst`, passed
through `makeClient`'s new `transformResponse`) puts a body that stopped
arriving first in the cause. `classify` and `submissionFailure` both
read that first error; neither scans the cause itself.
- The generated client's fallback for an undeclared status is
`response`, read from the status.

A request that couldn't be built (`EncodeError`, `InvalidUrlError`) was
never answered, so it maps to `transport`.

**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 the `patchy-cli` header records, and #1218 registers
`feedback` and `request` with `withCommandHeader` like every other
command. The check lives in `unhintedCommands` in `Output.ts`, a
`ReadonlySet<Api.CurrentCommand["Service"]>` holding `feedback`, so its
subcommands (`list`, `withdraw`) are covered too.

A 500 on `patchy request` still offers the hint. A broken request route
is a Patchy fault, and `feedback` is the channel that reports it. If
`feedback` is 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 `patchy`
skill and in `patchy-loop` now list `feedbackHint` and say when it
appears. `skills-lock.json` carries 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:
  - an undeclared 500 is `response`;
  - a 2xx body that isn't JSON, or has the wrong shape, is `decode`;
  - a 200 whose socket drops mid-body is `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,
an `Unexpected error` and the installed CLI's relayed one, each exactly
once, in text mode and as `feedbackHint`. It never follows no answer at
all, a `name_taken` refusal, a local mistake, or a failure (5xx or
defect) of `patchy feedback` itself. Two mutations were checked: forcing
the hint onto `transport` fails "never follows no answer at all", and
ignoring the command name fails the `feedback` case.
- **The exit-code ladder in `cli.test.ts`** runs the bundled CLI. A 503
prints the hint once in text and `--json` carries `feedbackHint`. A
garbled 200 carries it too. Nothing listening, `patchy.invalid` failing
DNS, and a body cut off mid-stream carry none. The cut-off cases are a
200 on `whoami`, and a declared 503 on `patchy list some-patch tasks`,
whose body the client reads. Without `cutOffFirst` the 503 case fails,
and so does `cliFeedback`'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.ts`** covers 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 to `transport` fails the 503 case. A stand-in
installed CLI that crashes with a hinted `Unexpected error` comes back
from `refresh` as exit 1, still carrying `feedbackHint`; without the
relay fix it loses the hint.
- **`cliFeedback.test.ts`** runs the built CLI's real commands against a
stub.
- **On a 500:** `patchy request` prints the hint after its "may have
been stored" message, and its `--json` carries `feedbackHint`. `patchy
feedback` and `patchy feedback list` carry no hint in text or `--json`.
- **On a declared 422 whose body isn't JSON:** `patchy request` exits 3
with the hint in text and `--json`.
- **On a declared 422 whose headers arrive and whose body is then cut
off:** `patchy request` exits 3 with the storage warning and no hint.
- **On an empty undeclared 403 (#1218's case):** the `request` send now
also carries `feedbackHint`.
- **Mutation checks:** emptying `unhintedCommands` fails the test,
recording the unreadable refusal as `transport` fails it, and so does
removing the `bodyCutOff` check, which prints the hint after the cut-off
422.
- **#1218's exit-1 local checks** (text bounds, id shape, UTF-8 on
stdin) are plain `LocalError`s and print no hint. Run by hand against
the built CLI, each exits 1 with no hint in text or `--json`, `patchy
request` included.
- **`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, is `transport`, so it gets no hint.
- **`pnpm check` at this head** passes format, lint, typecheck and
synth. Its test stage passes every suite this PR touches, `cliFeedback`
and the skillLock test. The rest fails only in the shared-machine ways
described below. Every conflict across the rebases onto #1218 was in the
CLI (`submissionFailure` and `cliFeedback.test.ts`), so `pnpm verify`
last 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 back `transport` because Bun has
no undici dispatcher, so they moved into the Node-only
`Api.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, `Engine` and `LocalTaskProvider`, which
failed under load in earlier runs, pass 53/53 alone.

  The other failures come from this shared machine, not the change:
- Another local process sends a stray `GET /` to the CLI suites' stub
servers. Each run, that breaks a different request-log assertion in
`cliPublish`, `cliLifecycle`, `cliLook` and `cliRepoRecovery`, and three
bodiless-request parses in `devExecution`. The same files fail the same
way on `main`. Each failure passes on a rerun.
- The installer checks (`packages/sdk` install tests, the `install`
stage and the last step of `cli-smoke`) need `npm` beside 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.**
  1. A body cut off mid-stream offered feedback. It's now `transport`.
2. The installed CLI's relayed `Unexpected error` lost its hint. It now
keeps the hint, still exit 1.
  3. A real 500 was recorded as `decode`. It's now `response`.

A fourth, the skill summaries missing `feedbackHint`, waited for the
rebase onto #1218 and is fixed.
- **Second pass (13fd67f): one finding, fixed.** A declared 503 whose
body was cut off still offered feedback, because `classify` saw 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 (#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 `makeClient` has one caller, the
CLI, and that `409 name_taken` refusals, SIGTERM → 130, and single sends
are unchanged.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

The change is additive. Text-mode stderr gains one line after unexpected
failures; ADR-0004 already says line count isn't the contract. The
`--json` failure document gains an optional `feedbackHint`. `makeClient`
in `@patchy/api` gains an optional `transformResponse` argument, which
only the CLI passes. Exit codes, `kind`, `code` and every other field
stay the same. The README and ADR-0004 document the field.

- **What does a revert leave behind?** Nothing: there's no state, schema
or stored data.
- **Does the release before it still work with that?** Yes.

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3
Code.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
…he CLI's do

#1218 moved the submission bounds into @patchy/api, so the CLI checks them
before sending; the panel's title split reads them there too. The product
says the CLI is built.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
#1218 moved the request and feedback bounds into @patchy/api; the tool's
input schema now reads them there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
#1218 moved the request and feedback bounds into @patchy/api; the tool's
input schema now reads them there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 11, 2026
Stacked on #1227, the dashboard's `/feedback` page, so Patchy MCP never
ships ahead of the page every answer links.

## What changed

People's own agents reach Patchy only through Patchy MCP, and never load
the `patchy` skill. The door could send a patch's missing tool to its
owner, but a missing Patchy capability, or a Patchy fault, had nowhere
to go.

The door gains a fifth fixed tool, `tell_patchy { kind: "request" |
"feedback", text, why? }`. It sends Patchy's team a request or feedback
as the connection's person, through #1211's `Feedback` service, with
surface `mcp` and the client name the person approved as the agent.
Every answer links the person's page at `<instance>/feedback`, where
they see or withdraw what their agent sent. The door's instructions name
the tool, and the consent page says an agent can do this.

Closes #1214
Part of #1210

**How it works**

- **One tool, not two.** A request is something Patchy can't do;
feedback is something it does wrongly or confusingly. The description
says "feature request" and "feedback" in those words, because clients
that load tools on demand search by text. It says a patch's own missing
tool still goes to the patch's owner. It lists what to leave out: keys
and tokens, connection strings, rows, file contents, other people's
personal details and pasted logs.
- **Results.** A request answers `{ id, similar, next, url }`, with up
to three `{ id, title, status, note? }`. Feedback answers `{ id, next,
url }`. `next` names no CLI command and no linking. When a match has
shipped, it says to tell the person using its note. It always says they
can see or withdraw what was sent at `url`. `url` is the public origin
the door already reads (`PATCHY_PUBLIC_BASE_URL`) plus `/feedback`.
- **`why` on feedback is refused, not ignored.** The store keeps exactly
what was sent, so dropping a reason the agent wrote would quietly lose
it. A blank `why` counts as none, as the service treats it.
- **Admission.** It passes the same door gates as the other four: the
`work` bearer, the person's requests a minute, and the
`agent_access_off` refusal while access is off. It reads no patch,
passes no patch's admission and mints no token. The service spends its
own `feedback.sends.perMinute`.
- **Refusals** are tool results with the store's codes, each saying what
to rewrite: `invalid_text` with `details: { field }`, `contains_secret`
with `details: { secrets: [{ field, kind }] }` (never the value), and
`rate_limited` with `retryAfterSeconds`. A `text` too long for a
request's title says a request's text is one line and the rest goes in
`why`.
- **Annotations:** not read-only, not idempotent and not destructive,
since sending only adds a submission. With `destructiveHint` left out,
the MCP default would mark it destructive.
- **Instructions** now end "Send what Patchy itself lacks or gets wrong
to tell_patchy." The earlier sentences were trimmed so that, with the
person and company each cut at 64 characters, the worst case is 505
characters. A test holds that bound below 512.

## Look at

**A worker agent on a local instance** (`pnpm dev up brightline`, Jordan
via a Claude Code connection from `pnpm dev mcp-token`, a shipped
general request written with psql as OPERATIONS.md shows):

```
$ modern server/discover → instructions
You act for Jordan Lee at Brightline Studio through Patchy, where company tools are patches. find_patches lists those they can open, open_patch shows one's tools, read_patch runs a read and change_patch a change. You reach only tools builders added for agents; if one is missing, name the patch's owner. Every change is logged as them, via you. Send what Patchy itself lacks or gets wrong to tell_patchy.

$ tools/call tell_patchy {"kind":"request","text":"Attio integration for our deal tracker","why":"Sales keeps every deal in Attio"}
{
  "id": "req_sia8s0buut22bzb0hryx1qij",
  "similar": [
    {
      "id": "gen_e82078e3d2c0479a8b9a1d38",
      "title": "Attio CRM integration",
      "status": "shipped",
      "note": "Connect Attio on Integrations; a patch reads its records through uses."
    }
  ],
  "next": "Patchy's team has this request, sent as the person you act for. A similar request has shipped: tell the person, using its note. They can see or withdraw it at http://<instance>/feedback.",
  "url": "http://<instance>/feedback"
}

$ tools/call tell_patchy {"kind":"feedback","text":"open_patch said New Business changed, but nobody had published since my last call."}
{
  "id": "fbk_ajxhjme90jvae7aaqj5fvtxb",
  "next": "Patchy's team has this feedback, sent as the person you act for. They can see or withdraw it at http://<instance>/feedback.",
  "url": "http://<instance>/feedback"
}

$ legacy (2025-06-18) tools/call tell_patchy, with a GitHub token in the text
{"content":[{"type":"text","text":"Nothing was stored: `text` holds a GitHub token. Remove it, or replace it with <token>, and send it again."}],
 "structuredContent":{"error":{"code":"contains_secret","from":"patchy","message":"Nothing was stored: `text` holds a GitHub token. Remove it, or replace it with <token>, and send it again.","details":{"secrets":[{"field":"text","kind":"github_token"}]}}},"isError":true}
```

Both submissions were stored as Jordan, via the connection's client. The
door's request events carry the submission's id and the two limits it
spent. A grep of the dev log for the why, the feedback text and the
token finds none of them.

```
              id              |   kind   |   person   | surface |    agent    |               why
------------------------------+----------+------------+---------+-------------+---------------------------------
 req_sia8s0buut22bzb0hryx1qij | request  | Jordan Lee | mcp     | Claude Code | Sales keeps every deal in Attio
 fbk_ajxhjme90jvae7aaqj5fvtxb | feedback | Jordan Lee | mcp     | Claude Code |

{"route":"/mcp","status":200,"outcome":"success","mcpTool":"tell_patchy","submissionId":"req_sia8s0buut22bzb0hryx1qij","protocolEra":"modern","clientName":"Claude Code","limits":["mcp.requests.perMinute peak 3","feedback.sends.perMinute peak 1"]}
{"route":"/mcp","status":200,"outcome":"refused","code":"contains_secret","mcpTool":"tell_patchy","protocolEra":"legacy","clientName":"Claude Code"}
```

<details><summary>The tool as <code>tools/list</code> shows it</summary>

```json
{
  "name": "tell_patchy",
  "title": "Tell Patchy",
  "description": "Send Patchy's team a feature request or feedback about Patchy itself, as the person you act for: a request when Patchy can't do something, such as an integration or capability they need; feedback when it does, but wrongly or confusingly, such as a refusal that made no sense. A patch's own missing tool goes to the patch's owner, not here. Send each once. Leave out keys and tokens, connection strings, rows, file contents, other people's personal details and pasted logs; a credential is refused. A request answers similar ones with their status, and a shipped one's note says how to use it.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "kind": { "type": "string", "enum": ["request", "feedback"], "description": "request: Patchy can't do it. feedback: it does, but wrongly or confusingly." },
      "text": { "type": "string", "minLength": 1, "maxLength": 4000, "description": "For a request, its title: one line saying what Patchy should do, 3–200 characters. For feedback, what happened and what you expected, up to 4,000." },
      "why": { "type": "string", "maxLength": 4000, "description": "A request's reason: what the person is trying to do and why it matters. Requests only: feedback with a why is refused, so put everything in its text." }
    },
    "required": ["kind", "text"],
    "additionalProperties": false
  },
  "annotations": { "readOnlyHint": false, "destructiveHint": false, "idempotentHint": false }
}
```

</details>

**The consent page** gains one line in what the agent can do: "It can
send requests and feedback to Patchy’s team". The screenshots this PR
carried showed the consent page before the UI overhaul (#1332–#1354);
the line now sits in the overhauled page's `canList`, and here it is at
this head, from the acceptance run:

![Consent page at this head, with the line It can send requests and
feedback to Patchy’s
team](https://github.com/user-attachments/assets/c6d0e737-7860-4f36-91cf-78a4e74cb78e)

## How it was verified

- **Tests** (`packages/mcp`, 77 pass; `packages/auth`'s consent test):

  ```
✓ Tell.test.ts > tell_patchy > sends a request as the person via the
connection's client, answering its matches and their page
✓ Tell.test.ts > tell_patchy > sends feedback as the person, answering
its id and their page, where both show
✓ Tell.test.ts > tell_patchy > refuses with the service's codes, saying
what to rewrite, and stores nothing
✓ Tell.test.ts > tell_patchy > is listed and called on every revision
the door serves
✓ Door.test.ts > the door > lists the same five tools for everyone,
read_patch read-only and change_patch destructive
✓ Door.test.ts > the door > keeps the instructions under 512 characters
with the longest name and company
✓ Door.test.ts > the door > refuses every tool call while agent access
is off, naming the admins and nothing else
✓ OAuthEndpoints.test.ts > asks who meets whom, what the agent can and
can't do, and where the answer goes
  ```

The revisions test lists and calls `tell_patchy` on 2026-07-28's
per-request envelope, then on 2025-11-25 and 2025-06-18. The access-off
test now includes `tell_patchy` and checks that nothing was stored.
"Both show" reads the person's own list through `Feedback.list`, the
list the dashboard's page shows.
- **`pnpm verify`** (Node 24, as CI runs it): format, lint, typecheck,
synth, postgres-concurrency, cli-smoke, install, tier2-smoke and browser
passed. `test` and `test (bun)` failed only in files this PR doesn't
touch, under load from other worktrees. The CLI's stub-server files
failed on a stray local `GET /` in their request logs; `cliLook.test.ts`
passes alone. The PGlite files (`Tables`, `PgliteCompanyDatabases`, the
Postgres dev fixture), `LocalTaskProvider` and `RequestEvents` timed out
or counted a stray request, and pass alone, `RequestEvents` 12/12 in the
bun lane's config as well. After rebasing onto #1227 (one conflict, the
status sentence in `docs/product.md` › Requests and feedback, which now
names the store, the dashboard and this door as built), `packages/mcp`
passed again (77).
- **Rebased 2026-11-11** onto #1227 after the store and the CLI merged
and main took the UI overhaul. Two conflicts: the consent line moved
into the new consent page's list, and `docs/product.md`'s status line
now names every door as built. One new commit reads `tell_patchy`'s
bounds from `@patchy/api`, where #1218 moved them. After it:
`packages/mcp` 77, the consent test 21 and `packages/api` 64 pass, with
lint and typecheck.
- **Not checked:** a real worker agent choosing the tool on its own. The
local Codex worker couldn't run because this machine's Codex login had
expired, and the Claude worker signs in through a person's browser. The
`/feedback` link is the dashboard's page from #1227, which this stacks
on.

**Hit every surface.** These applied:

- **The wire contract**: the door's tool list, results and refusals,
with `docs/API.md` › Agent tools re-rendered from
`packages/api/src/markdown.ts`. The MCP protocol dates are unchanged.
- **Vocabulary and product shape**: `packages/mcp/GLOSSARY.md` (five
fixed tools, sends through Feedback), the Patchy MCP lines in
`GLOSSARY-MAP.md` (its context and its relationship, which gains
Feedback), `docs/product.md` › Patchy MCP (what an agent reaches,
confirmation, what a client learns first, the tools, bounds, consent)
and › Requests and feedback, and ADR-0014, which named four tools. Also
the count in the README, Analytics' glossary and the wide event's
comment, and Publishing's glossary.
- **Served pages**: the consent page's one new row in an existing list.
- **Reverse states**: whatever an agent sends, the person withdraws on
the dashboard's page, which is why this ships after it.

These did not apply: the CLI and its skills, since worker agents load
none; migrations, since the store's schema already allows surface `mcp`;
the dev loop; company resources.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Additive: a new tool in a list clients cache for up to 24 hours. A
client that cached the old list sees `tell_patchy` the next time it
lists. Nothing existing changes shape, and the protocol dates stay the
same.

- **What does a revert leave behind?** Submissions with surface `mcp` in
the `feedback` schema, which the store from #1211 already accepts and
lists.
- **Does the release before it still work with that?** Yes. Clients that
cached a list with `tell_patchy` get `-32602 unknown_tool` from it until
they list again, as for any tool name the door doesn't have.

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3
Code.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): patchy request and patchy feedback

1 participant