|
| 1 | +# 020 — WP6: REDESIGN-SMALL #1748 (fake-IP outbound) + #1920 (Computer Use tool-result normalization) |
| 2 | + |
| 3 | +Prior cycle's disposition (000 matrix): both REDESIGN-SMALL — fresh scoped branches, |
| 4 | +close originals with credit, close linked issues. |
| 5 | + |
| 6 | +## Part 1 — #1748 outbound-only Clash fake-IP routing (branch codex/redesign-1748-fakeip) |
| 7 | + |
| 8 | +Already-implemented WIP delta (carried over the WP-V stash, rebased onto 69650fac4): |
| 9 | + |
| 10 | +- src/lib/destination-policy.ts: `resolvePublicAddresses` gains explicit |
| 11 | + `allowBenchmarkAddresses` opt-in. A HOSTNAME answer in 198.18.0.0/15 (IANA |
| 12 | + benchmark = Clash/Surge/Mihomo fake-IP DNS) is accepted without marking the |
| 13 | + destination private. Literal 198.18.x URLs still reject; mixed answers with |
| 14 | + RFC1918 still reject; image/Lab fetch (no opt-in) keeps rejecting — this is |
| 15 | + what avoids the SSRF widening the original PR had. |
| 16 | +- src/lib/provider-outbound.ts: passes `allowBenchmarkAddresses: proxyConfigured` |
| 17 | + — the opt-in arms ONLY when an outbound HTTP(S) proxy is configured, so the |
| 18 | + hostname rides the proxy CONNECT instead of pin-connecting to the fake IP. |
| 19 | +- tests: 5 new cases in tests/destination-policy-resolved.test.ts (opt-in accept, |
| 20 | + no-opt-in reject, mixed reject, literal reject, image-fetch reject) + proxy |
| 21 | + integration cases in tests/provider-outbound.test.ts. |
| 22 | + |
| 23 | +Verify: bun test ./tests/destination-policy-resolved.test.ts ./tests/provider-outbound.test.ts |
| 24 | ++ tsc. PR to dev, close #1748 with credit. |
| 25 | + |
| 26 | +## Part 2 — #1920 Computer Use / node_repl tool-result normalization (branch codex/redesign-1920-toolresult) |
| 27 | + |
| 28 | +Original PR: 867 lines, 5 files, broad compaction layer applied only on the |
| 29 | +EXTERNAL replay text path. Disposition directive: "apply formatted.text at |
| 30 | +native toolResultPart + decode test" — the empty/error normalization must reach |
| 31 | +the NATIVE protobuf path (toolResultContentItems), which the original never |
| 32 | +touched, and the proof is a ConversationStep decode test. |
| 33 | + |
| 34 | +Scoped design (new file src/adapters/cursor/tool-result-normalize.ts, ~60 lines): |
| 35 | + |
| 36 | +- `normalizeCursorToolResultText(text, {toolName, toolNamespace, isError})` |
| 37 | + → `{ text, isError }`: |
| 38 | + - blank/whitespace or "<empty>"-only exec wrapper output on node_repl / |
| 39 | + computer-use tools → actionable "[empty output: …verify application state |
| 40 | + with get_app_state]" + isError=true. |
| 41 | + - known unrecoverable runtime strings (SkyComputerUseError, "sky is not |
| 42 | + defined", "Identifier … has already been declared", "unsupported import in |
| 43 | + exec") → isError=true, append one-line recovery guidance. |
| 44 | + - all other text: unchanged (no screenshot stripping, no AXTree compaction — |
| 45 | + the native path already bounds images by real serialized size at |
| 46 | + toolCallStep, so the original's byte-budget machinery is unnecessary here). |
| 47 | +- Wire-in at protobuf-request.ts: |
| 48 | + - toolResultContentItems(): when parts is undefined (plain text result), run |
| 49 | + the normalizer before creating McpTextContent; when parts exist, normalize |
| 50 | + the JOINED text-only case (pure-text results) — image-bearing results pass |
| 51 | + through untouched. |
| 52 | + - toolResultToText() (external replay text path): reuse the same normalizer so |
| 53 | + both wire shapes agree. |
| 54 | + - isError propagation: toolResultPart() McpSuccess.isError picks up the |
| 55 | + normalized isError. |
| 56 | + - external replay sites that BYPASS toolResultToText (r2 audit): the |
| 57 | + externalModel branch of conversationTurns (~:645-650) builds |
| 58 | + "prefix + contentToText(message.content)" directly and takes its |
| 59 | + "[Tool Error]" prefix from raw message.isError; the root-prompt path (~:243) |
| 60 | + also prefixes from raw isError. Both must consume the normalizer's |
| 61 | + { text, isError } — this is the exact cursor/grok-4.6 repro path of #1866. |
| 62 | +- Decode test (tests/cursor-toolresult-normalize.test.ts): build a |
| 63 | + ConversationStep via the real builder with an empty node_repl result, |
| 64 | + fromBinary-decode it, assert the McpToolResult content text carries the |
| 65 | + normalization marker and isError=true; plus unit rows for each failure state |
| 66 | + and a non-computer-use tool that stays byte-identical. |
| 67 | + |
| 68 | +IN: the two branches above. OUT: screenshot stripping, AXTree compaction, |
| 69 | +request-builder budget markers (original PR scope — deferred with the close). |
| 70 | + |
| 71 | +r2 audit notes folded in: |
| 72 | +- #1748 LOW: the benchmark opt-in arms on global proxyConfigured; if NO_PROXY |
| 73 | + excludes the provider host, Bun bypasses the proxy and direct-connects to the |
| 74 | + fake IP (non-routable benchmark space — not an SSRF widening, but the "rides |
| 75 | + the proxy" claim has this corner). Record as a code comment on the opt-in. |
| 76 | +- #1866 close comment MUST explicitly state the deferred half: oversized |
| 77 | + AX-tree/screenshot text summarization (compaction) is NOT included; only |
| 78 | + empty/error-state normalization ships. The native path bounds images (not |
| 79 | + text) by serialized size. |
| 80 | + |
| 81 | +Close #1920 with credit + directive note; close #1866 when merged. |
| 82 | + |
| 83 | +## Verifiers |
| 84 | + |
| 85 | +- bun test ./tests/destination-policy-resolved.test.ts ./tests/provider-outbound.test.ts (part 1; reads both change targets) |
| 86 | +- bun test ./tests/cursor-toolresult-normalize.test.ts + bun test tests/cursor-*.test.ts glob (part 2) |
| 87 | +- bun run typecheck per branch; PR CI; lidge suite before merge. |
0 commit comments