Skip to content

fix(zcode): export reasoning configuration for thought-capable models - #4153

Merged
lidge-jun merged 1 commit into
lidge-jun:devfrom
richardfeiliu-a11y:fix/zcode-export-reasoning
Sep 9, 2026
Merged

lidge-jun merged 1 commit into
lidge-jun:devfrom
richardfeiliu-a11y:fix/zcode-export-reasoning

Conversation

@richardfeiliu-a11y

@richardfeiliu-a11y richardfeiliu-a11y commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • ocx zcode / ZCode integration sync omitted the on-disk reasoning block, so ZCode hid the Thought Level picker even for catalog models that already support reasoning_effort on the wire.
  • buildZcodeClientConfig now emits reasoning.enabled, variants, and defaultVariant when the model has a selectable ladder. That is the schema ZCode 3.x persists on disk and later parses into in-memory levels / defaultLevel.
  • none is dropped because it is a Codex omit-sentinel, not a ZCode picker option. Catalog ultra is kept. defaultVariant is set only when it survives that filter.

Closes #4147

Verification

  • bun test tests/providers/zcode-client.test.ts tests/config/client-config-export.test.ts tests/config/client-config-export-new-clients.test.ts — 115 pass, 0 fail
  • bun run typecheck — exit 0
  • bun run privacy:scan — Privacy scan passed
  • bun run test — 22388 pass, 80 skip, 0 fail, exit 0

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • New Features
    • ZCode configuration exports now include reasoning support for models that declare available reasoning levels.
    • Exported metadata identifies enabled reasoning variants and their default selection when applicable.
    • Unsupported or empty reasoning configurations are omitted from the exported configuration.
    • The "none" option is excluded from selectable reasoning variants while other declared levels remain available.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 9, 2026
@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 7d6b018e-05e2-48f6-b4d0-387485599cf7

📥 Commits

Reviewing files that changed from the base of the PR and between cd813d3 and ccb2f8e.

📒 Files selected for processing (3)
  • src/clients/config-export/zcode.ts
  • tests/config/client-config-export.test.ts
  • tests/providers/zcode-client.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The ZCode configuration export now includes reasoning metadata for models with supported reasoning efforts. It filters the none sentinel, preserves valid variants, and emits a default variant only when it is available.

Changes

ZCode reasoning export

Layer / File(s) Summary
Reasoning export contract and serialization
src/clients/config-export/zcode.ts
ZcodeModelEntry now supports an optional reasoning object. buildZcodeClientConfig derives filtered variants from sanitizeCodexReasoningEfforts and conditionally emits defaultVariant.
Reasoning export validation
tests/providers/zcode-client.test.ts, tests/config/client-config-export.test.ts
Tests cover reasoning variants, default selection, omission of none, empty effort lists, models without reasoning efforts, and the serialized golden output.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to ccb2f

ZCode exports now expose supported reasoning levels and valid defaults so the Thought Level control can be shown correctly. The relevant output, filtering, and omission behavior are covered, with no current merge-blocking risk identified.

Suggested reviewers: invalid-email-address

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation addresses issue #4147. It adds the optional ZCode reasoning schema, exports reasoning metadata when reasoning efforts are declared, removes the none omit-sentinel, preserves catalog…
Out of Scope Changes check ✅ Passed The changes are limited to the ZCode configuration exporter and related tests. The modified files directly support the linked issue and PR objective. No unrelated production behavior or unrelated file…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: exporting reasoning configuration for ZCode models that support selectable reasoning levels.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

✅ 4/4 boxes ticked.

This pull request has been marked Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers notified: @lidge-jun @Ingwannu

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 58 / 80

이 PR은 ocx zcode / ZCode 연동이 ~/.zcode/v2/config.json에 모델을 쓸 때 빠져 있던 reasoning 블록을 채웁니다. 지금 dev의 src/clients/config-export/zcode.ts는 모델마다 name / modalities / limit만 넣고, 카탈로그에 reasoningEfforts가 있어도 Thought Level(생각 강도) 선택창을 켤 정보가 없습니다. ZCode 3.x는 디스크의 reasoning.variants / defaultVariant를 읽어 메모리의 levels / defaultLevel로 바꾸기 때문에, 이 필드가 없으면 와이어로는 reasoning_effort가 되는 모델도 UI에서는 그냥 텍스트 모델처럼 보입니다. 이슈 #4147이 그 증상을 적었고, 이 PR이 그 구멍을 막습니다.

