openclaw/extensions/opencode
rain ad3e3cb7d2
fix(agents): preserve reasoning_content replay across DeepSeek tier suffixes (#87593)
* fix(agents): preserve reasoning_content replay across DeepSeek tier suffixes

OpenCode Zen exposes DeepSeek V4 as `deepseek-v4-flash-free`, which keeps the upstream DeepSeek thinking-mode contract that requires `reasoning_content` to be passed back on follow-up requests. The existing replay allowlist only matched the bare ids (`deepseek-v4-flash`, `kimi-k2-thinking`, ...), so the tier-suffixed id missed every candidate and the sanitizer stripped `reasoning_content` from the assistant turn. DeepSeek then rejected the second API call with HTTP 400 and the session deadlocked.

Strip the well-known tier suffixes (`-free`, `-paid`, `-trial`) when generating allowlist candidates so the base model id matches and the reasoning replay survives. Existing matching for prefixed / colon-suffixed routes is unchanged.

Fixes #87575

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(agents): avoid spread-rebuild when iterating allowlist candidates

oxlint flagged the [...candidates] spread as an unnecessary array copy. Use an explicit baseCount loop bound instead so we still iterate the original entries while pushing tier-stripped variants onto the same array.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(opencode): add live DeepSeek replay probe

* test(opencode): avoid forced tool choice in live replay

---------

Co-authored-by: Pluviobyte <Pluviobyte@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-05-28 16:25:54 +01:00
..
api.ts
index.test.ts test: guard extension mock helpers 2026-05-11 19:19:27 +01:00
index.ts refactor: reduce plugin sdk surface 2026-05-10 12:37:10 +01:00
media-understanding-provider.test.ts test: tighten opencode media assertions 2026-05-09 03:45:24 +01:00
media-understanding-provider.ts refactor: internalize OpenClaw agent runtime (#85341) 2026-05-27 19:24:04 +01:00
onboard.test.ts refactor: promote plugin test helpers to sdk 2026-04-28 00:55:11 +01:00
onboard.ts
openclaw.plugin.json refactor: internalize OpenClaw agent runtime (#85341) 2026-05-27 19:24:04 +01:00
opencode.live.test.ts fix(agents): preserve reasoning_content replay across DeepSeek tier suffixes (#87593) 2026-05-28 16:25:54 +01:00
package.json chore(release): prepare 2026.5.28 2026-05-28 01:48:07 +01:00
plugin-registration.contract.test.ts refactor: promote plugin test helpers to sdk 2026-04-28 00:55:11 +01:00
provider-policy-api.test.ts test: tighten opencode thinking profile assertions 2026-05-11 07:24:08 +01:00
provider-policy-api.ts fix(opencode): expose Claude thinking policy (#76760) 2026-05-03 15:22:07 +00:00
tsconfig.json