mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-05 23:06:17 +01:00
<!-- Write all pull request text in Simplified Technical English (ASD-STE100): short sentences, one instruction per sentence, simple approved vocabulary, and the active voice. --> ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The local process sandbox runs agents with a network allowlist > - The sandbox proxy serves CONNECT tunnels on a Unix socket > - A client reset on a CONNECT tunnel emits an error on the client socket > - The client socket has no error listener, so the error is unhandled > - An unhandled error stops the whole server process > - This pull request adds error listeners to the proxy sockets > - The benefit is that a client reset ends only that tunnel, not the server ## Linked Issues or Issue Description Fixes #22394 ## What Changed - The CONNECT handler now listens for errors on the client socket and destroys the upstream socket when an error occurs (`packages/adapter-utils/src/local-process-sandbox.ts`) - The proxy `connection` handler now listens for errors on each accepted socket and destroys that socket when an error occurs - A new regression test resets a client socket on an allowed CONNECT tunnel and on a denied CONNECT request, then confirms the proxy still serves a plain request ## Verification - `vitest run packages/adapter-utils/src/local-process-sandbox.test.ts`: 11 passed, 5 skipped, no unhandled errors - `tsc --noEmit` in `packages/adapter-utils`: clean - Negative control: with only the fix reverted, the new test raises the exact unhandled `read ECONNRESET` error from the issue (`Pipe.onStreamRead`, errno -104); with the fix applied, no unhandled error occurs - The full server typecheck is not run locally because it exceeds local memory; CI is the arbiter for that check - The embedded-Postgres suites self-skip in this sandbox because it runs as root; CI is the arbiter for those suites ## Risks - Low risk. The change adds two error listeners and one regression test. It changes no proxy policy, no allowlist rule, and no public API. - The plain HTTP request path is unchanged. This pull request covers only the CONNECT handler and the `connection` handler named in the issue. ## Model Used - Meta Muse Spark 1.3 ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [ ] I will address all Greptile and reviewer comments before requesting merge Signed-off-by: Josh Cox <joshuacox@users.noreply.github.com> Co-authored-by: Review <review@local>