Repository navigation
feat(muse-proxy): direct mode — minted-key Responses path (#2753) - #2759
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Closes #2753
What
Direct mode for
bin/muse-proxy.mjs: a third, first-tried path in front of the warmmuse serve(#480) andmuse execpaths, which pay ~26k tokens of CLI harness scaffolding per call.providers.meta.access_token(thedca:…account OAuth token) from$MUSE_AUTH_PATH || ~/.config/muse/auth.jsonand POSTs it to{MUSE_PROXY_META_API_BASE || https://api.meta.ai}/muse-code/key(x-api-version: 1.0.0,{"onboard": false}) for the minted plan inference key. Key cached in memory 10 min; on upstream 401 the cache is invalidated, the key re-exchanged once, and the request retried once. Store with onlyproviders.meta.api_key→ that key is used without exchanging. Key material is never logged.is_subs_active === false/require_payment === true→ hard 502 naming the subscription state, no CLI fallback./v1/chat/completionswith the minted key → 403client_attestation_deniedregardless of headers;/v1/responses→ 200 with bare Authorization only, no impersonating headers). System →instructions; user/assistant/tool/function messages → Responses input items (function_call/function_call_output); OpenAI tools/tool_choice → Responses shapes;max_tokens/max_completion_tokens→max_output_tokens; reasoning effort mapped (none→ omitted,max/ultra→xhigh, the Responses ceiling);store: false.output_text→ content,function_call→tool_calls, finish_reason incl.lengthonmax_output_tokensincompletion, usage mapped incl.prompt_tokens_details.cached_tokens. Stream errors are SSE-framed +[DONE](the muse-proxy: streaming execution failure is sent as unframed JSON on a 200 SSE response — clients see an empty successful stream #670 pattern).POST /v1/responsespassthrough: client body forwarded byte-for-byte with only Authorization swapped to the minted key.MUSE_PROXY_DIRECT=0disables direct mode./healthgains adirectsection (enabled, credentialFound, mintedKeyCached, subsTier, subsActive — booleans/strings only).Capability only: no proxy service or OpenCode provider is re-enabled (the
museprovider stays disabled per Drew, 2026-10-25).Test harness note
startProxynow also plants the stubmuseat$HOME/.local/bin/muse. On NixOS hosts/run/current-system/sw/bin/museexists and the proxy prefers it over PATH, so the harness silently tested the real CLI (real plan calls, ~10–30 s per test). With the stub planted at the preferred path the suite is hermetic on the laptop: 3.2 s total.Validation (laptop,
node --test bin/muse-proxy.test.mjs)19/19 pass — 13 pre-existing + 6 new direct-mode tests:
/healthdirect sectiontool_calls,[DONE])muse execinvocations/v1/responsespassthrough byte-for-byte except AuthorizationMUSE_PROXY_DIRECT=0and missing-auth.json keep the exec behaviorLive smoke test (laptop, throwaway port 19747, real api.meta.ai, 2 prompts, effort low)
ok, usage 10 prompt / 209 completion / 219 total tokens, modelmuse-spark-1.3-lowok, finishstop, usage 10 prompt / 270 completion / 280 total tokensInput cost is 10 tokens vs ~26k through the CLI harness. (Completion counts include the model's reasoning tokens at effort low.)
Need help on this PR? Tag
@codesmith-botwith what you need.