Skip to content

feat(opencode): send muse-spark max effort first, fallback once to xhigh - #12687

Closed
Chewji9875 wants to merge 9 commits into
diegosouzapw:release/v3.8.52from
Chewji9875:fix/muse-spark-1.3-support
Closed

Chewji9875 wants to merge 9 commits into
diegosouzapw:release/v3.8.52from
Chewji9875:fix/muse-spark-1.3-support

Conversation

@Chewji9875

Copy link
Copy Markdown
Contributor

สรุป

  • opencode-go: ส่ง reasoning.effort=max ตรงๆ ไป /responses ก่อน (max-first) — ถ้า upstream ตอบ 400 unsupported-effort จะ retry อัตโนมัติ 1 ครั้งด้วย xhigh
  • command-code: ไม่ต้องแก้ — ส่ง reasoning_effort ผ่าน verbatim และรับ max อยู่แล้ว (มี test ยืนยัน)

ที่มา

ยิง reasoning.effort=max ตรงไป OpenCode Go upstream ได้ 400:

reasoning_effort 'max' is not supported … Supported values: [minimal, low, medium, high, xhigh]

ของเดิม clamp เป็น xhigh ตั้งแต่ต้นทาง (ยิงรอบเดียว) — PR นี้เปลี่ยนเป็นลอง max ก่อน เผื่อวันไหน upstream รองรับ จะได้ใช้ทันทีโดยไม่ต้อง deploy ใหม่

ไฟล์ที่เปลี่ยน

  • open-sse/executors/opencode.ts — transformRequest ส่ง tier ตรงๆ (เลิก clamp max→xhigh), เพิ่ม isUnsupportedReasoningEffortRejection() + dispatchWithMuseSparkMaxFallback() ครอบทั้ง fast path (single account) และ rotation loop
  • tests/unit/opencode-muse-spark-max-fallback.test.ts (ใหม่, 7 tests) — TDD
  • tests/unit/opencode-muse-spark-1.3-support.test.ts — อัปเดต expectation -max → effort:max

Verify

  • 83/83 unit tests ผ่าน (7 suites เกี่ยวกับ muse-spark + effort aliases)
  • ESLint: ไม่มี error ใหม่ (2 errors ใน opencode.ts เป็นของเดิมบน base)
  • Base release/v3.8.51 green, ไม่มี release-freeze เปิดอยู่

…igh on upstream 400

Upstream /responses rejects literal max for muse-spark (400 unsupported
reasoning.effort); command-code already passes reasoning_effort through
and accepts max natively. OpencodeExecutor now sends max verbatim and
retries a single time with xhigh only on that 400 signature.
@diegosouzapw

Copy link
Copy Markdown
Owner

This is a well-designed feature — trying max first and falling back to xhigh only on the upstream's specific unsupported-effort 400 (rather than pre-emptively clamping) is a nice touch, and the fast-path + rotation-loop coverage is thorough. Ran your three new/updated test files: 51/51 pass.

One thing to flag: this PR's registry changes for muse-spark-1.3-contributor overlap with a separate open PR (#13111) that fixes issue #12674 (Muse Spark 1.3 misrouted to /chat/completions). Both add nearly identical registry entries. We'll need to sequence these two merges to avoid duplicates — no action needed from you yet, just a heads up that this may wait on that decision. Could you also confirm the freebuff registry and executor changes are needed for this feature specifically? They weren't mentioned in the PR description and I want to make sure nothing unrelated snuck in.

Chewji9875 and others added 5 commits September 15, 2026 23:13
Resolves the opencode.ts conflict by combining this PR's max-first
muse-spark fallback dispatch with the release's Responses first-byte
stall guard (diegosouzapw#13484). Also de-duplicates the muse-spark-1.3-contributor
registry entries the merge brought in twice: the release tip already
landed the same base + effort-tier aliases in registry/opencode/{go,
index,zen} (fix for diegosouzapw#12674); kept the release's copy (it carries the
diegosouzapw#12681 context-length correction) and folded this PR's own -max
variant into it instead of keeping two separate blocks.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
…tributor

The PR's two commits each declared the same EFFORT_TIERS["muse-spark-1.3-contributor"]
key — the later one (without "max") silently won at runtime and tripped
TS1117 (duplicate object-literal property) on the open-sse-typecheck gate.
Merged into a single entry with the full minimal/low/medium/high/xhigh/max
list; parseEffortLevel's generic muse-spark-*-contributor regex fallback
already covered the "-max" suffix either way, so this is a type-safety
fix with no behavior change (51/51 tests still pass).

Also records the file-size-baseline.json entry for open-sse/executors/opencode.ts:
this PR's own growth (929->1059) and the release tip's independent growth
(929->1185, unrelated already-merged PRs) each stay under the 1200 new-file
cap alone; only their merge (1320) crosses it.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Resolves the conflicts — providerModels.ts: kept the base's getVertexModelTargetFormat dispatch and re-inserted this PR's muse-spark → openai-responses block after it; file-size-baseline.json: took the base's baseline (the release tip's ceilings already cover this branch).

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
…park max-first effort logic into opencodeMuseSparkEffort.ts

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@diegosouzapw diegosouzapw added the deferred-v3.8.52 Grande demais / suspeito para o lote atual; precisa de sessão dedicada no ciclo v3.8.52 label Sep 28, 2026
@diegosouzapw diegosouzapw changed the title feat(opencode): send muse-spark max effort first, fallback once to xhigh [defer] feat(opencode): send muse-spark max effort first, fallback once to xhigh Sep 28, 2026
@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.51 to release/v3.8.52 September 29, 2026 11:28
@diegosouzapw

Copy link
Copy Markdown
Owner

Re-homed to release/v3.8.52: v3.8.51 entered its release freeze, so the branch now belongs to the release captain and development continues on the next cycle. Nothing is wrong with this PR — it just needed a live base. No action needed from you; CI will re-run against the new base.

@diegosouzapw diegosouzapw changed the title [defer] feat(opencode): send muse-spark max effort first, fallback once to xhigh feat(opencode): send muse-spark max effort first, fallback once to xhigh Oct 1, 2026
@diegosouzapw diegosouzapw removed the deferred-v3.8.52 Grande demais / suspeito para o lote atual; precisa de sessão dedicada no ciclo v3.8.52 label Oct 1, 2026
thinh0704hcm pushed a commit to thinh0704hcm/OmniRoute that referenced this pull request Oct 5, 2026
…iegosouzapw#14138, diegosouzapw#13634, diegosouzapw#14267, diegosouzapw#12687)

Single branch with everything useful from the open Muse Code PRs that
release/v3.8.52 does not have yet:

- diegosouzapw#15234: session-pinned multi-account round-robin, same-owner
  empty-response retry, semantic-cache bypass, Responses URL fix for
  custom baseUrl, 512 output-token floor.
- diegosouzapw#12687: opencode-go sends reasoning.effort=max verbatim for
  muse-spark-1.3+, one xhigh retry on the unsupported-effort 400.
- diegosouzapw#13634: MuseCodeExecutor restores the 24h prompt_cache_retention
  window stripped by the generic sanitizer.
- diegosouzapw#14267: device-flow hardening (origin pin, expiry cap, poll-error
  allowlist, bounded auth requests).
- diegosouzapw#14138: mint-failure contract (401/403 forces re-login,
  429/transient keeps the stored key).

Skipped as subsumed or rejected: duplicate OAuth flows (merged
diegosouzapw#14329 covers them), diegosouzapw#14492 parallel provider, llama catalog
removals, command-code/freebuff catalog additions.

Co-authored-by: mdc2122 <mdc2122@users.noreply.github.com>
Co-authored-by: SIGTERM-015 <SIGTERM-015@users.noreply.github.com>
Co-authored-by: KSonny4 <KSonny4@users.noreply.github.com>
Co-authored-by: caniko <caniko@users.noreply.github.com>
Co-authored-by: Chewji9875 <Chewji9875@users.noreply.github.com>
thinh0704hcm pushed a commit to thinh0704hcm/OmniRoute that referenced this pull request Oct 5, 2026
…ation, spark max-effort, cache retention, device-flow hardening, mint-failure contract) into feat/muse-code-compat

Conflict in open-sse/executors/opencode.ts transformRequest resolved in
favour of the consolidated applyMuseSparkResponsesEffort path (diegosouzapw#12687);
the superseded applyGoEffortSuffixMapping helper stays exported and tested.
@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks @Chewji9875 — trying max first and falling back to xhigh only on the upstream's explicit unsupported-effort 400 was a thoughtful design, and the test coverage was solid. We're closing this because the maintainer decided (2026-09-24, following #13471) that Muse Spark 1.3 has no max tier — the tip's deliberate test asserts that — and the muse-spark-1.3 registry entries your branch adds are already on release/v3.8.52 through the re-landed Muse Spark routing fix. Nothing from this diff is being shipped. Thank you for the work and for the careful testing.

diegosouzapw added a commit to kalpakprod/OmniRoute that referenced this pull request Oct 8, 2026
- oauth-polltoken-nonjson-body: the diegosouzapw#14267 hardening carried here
  allowlists Muse Code poll errors and never echoes upstream text, so a
  non-JSON 502 page now maps to a bare { error: "invalid_response" }
  instead of a description quoting the HTML. Kimi and GitHub keep the
  original assertion.
- opencode-go-muse-spark-1-3-12674: diegosouzapw#12687 adds `max` as an explicit
  muse-spark-1.3 alias (sent verbatim, xhigh fallback on the upstream
  unsupported-effort 400), so parseEffortLevel(-max) now resolves.

Co-authored-by: caniko <caniko@users.noreply.github.com>
Co-authored-by: Chewji9875 <Chewji9875@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants