altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

upstream: provider/security fixes not yet ported

Open devin-ai-integration[bot] opened this issue 1 month ago • 0 comments

Tracking issue for the weekly upstream security/provider fix port. Fork base: OpenCode v1.17.9 (#964, frozen 2026-07-18). Upstream reviewed through v1.19.6 plus upstream dev fixes to 2026-11-25 (dev is now the v2 layout, no packages/opencode). Scope: fixes in packages/opencode/src/{provider,session,tool,mcp,auth,plugin}, packages/core, the server auth/PTY surface and AI SDK provider bumps.

Run 2026-11-25

Base unchanged: still v1.17.9 (#964); no newer full upstream merge. Upstream tags now reach v1.19.6; dev is still v2-only, so fixes were checked against the fork's v1 code by behavior.

Ported

  • [x] anomalyco/opencode#64626: on macOS, read / edit / external_directory / sensitive_write rules match file paths without case, so .OPENCODE/…, Secrets.ENV or .GIT/hooks/… no longer bypass a rule (Security). #1842, closes #1841
  • [x] anomalyco/opencode#60692: LiteLLM context window exceeded errors are classified as context overflow, so the session compacts instead of failing (Other provider). #1844, closes #1843

Already present

  • [x] anomalyco/opencode#65289: descriptive reconnect error when the ChatGPT token refresh fails: fork plugin/codex.ts already throws a 4xx error that points at altimate-code auth login openai

Not applicable

  • [x] anomalyco/opencode#64911: redacts values after service set in CLI logs; the fork has no service command

Still open (not merged)

  • #1425, #1426, #1476, #1477, #1612, #1613, #1615, #1617, #1660, #1661, #1714, #1715, #1842, #1844

Queued (ranked)

  1. [ ] anomalyco/opencode#64692: apply HTTP header/body timeouts to every AI request, not only OpenAI. Hang. Spans many v2 AI SDK files; adapt after #1477 and #1426 land
  2. [ ] anomalyco/opencode#43813: retry raw network_error finish reasons. Retry. Waiting on #1426
  3. [ ] anomalyco/opencode#40707 / #40694 / #43806 / #59816: broaden retryable error patterns, keep exhausted request rate limits retryable (session/retry.ts). Retry. Waiting on #1426
  4. [ ] anomalyco/opencode#41939: retry jitter. Retry. Touches session/retry.ts, which #1426 also changes
  5. [ ] anomalyco/opencode#60694 / #60490 / #61149: MCP stdio framing, wait for MCP servers still starting, mark an invalid-URL server as failed. Hang. v2 code; needs a v1 port in mcp/index.ts
  6. [ ] anomalyco/opencode#64696: open FIFO attachments nonblocking before the regular-file check (cli/cmd/run.ts reads the path directly, so a FIFO can block). Hang
  7. [ ] anomalyco/opencode#63403: accept OAuth callbacks the browser rewrote from 127.0.0.1 to localhost (mcp/oauth-provider.ts registers only 127.0.0.1). Auth
  8. [ ] anomalyco/opencode#64844: classify OpenAI cyber_policy refusals as content-policy errors. OpenAI
  9. [ ] anomalyco/opencode#65292: sanitize undeclared tool names before provider replay. Provider correctness
  10. [ ] anomalyco/opencode#64470: keep ChatGPT sharing safeguards when the token refresh fails. Check against fork plugin/codex.ts
  11. [ ] AI SDK provider bumps: needs a dedicated PR plus a regression run (versions in the 2026-10-14 run)
  12. [ ] anomalyco/opencode#43640: xAI capacity errors retryable. Other provider
  13. [ ] anomalyco/opencode#61496: expand ~ in a local MCP server's cwd. Other
  14. [ ] anomalyco/opencode#63703: shell timeout for automatically backgrounded commands. Other; check against fork tool/bash.ts
  15. [ ] anomalyco/opencode#37124: subagent recursion depth limit. Design-level, note only

Summary

Ported 2: macOS case-insensitive file permission rules (#64626 → #1842) and LiteLLM overflow detection (#60692 → #1844); review requested from @anandgupta42 on both. New tests fail on main and pass with the fixes; packages/opencode typecheck (tsgo --singleThreaded), analyze.ts --markers --strict (pattern fallback) and the tracker-leak check pass. Next: HTTP timeouts for all requests (#64692) and the retry items once #1426 merges; none of the 14 open port PRs has merged yet. Run note: git proxy and Devin's PR tool still fail (403/Unauthorized), so git went direct to github.com and PRs were opened via the REST API.

Written by Devin

Run 2026-11-11

Base unchanged: still v1.17.9. No newer full upstream merge has landed; the last one is #964. Upstream dev is v2-only, so new dev fixes were checked against the fork's v1 code by behavior.

Ported

  • [x] anomalyco/opencode#62270 (fixes #39929 / #59794): cap inline images replayed from history (25 MiB trigger, 15 MiB target, oldest replaced first). Treat request body too large / multimodal data size is too large as context overflow. Also covers upstream follow-up #61391: remote images are never counted or replaced. #1714, closes #1712
  • [x] anomalyco/opencode#50272: Bedrock keeps tool-result images only for Claude, Nova and Llama 4. Other Bedrock models hoist them into a user message instead of failing with doesn't support the image field (Bedrock). #1715, closes #1713

Not applicable

  • [x] Upstream file-download content-type/CSP hardening: targets the v2 packages/server route the fork doesn't ship. The fork's server/instance.ts only serves its embedded UI

Still open (not merged)

  • #1425 (Bedrock), #1426 (stalled requests), #1476, #1477, #1612, #1613, #1615, #1617, #1660, #1661

Queued (ranked)

  1. [ ] anomalyco/opencode#43813: retry raw network_error finish reasons. Retry. Port after #1426 lands
  2. [ ] anomalyco/opencode#40707 / #40694 / #43806: broaden retryable error patterns (session/retry.ts). Retry. Waiting on #1426
  3. [ ] anomalyco/opencode#41939: retry jitter. Retry. Touches session/retry.ts, which #1426 also changes
  4. [ ] anomalyco/opencode#60694 / #60490 / #61149: MCP stdio framing, wait for MCP servers that are still starting, mark an invalid-URL server as failed. Hang. v2 code; check against fork mcp/index.ts
  5. [ ] AI SDK provider bumps: needs a dedicated PR plus a regression run (versions listed in the 2026-10-14 run)
  6. [ ] anomalyco/opencode#60692: LiteLLM context window exceeded overflow pattern (provider/error.ts). Other provider, one-line port. Still missing
  7. [ ] anomalyco/opencode#43640: xAI capacity errors retryable. Other provider
  8. [ ] anomalyco/opencode#61496: expand ~ in a local MCP server's cwd. Other
  9. [ ] anomalyco/opencode#37124: subagent recursion depth limit. Design-level, note only

Summary

Ported 2: bounded history images plus oversized-image overflow (#62270 → #1714) and Bedrock tool-result image hoisting (#50272 → #1715). Review requested from @anandgupta42 on both. New tests fail on main and pass with the fixes. The full bun typecheck passes (13/13, run with --concurrency=1 to avoid OOM). analyze.ts --markers --strict also passes, but with upstream/dev on v2 it checks nothing, so it was re-run against a v1.17.9 mirror (clean). Next: the retry items once #1426 merges, then the MCP hang items. Run note: the git proxy and Devin's PR tool still fail (403/Unauthorized), so git went direct to github.com and PRs were opened via the REST API. 2 tests in tool-result-bigint/session.test.ts (scratch store) fail on clean main.

Written by Devin

Run 2026-11-04

Base unchanged: still v1.17.9. No newer full upstream merge has landed; the last one is #964. There is no upstream tag after v1.19.5. Upstream dev dropped packages/opencode (v2 packages/core/packages/ai), so new dev fixes were checked against the fork's v1 code by behavior.

Ported

  • [x] anomalyco/opencode#59748 + #61701 + #60505: webfetch checks each redirect target against the webfetch rules, rejects URLs with credentials, and matches rules on the normalized URL (security). #1660, closes #1658
  • [x] anomalyco/opencode#45769: drop unsigned Bedrock reasoning before cache points are assigned, so no empty or cache-point-only assistant message is sent (Bedrock). #1661, closes #1659

Not applicable

  • [x] Code Mode fetch redirect/permission fixes (#60502, #59954): the fork doesn't ship Code Mode
  • [x] v2 runner, schedules, image generation and Console skill fixes (#61015, #60660, #59934, #60349, #60256, #61074): features the fork's v1 runtime doesn't have

Still open (not merged)

  • #1425 (Bedrock), #1426 (stalled requests), #1476, #1477, #1612, #1613, #1615, #1617

Queued (ranked)

  1. [ ] anomalyco/opencode#43813: retry raw network_error finish reasons. Retry. Port after #1426 lands
  2. [ ] anomalyco/opencode#40707 / #40694 / #43806: broaden retryable error patterns (session/retry.ts). Retry. Waiting on #1426
  3. [ ] anomalyco/opencode#41939: retry jitter. Retry. Touches session/retry.ts, which #1426 also changes
  4. [ ] anomalyco/opencode#60694 / #60490 / #61149: MCP stdio framing, wait for starting MCP servers, invalid-URL server marked failed. Hang. v2 code; check against fork mcp/index.ts
  5. [ ] anomalyco/opencode#50272: Bedrock tool-result images. Bedrock
  6. [ ] AI SDK provider bumps: needs a dedicated PR plus a regression run (versions listed in the 2026-10-14 run)
  7. [ ] anomalyco/opencode#60692: LiteLLM context window exceeded overflow pattern (provider/error.ts). Other provider, one-line port
  8. [ ] anomalyco/opencode#43640: xAI capacity errors retryable. Other provider
  9. [ ] anomalyco/opencode#61496: expand ~ in a local MCP server's cwd. Other
  10. [ ] anomalyco/opencode#37124: subagent recursion depth limit. Design-level, note only

Summary

Ported 2: webfetch redirect/credential permission checks (#59748/#61701/#60505 → #1660) and the Bedrock unsigned-reasoning filter (#45769 → #1661). Review requested from @anandgupta42 on both. New tests fail on main and pass with the fixes. tsgo (opencode), the pre-push bun typecheck and analyze.ts --markers --strict are clean. Next: the retry items once #1426 merges, then the MCP hang items. Run note: the git proxy and Devin's PR tool still fail (403/Unauthorized), so git went direct to github.com and PRs were opened via the REST API.

Written by Devin

Run 2026-10-28

Base unchanged: still v1.17.9. No newer full upstream merge has landed; the last one is #964.

Ported

  • [x] anomalyco/opencode#58258 + anomalyco/opencode@7b39a338a0: PTY connect ticket bypass decided from the matched route instead of a raw-URL regex, and origin/ticket checked before PTY existence (security). #1615, closes #1614
  • [x] anomalyco/opencode#54936: answer a failed worker RPC request instead of leaving the TUI on a blank screen (e.g. --port already in use) (hang). #1617, closes #1616

Opened from last run's branches

  • [x] anomalyco/opencode#33924: MCP auth status scoped to the configured server URL. #1612, closes #1572
  • [x] anomalyco/opencode#43248: malformed model cost fields count as 0. #1613, closes #1573

Not applicable

  • [x] anomalyco/opencode#54207: interleaved Copilot reasoning_opaque values. The fork doesn't carry the Copilot provider at this base

Still open (not merged)

  • #1425 (Bedrock), #1426 (stalled requests), #1476 (#30022), #1477 (#37770)

Queued (ranked)

  1. [ ] anomalyco/opencode#43813: retry raw network_error finish reasons. Retry. Port after #1426 lands
  2. [ ] anomalyco/opencode#40707 / #40694 / #43806: broaden retryable error patterns (session/retry.ts). Retry. Waiting on #1426
  3. [ ] anomalyco/opencode#41939: retry jitter. Retry
  4. [ ] anomalyco/opencode#45769: drop unsigned Bedrock reasoning before caching. Bedrock. Check against #1425
  5. [ ] anomalyco/opencode#50272: Bedrock tool-result images. Bedrock
  6. [ ] AI SDK provider bumps: needs a dedicated PR plus a regression run (versions listed in the 2026-10-14 run)
  7. [ ] anomalyco/opencode#43640: xAI capacity errors retryable. Other provider
  8. [ ] anomalyco/opencode#37124: subagent recursion depth limit. Design-level, note only

Summary

Ported 2: PTY connect route authorization (#58258 → #1615) and the failed-RPC TUI hang (#54936 → #1617); also opened last run's MCP auth (#1612) and malformed-cost (#1613) PRs. Review requested from @anandgupta42 on all four. New tests fail on main and pass with the fixes; tsgo (opencode, server) and analyze.ts --markers --strict are clean locally. Next: #43813 and the retry patterns once #1426 merges, then the Bedrock items. Run note: git proxy still 403s, so branches were pushed via the GitHub REST API.

Written by Devin

Run 2026-10-21

Base unchanged: still v1.17.9. No newer full upstream merge has landed; the last one is #964.

Ported (branch pushed; PR still needs opening, see run note)

  • [x] anomalyco/opencode#33924: scope MCP auth status to the configured server URL (security). Branch devin/1792601000-mcp-auth-url (compare), closes #1572
  • [x] anomalyco/opencode#43248: treat malformed (non-finite) model cost fields as 0 in Session.getUsage. Before this, decimal.js threw DecimalError and the turn failed. Branch devin/1792601000-malformed-cost (compare), closes #1573

Already present

  • [x] anomalyco/opencode#44944: SSE reader cancel rejection. The fork's wrapModelStream already routes every cancel through cancelReader(...).catch(() => {}). The packages/core/src/aisdk.ts copy only serves the v2 runner, which the fork doesn't ship

Still open from last run

  • #1476 (anomalyco/opencode#30022) and #1477 (anomalyco/opencode#37770) are still unmerged

Queued (ranked)

  1. [ ] anomalyco/opencode#43813: retry raw network_error finish reasons (session/llm/ai-sdk.ts). Retry. It also needs upstream's generic ResponseStreamError → retryable APIError mapping in message-v2.ts, and #1426 deliberately limits that mapping to the idle watchdog. Port after #1426 lands
  2. [ ] anomalyco/opencode#40707 / #40694 / #43806: broaden retryable error patterns (session/retry.ts). Retry. Waiting on #1426
  3. [ ] anomalyco/opencode#41939: retry jitter. Retry
  4. [ ] anomalyco/opencode#45769: drop unsigned Bedrock reasoning before caching. Bedrock. Check against #1425
  5. [ ] anomalyco/opencode#50272: Bedrock tool-result images. Bedrock
  6. [ ] AI SDK provider bumps: needs a dedicated PR plus a regression run (versions listed in the 2026-10-14 run)
  7. [ ] anomalyco/opencode#43640: xAI capacity errors retryable. Other provider
  8. [ ] anomalyco/opencode#37124: subagent recursion depth limit. Design-level, note only

Summary

Ported 2 fixes onto branches: MCP auth URL scoping (#33924 → #1572) and the malformed-cost guard (#43248 → #1573). Tests fail on main and pass with the fixes; tsgo and analyze.ts --markers --strict are clean. The PRs could not be opened: Devin's PR tool returned Unauthorized and the git proxy returned 403. A maintainer can open them from the compare links above. Next: #43813 and the retry patterns once #1426 merges, then the Bedrock items.

Note: session/session.ts has a second getUsage copy that nothing imports (callers use session/index.ts). It was left untouched.

Run 2026-10-14

Ported

  • [x] anomalyco/opencode#30022: bind MCP OAuth callback server to IPv4 loopback (security). Ported in #1476 (closes #1474)
  • [x] anomalyco/opencode#37770: OpenAI default header timeout 10s -> 5min (spurious aborts). Ported in #1477 (closes #1475)

Covered by an open fork PR (skipped)

  • [x] anomalyco/opencode#46903: generic 5min default header timeout. Covered by #1426 (#1424)
  • [x] Upstream stall/idle classification + retry of stalled model requests. Covered by #1426 (#1424)
  • [x] Bedrock empty-stream / cached-token billing fixes. Covered by #1425 (#1423)

Already present

  • [x] anomalyco/opencode#46890: 5min SSE chunk timeout. Fork already has DEFAULT_CHUNK_TIMEOUT = 300_000 (#844)
  • [x] anomalyco/opencode#43892: treat unknown finish reason as not-finished. Already in session/prompt.ts

Not applicable

  • [x] Core read tool fix (1ac6b4bec4): the fork runs the opencode tool implementation, not the core one
  • [x] Core runner fixes (49593c1ec4, 709af58612, 0033bb3559): they target the upstream v2 runner, which the fork doesn't ship
  • [x] fff / codemode / Copilot / Codex / Mistral variant fixes: features or providers the fork doesn't carry at this base

Queued (ranked)

  1. [ ] anomalyco/opencode#33924: scope MCP auth status to the configured server URL (mcp/index.ts getAuthStatus uses auth.get instead of auth.getForUrl). Security
  2. [ ] anomalyco/opencode#44944: catch rejected reader.cancel(err) promise in the SSE watchdog (provider.ts), avoiding an unhandled rejection after a stall. Hang
  3. [ ] anomalyco/opencode#40707 / #40694 / #43806: broaden retryable provider/network error patterns (session/retry.ts). Retry. Overlaps #1426, so wait for it to land
  4. [ ] anomalyco/opencode#43813: retry raw network_error finish reasons. Retry
  5. [ ] anomalyco/opencode#41939: retry jitter and capped retry policy. Retry. The fork already caps at RETRY_MAX_ATTEMPTS = 5, so only jitter is missing
  6. [ ] anomalyco/opencode#43248: ignore malformed (non-finite) model cost fields in Session.getUsage. Cost
  7. [ ] anomalyco/opencode#45769: drop unsigned/unreplayable Bedrock reasoning before caching (provider/transform.ts). Bedrock. Check against #1425 first
  8. [ ] anomalyco/opencode#50272: Bedrock tool-result images. Bedrock
  9. [ ] AI SDK provider bumps (needs a dedicated PR + regression run): amazon-bedrock 4.0.112 -> 4.0.166, anthropic 3.0.82 -> 3.0.111, openai 3.0.53 -> 3.0.88, azure 3.0.49 -> 3.0.93, xai 3.0.82 -> 3.0.139, togetherai 2.0.41 -> 2.0.68, google-vertex 4.0.128 -> 4.0.181, gateway 3.0.104 -> 3.0.191
  10. [ ] anomalyco/opencode#43640: xAI capacity errors retryable. Other provider
  11. [ ] anomalyco/opencode#37124: subagent recursion depth limit (tool/task.ts). Design-level; note only

Summary

Ported 2: MCP OAuth loopback bind (#1476) and OpenAI 5min header timeout (#1477). #46903 and the Bedrock fixes are skipped because open PRs #1426 and #1425 already cover them. Top of the queue: MCP auth URL scoping (#33924), then SSE cancel rejection (#44944) and the retry-pattern ports once #1426 merges. Run note: git clone/push through the git proxy returned 403, so branches were pushed via the GitHub REST API, and analyze.ts used its pattern fallback because upstream couldn't be fetched.

Written by Devin