고치는 방식은 이미 dev에 있는 MCode 내보내기(src/clients/config-export/mcode.ts)와 같은 줄입니다. sanitizeCodexReasoningEfforts로 카탈로그 사다리를 정리한 뒤, Codex 생략 센티널인 none만 빼고, 남는 값이 있으면 enabled: true와 variants를 씁니다. defaultVariant는 기본값이 그 필터를 통과했을 때만 넣습니다. 이슈 본문의 Expected Behavior는 ultra를 빼라고 적혀 있었지만, 이 PR은 ultra를 남깁니다. 그게 맞습니다. ZCode는 고른 variant를 그대로 reasoning_effort로 넘기고, 카탈로그의 ultra는 src/reasoning-effort.ts의 Codex 사다리(low…ultra)에 들어 있는 진짜 단계이기 때문입니다. none만 빼는 쪽이 MCode 주석과도 같고, none-only / 빈 사다리는 reasoning 자체를 생략해서 선택창을 숨깁니다. 테스트도 gemini-3.8-flash 사다리 + defaultVariant, Muse Spark의 none/ultra/turbo 정리, facade 스냅샷의 zcode JSON을 같이 고쳤습니다. turbo는 sanitize 단계에서 Codex 집합 밖이라 이미 걸러지고, 기대값 ["high","ultra"]가 그 동작을 고정합니다.

라인 - src/clients/config-export/zcode.ts (PR 추가분, buildZcodeClientConfig 루프) - none만 필터하고 minimal은 남깁니다. MCode와 같지만, 카탈로그에 minimal이 있으면 ZCode 선택창에 그대로 보일 수 있습니다. OpenAI 쪽에서는 minimal이 사실상 센티널/저노력 매핑이라, ZCode UI에 노출해도 되는지는 한 번 더 보면 좋습니다.
라인 - PR 본문 Review readiness checklist - draft이고 네 칸이 전부 비어 있습니다. 게이트봇이 draft로 둔 상태라, CI/체크리스트 없이 바로 머지할 단계는 아닙니다.
경로 tests/providers/zcode-client.test.ts - 스키마·필터 단위 테스트는 충분합니다. 다만 실제 ZCode 3.x가 variants/defaultVariant → levels/defaultLevel로 파싱한다는 전제는 코드 주석·이슈 재현에 기대고 있고, 이 저장소 안에 ZCode 파서 픽스처는 없습니다(기존 zcode.ts 헤더의 3.7.7/3.8.1 관측과 같은 신뢰 수준).
경로 문서/릴리즈 노트 - Checklist에 docs 갱신을 체크했지만 diff에는 문서 파일이 없습니다. 사용자-facing 클라이언트 내보내기 버그 수정이라, CHANGELOG나 clients 가이드 한 줄이 있으면 이후 기여자에게 더 친절합니다(필수까지는 아님).

메인테이너의 판단이 필요한 지점

너의 추천
방향은 머지해도 됩니다. dev HEAD cd813d3d9 기준 작은 표면·이슈 정합·MCode 패턴 재사용이 좋습니다. draft 체크리스트와 CodeRabbit 대기만 정리한 뒤 ready로 올리고 머지하세요. ultra 유지·none 제거는 그대로 두고, minimal만 메인테이너가 한 줄 결정하면 됩니다. 머지되면 #4147은 Closes로 같이 닫힙니다.

이 댓글은 grok-bot이 작성했습니다

@richardfeiliu-a11y
richardfeiliu-a11y force-pushed the fix/zcode-export-reasoning branch from ccb2f8e to 021bbed Compare September 9, 2026 21:34
@github-actions
github-actions Bot marked this pull request as ready for review September 9, 2026 22:07
ZCode's Thought Level picker reads on-disk reasoning.variants. The
exporter only wrote name/modalities/limit, so catalog models that
already support reasoning_effort looked like plain-text models.

Drop the Codex none sentinel, keep catalog ultra, and set
defaultVariant only when it remains in the emitted ladder.
@richardfeiliu-a11y
richardfeiliu-a11y force-pushed the fix/zcode-export-reasoning branch from 021bbed to abf35fa Compare September 9, 2026 22:20
@github-actions
github-actions Bot marked this pull request as draft September 9, 2026 22:20
@github-actions
github-actions Bot marked this pull request as ready for review September 9, 2026 22:22
@richardfeiliu-a11y

Copy link
Copy Markdown
Contributor Author

Rebased onto current origin/dev (a7509fe00). Post-rebase related tests, typecheck, and privacy scan are green.

This change is ready to merge from the author side. I do not have write access on lidge-jun/opencodex, so a maintainer needs to approve the fork Cross-platform CI workflow and merge into dev.

@lidge-jun
lidge-jun merged commit 2ce5f38 into lidge-jun:dev Sep 9, 2026
31 checks passed
luvs01 pushed a commit to luvs01/opencodex that referenced this pull request Sep 10, 2026
…n#4141 unblock

Three more rows are settled. lidge-jun#4153 merged as 2ce5f38 and closed lidge-jun#4147, as
the contributor's own commit so authorship reaches his graph. lidge-jun#4160 merged as
8a5cfd3 and closed lidge-jun#3859. And PR lidge-jun#4152 landed as 9ba04b6, which frees
lidge-jun#4141 to start.

Two operational facts are written down because they were easy to get wrong.
A fork pull request does not start repository CI by itself, so the thin check
list on lidge-jun#4153 was action_required rather than a passing PR. And the
force-push that unstacked lidge-jun#4160 left an earlier run cancelled at the same
SHA, whose aggregate job then reported failure; that is the third cancelled
run this round that could have been read as a verdict.

Also records the one real defect the Lane B audit found. The free-only filter
counts the group header from the unfiltered rows, so the header claims more
models than the list shows. The empty state gets it right; the header does
not. Assigned to Lane B.

NOT RUN: local test suite, typecheck, build, lint. Remote CI is the gate.
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
…xport-reasoning

Maintainer integration on dev under the MAINTAINERS.md policy that lets a maintainer
with maintain or admin access land a PR on dev without a second approval, recording
the decision and the exact-head CI evidence.

Landed as the contributor's own commit so the contribution shows on his graph.
Authorship is richardfeiliu-a11y throughout; nothing was reimplemented or carried.

What decided the review is that the contributor did not guess the schema. He read a
live ~/.zcode/v2/config.json and the shipped parser inside ZCode.app and reported
that the on-disk shape is enabled + variants + defaultVariant, with levels being the
post-parse in-memory object. This repository corroborates that from inside the tree:
src/integrations/ownership-policy.ts already treats models.*.reasoning as a 3.8.1 key
with enabled/variants, and tests/clients/integrations-writer.test.ts carries a fixture
in exactly that shape.

Vocabulary is right for this client. The none rung is dropped because it is Codex's
omit-sentinel rather than a picker option. The ultra rung is kept because ZCode
forwards the selected variant as reasoning_effort and ultra is a real tier, so omp's
no-ultra vocabulary is omp-specific. And defaultVariant is emitted only when it
survives the filter.

A fork pull request does not start repository CI on its own. Cross-platform CI and
React Doctor sat at action_required until a maintainer approved them, which is why the
earlier check list showed only hygiene, target, label and resolve-pr. Both were
approved and then concluded on their own.

Exact-head CI at 7267df1, verified by exit code:

  gh run view 34411681339 --exit-status  ->  0   Cross-platform CI
  gh run view 34411681800 --exit-status  ->  0   React Doctor
  gh run view 34411874833 --exit-status  ->  0   Enforce PR target branch
  gh run view 34411874830 --exit-status  ->  0   PR hygiene

None cancelled at that SHA.

Independent read-only review recorded at
devlog/_plan/260910_post249_round2/_research/_audit_pr4153.md, verdict PASS with no
blocker. It confirmed the only byte-pinned ZCode export string in the tree is the
facade golden this PR updates, and that no other snapshot, fixture or docs sample now
disagrees.

NOT RUN locally: bun run test, bun run typecheck, bun run build, bun run lint:gui,
bun run privacy:scan, bun install. The maintainer set a no-local-suite constraint for
this round and remote CI is the only gate.
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
…n#4141 unblock

Three more rows are settled. lidge-jun#4153 merged as 0c79314 and closed lidge-jun#4147, as
the contributor's own commit so authorship reaches his graph. lidge-jun#4160 merged as
b27aa50 and closed lidge-jun#3859. And PR lidge-jun#4152 landed as ba8e8f8, which frees
lidge-jun#4141 to start.

Two operational facts are written down because they were easy to get wrong.
A fork pull request does not start repository CI by itself, so the thin check
list on lidge-jun#4153 was action_required rather than a passing PR. And the
force-push that unstacked lidge-jun#4160 left an earlier run cancelled at the same
SHA, whose aggregate job then reported failure; that is the third cancelled
run this round that could have been read as a verdict.

Also records the one real defect the Lane B audit found. The free-only filter
counts the group header from the unfiltered rows, so the header claims more
models than the list shows. The empty state gets it right; the header does
not. Assigned to Lane B.

NOT RUN: local test suite, typecheck, build, lint. Remote CI is the gate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants