feat(kap-server): expose effective experimental flags in /meta - #2417
feat(kap-server): expose effective experimental flags in /meta#2417liruifengv wants to merge 3 commits into
Conversation
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29399fa5c6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
🦋 Changeset detectedLatest commit: fe9ea87 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@codex review Addressed the P2 startup-race comment in e04b1e4: the /meta handler now awaits |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Related Issue
No linked issue — this is the server half of the secondary-model settings UI (MoonshotAI/kimi-code-app#163); the problem is explained below.
Problem
Experimental flags resolve from several sources (master env, per-flag
KIMI_CODE_EXPERIMENTAL_*env vars, the[experimental]config section, defaults), but HTTP clients can only see the persisted config section viaGET /config. A UI therefore cannot tell whether a flag is actually in effect: withsecondary-modelenabled via env, the desktop/web settings UI would hide the secondary-model section while the feature is active — or, without any effective-state source, would have to bypass the experimental gate entirely.What changed
GET /api/v1/metanow carriesexperimental_flags: the effective flag map (flag id → enabled) resolved per request fromIFlagService.snapshot(), so it covers every flag source and flips live when the[experimental]config section is written — unlike the static persisted view inGET /config.metaResponseSchema: optionalexperimental_flagsrecord (older servers omit it; clients treat absence as "no flags enabled")IFlagService.snapshot()from the Core scopeTests (
test/meta.test.ts) cover: default-off, env-enabled, live flip viaPOST /config, and env-outranks-config — with the developer-shellKIMI_CODE_EXPERIMENTAL_FLAGneutralized per test. Full kap-server suite passes (922 tests).Changeset included:
@moonshot-ai/kap-serverminor.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update. (The field is self-documented in the OpenAPI schema viametaResponseSchema; no manual doc page covers/metafields.)