Repository navigation
upstream: provider/security fixes not yet ported #1478
Description
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.5. 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-10-28
Base unchanged: still v1.17.9. No newer full upstream merge has landed; the last one is #964.
Ported
- fix(server): align connect route checks 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). fix(server): port upstream PTY connect route authorization (anomalyco/opencode#58258) #1615, closes PTY connect ticket auth bypass is decided from the raw URL, not the routed path #1614
- fix(opencode): answer a failed TUI worker request instead of hanging anomalyco/opencode#54936: answer a failed worker RPC request instead of leaving the TUI on a blank screen (e.g.
--portalready in use) (hang). fix(tui): port upstream failed RPC request reply (anomalyco/opencode#54936) #1617, closes TUI hangs on a blank screen when a worker RPC request fails (e.g. --port already in use) #1616
Opened from last run's branches
- fix(mcp): scope auth status to server URL anomalyco/opencode#33924: MCP auth status scoped to the configured server URL. fix(mcp): port upstream auth status scoping to configured server URL (anomalyco/opencode#33924) #1612, closes MCP auth status reports credentials stored for a different server URL as authenticated #1572
- fix(session): ignore malformed model costs anomalyco/opencode#43248: malformed model cost fields count as 0. fix(session): port upstream malformed model cost guard (anomalyco/opencode#43248) #1613, closes Malformed model cost fields crash session usage accounting (DecimalError) #1573
Not applicable
- fix(core): accept interleaved Copilot reasoning_opaque values anomalyco/opencode#54207: interleaved Copilot
reasoning_opaquevalues. The fork doesn't carry the Copilot provider at this base
Still open (not merged)
- fix(bedrock): non-empty Converse streams in the release build and cached tokens billed once #1425 (Bedrock), fix(session): recover from stalled model requests #1426 (stalled requests), fix(mcp): port upstream OAuth callback loopback bind (anomalyco/opencode#30022) #1476 (#30022), fix(provider): port upstream 5min OpenAI header timeout (anomalyco/opencode#37770) #1477 (#37770)
Queued (ranked)
- fix(opencode): retry raw network finish errors anomalyco/opencode#43813: retry raw
network_errorfinish reasons. Retry. Port after fix(session): recover from stalled model requests #1426 lands - fix(opencode): expand retryable error patterns anomalyco/opencode#40707 / #40694 / #43806: broaden retryable error patterns (
session/retry.ts). Retry. Waiting on fix(session): recover from stalled model requests #1426 - fix(opencode): cap session retries with jitter anomalyco/opencode#41939: retry jitter. Retry
- fix(provider): filter unreplayable Bedrock reasoning before caching anomalyco/opencode#45769: drop unsigned Bedrock reasoning before caching. Bedrock. Check against fix(bedrock): non-empty Converse streams in the release build and cached tokens billed once #1425
- fix(opencode): hoist Bedrock tool images except Claude, Nova, and Llama 4 anomalyco/opencode#50272: Bedrock tool-result images. Bedrock
- AI SDK provider bumps: needs a dedicated PR plus a regression run (versions listed in the 2026-10-14 run)
- fix(opencode): retry xAI capacity stream errors anomalyco/opencode#43640: xAI capacity errors retryable. Other provider
- fix(core): limit subagent nesting depth 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.
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)
- fix(mcp): scope auth status to server URL anomalyco/opencode#33924: scope MCP auth status to the configured server URL (security). Branch
devin/1792601000-mcp-auth-url(compare), closes MCP auth status reports credentials stored for a different server URL as authenticated #1572 - fix(session): ignore malformed model costs anomalyco/opencode#43248: treat malformed (non-finite) model cost fields as 0 in
Session.getUsage. Before this,decimal.jsthrewDecimalErrorand the turn failed. Branchdevin/1792601000-malformed-cost(compare), closes Malformed model cost fields crash session usage accounting (DecimalError) #1573
Already present
- fix(provider): handle SSE reader cancel rejections anomalyco/opencode#44944: SSE reader cancel rejection. The fork's
wrapModelStreamalready routes every cancel throughcancelReader(...).catch(() => {}). Thepackages/core/src/aisdk.tscopy only serves the v2 runner, which the fork doesn't ship
Still open from last run
- fix(mcp): port upstream OAuth callback loopback bind (anomalyco/opencode#30022) #1476 (fix(mcp): bind oauth callback to IPv4 loopback anomalyco/opencode#30022) and fix(provider): port upstream 5min OpenAI header timeout (anomalyco/opencode#37770) #1477 (fix(opencode): increase OpenAI header timeout anomalyco/opencode#37770) are still unmerged
Queued (ranked)
- fix(opencode): retry raw network finish errors anomalyco/opencode#43813: retry raw
network_errorfinish reasons (session/llm/ai-sdk.ts). Retry. It also needs upstream's genericResponseStreamError→ retryableAPIErrormapping inmessage-v2.ts, and fix(session): recover from stalled model requests #1426 deliberately limits that mapping to the idle watchdog. Port after fix(session): recover from stalled model requests #1426 lands - fix(opencode): expand retryable error patterns anomalyco/opencode#40707 / #40694 / #43806: broaden retryable error patterns (
session/retry.ts). Retry. Waiting on fix(session): recover from stalled model requests #1426 - fix(opencode): cap session retries with jitter anomalyco/opencode#41939: retry jitter. Retry
- fix(provider): filter unreplayable Bedrock reasoning before caching anomalyco/opencode#45769: drop unsigned Bedrock reasoning before caching. Bedrock. Check against fix(bedrock): non-empty Converse streams in the release build and cached tokens billed once #1425
- fix(opencode): hoist Bedrock tool images except Claude, Nova, and Llama 4 anomalyco/opencode#50272: Bedrock tool-result images. Bedrock
- AI SDK provider bumps: needs a dedicated PR plus a regression run (versions listed in the 2026-10-14 run)
- fix(opencode): retry xAI capacity stream errors anomalyco/opencode#43640: xAI capacity errors retryable. Other provider
- fix(core): limit subagent nesting depth 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
- fix(mcp): bind oauth callback to IPv4 loopback anomalyco/opencode#30022: bind MCP OAuth callback server to IPv4 loopback (security). Ported in fix(mcp): port upstream OAuth callback loopback bind (anomalyco/opencode#30022) #1476 (closes MCP OAuth callback server listens on all interfaces #1474)
- fix(opencode): increase OpenAI header timeout anomalyco/opencode#37770: OpenAI default header timeout 10s -> 5min (spurious aborts). Ported in fix(provider): port upstream 5min OpenAI header timeout (anomalyco/opencode#37770) #1477 (closes OpenAI requests abort after 10s with 'Provider response headers timed out' #1475)
Covered by an open fork PR (skipped)
- fix(opencode): default header timeout to five minutes anomalyco/opencode#46903: generic 5min default header timeout. Covered by fix(session): recover from stalled model requests #1426 (Session hangs or dies when a model request stalls (no first-byte timeout, idle timeout not retried) #1424)
- Upstream stall/idle classification + retry of stalled model requests. Covered by fix(session): recover from stalled model requests #1426 (Session hangs or dies when a model request stalls (no first-byte timeout, idle timeout not retried) #1424)
- Bedrock empty-stream / cached-token billing fixes. Covered by fix(bedrock): non-empty Converse streams in the release build and cached tokens billed once #1425 (fix: Bedrock Converse streams are empty in built binaries and cached tokens are billed twice #1423)
Already present
- fix(opencode): default chunk timeout to five minutes anomalyco/opencode#46890: 5min SSE chunk timeout. Fork already has
DEFAULT_CHUNK_TIMEOUT = 300_000(fix: increase DEFAULT_CHUNK_TIMEOUT from 2min to 5min #844) - fix(opencode): continue unknown finish responses anomalyco/opencode#43892: treat
unknownfinish reason as not-finished. Already insession/prompt.ts
Not applicable
- Core
readtool fix (1ac6b4b): the fork runs the opencode tool implementation, not the core one - Core runner fixes (49593c1, 709af58, 0033bb3): they target the upstream v2 runner, which the fork doesn't ship
- fff / codemode / Copilot / Codex / Mistral variant fixes: features or providers the fork doesn't carry at this base
Queued (ranked)
- fix(mcp): scope auth status to server URL anomalyco/opencode#33924: scope MCP auth status to the configured server URL (
mcp/index.tsgetAuthStatususesauth.getinstead ofauth.getForUrl). Security - fix(provider): handle SSE reader cancel rejections anomalyco/opencode#44944: catch rejected
reader.cancel(err)promise in the SSE watchdog (provider.ts), avoiding an unhandled rejection after a stall. Hang - fix(opencode): expand retryable error patterns anomalyco/opencode#40707 / #40694 / #43806: broaden retryable provider/network error patterns (
session/retry.ts). Retry. Overlaps fix(session): recover from stalled model requests #1426, so wait for it to land - fix(opencode): retry raw network finish errors anomalyco/opencode#43813: retry raw
network_errorfinish reasons. Retry - fix(opencode): cap session retries with jitter anomalyco/opencode#41939: retry jitter and capped retry policy. Retry. The fork already caps at
RETRY_MAX_ATTEMPTS = 5, so only jitter is missing - fix(session): ignore malformed model costs anomalyco/opencode#43248: ignore malformed (non-finite) model cost fields in
Session.getUsage. Cost - fix(provider): filter unreplayable Bedrock reasoning before caching anomalyco/opencode#45769: drop unsigned/unreplayable Bedrock reasoning before caching (
provider/transform.ts). Bedrock. Check against fix(bedrock): non-empty Converse streams in the release build and cached tokens billed once #1425 first - fix(opencode): hoist Bedrock tool images except Claude, Nova, and Llama 4 anomalyco/opencode#50272: Bedrock tool-result images. Bedrock
- 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
- fix(opencode): retry xAI capacity stream errors anomalyco/opencode#43640: xAI capacity errors retryable. Other provider
- fix(core): limit subagent nesting depth 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.
Activity