Skip to content

feat(muse-proxy): tolerate per-CLI flag differences via --help capability probe - #775

Merged
dezren39 merged 2 commits into
mainfrom
warm/muse-proxy-cli-flag-tolerance
Oct 25, 2026
Merged

dezren39 merged 2 commits into
mainfrom
warm/muse-proxy-cli-flag-tolerance

Conversation

@dezren39

@dezren39 dezren39 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Stacked on #769 (base: warm/muse-proxy-serve-pool). Left open for review; not merged.

Problem

The warm muse-proxy from #769 spawns muse serve --provider meta --disable-request-user-input and its exec fallback passes --disable-reminders. The fleet runs two muse CLI releases side by side whose flag surfaces differ (both --help outputs captured and compared 2026-10-24):

flag muse 1.4.2 (laptop) muse 1.4.13 (sandbox)
serve --disable-request-user-input absent present
exec --disable-reminders absent present
everything else the proxy passes present present

An unknown option kills the child before it serves anything, so on the laptop every muse turn failed instantly (HTTP 500) while the sandbox worked.

Fix (commit ccb2cac)

  • At startup the proxy probes the resolved binary's serve --help and exec --help once, caches the advertised --flag sets, and builds both spawn argvs from them — only advertised flags are passed. No version strings are compared, so future CLIs land wherever their help says.
  • Probe failure degrades instead of dying: optional flags (the two above) are omitted, core flags are still passed.
  • /health now reports cliFlags: { serveProbed, execProbed, dropped: { serve, exec } }.
  • Behavior on 1.4.13 is unchanged: every planned flag is advertised there, so the argvs are byte-identical to feat(muse-proxy): warm sessions on a persistent muse serve (MSP) host (#480) #769's.

Also in this PR (commit 3955bc5)

The laptop deployment carried one local adaptation the sandbox build lacked: the egress pin was overridable (MUSE_PROXY_EGRESS, empty = no pinning; CA bundle pinned only when the file exists). That is folded into the fleet code verbatim so both machines run the same file; sandbox behavior is unchanged (same default pin, CA present).

Tests

node --test bin/muse-proxy.test.mjs — 13/13 pass (9 pre-existing + 4 new). The stub muse gains canned --help surfaces (1.4.2-shaped by default, 1.4.13-shaped with STUB_HELP_ALL_FLAGS=1) and argv logging; the new tests pin omission/pass-through for both the exec spawn and the warm serve spawn, plus the /health dropped-flag report.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Muse Sweep added 2 commits October 24, 2026 17:39
The sandbox can only reach Meta through its unauthenticated egress
proxy + CA bundle, but fleet machines with direct network access (the
laptop) must not pin either for the CLI children. MUSE_PROXY_EGRESS
now overrides the pinned proxy URL; setting it empty disables the
pinning entirely, and the CA bundle is only pinned when the file
exists. Sandbox behaviour is unchanged (same default pin, CA present).

This folds the laptop deployment's local adaptation into the fleet
code so both machines run the same file.
The fleet runs muse CLIs with different flag surfaces side by side:
1.4.2 (laptop) advertises neither serve --disable-request-user-input
nor exec --disable-reminders, and an unknown option kills the child
before it can serve anything — the warm proxy deployed there failed
every turn instantly. 1.4.13 (sandbox) advertises both.

Probe `serve --help` / `exec --help` on the resolved binary once at
startup, cache the advertised flag sets, and build both spawn argvs
from them. No version strings are compared. If a probe fails,
optional flags are omitted and core flags are still passed, so the
proxy degrades instead of dying. /health reports the probe state and
the dropped flags per subcommand.

Tests: the stub muse gains canned --help surfaces (1.4.2-shaped by
default, 1.4.13-shaped with STUB_HELP_ALL_FLAGS=1) and argv logging;
four new tests pin the omission/pass-through behaviour for both the
exec and warm serve spawns. 13/13 pass.
@dezren39
dezren39 requested a review from a team as a code owner October 24, 2026 17:41
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9b6cdf33-f013-41ea-bfa3-70a17ce9c076
Commits

Reviewing files that changed from the base of the PR and between ae8cc79 and ccb2cac.

Files selected for processing: 2
  • bin/muse-proxy.mjs
  • bin/muse-proxy.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T17:43:01.077193Z ccb2cac PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ccb2cacebb

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/muse-proxy.mjs
Comment on lines +222 to +225
child.on('close', () => {
clearTimeout(timer);
const flags = new Set(out.match(/--[a-z][a-z0-9-]*/g) || []);
resolve(flags.size > 0 ? flags : null);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject failed capability probes before caching their flags

If either help process exits unsuccessfully or is killed after emitting a diagnostic containing a --flag, this handler treats that output as a successful capability probe. For example, a failed probe mentioning --help produces a capability set containing only that flag; the exec argument builder then removes every planned option, including --prompt-file and --json, so subsequent requests launch bare muse exec without the user's prompt. This incorrect capability set is cached until restart. Check the exit code and signal before parsing, and return null for failed or timed-out probes so the existing core-preserving fallback applies.

Useful? React with 👍 / 👎.

dezren39 pushed a commit that referenced this pull request Oct 25, 2026
bin/muse-proxy.mjs conflict resolved by taking main's version: the
live-tree commit a936e16 already carries this PR's warm serve pool
plus the follow-up CLI flag-probe and MUSE_PROXY_EGRESS override (the
superset later stacked as #775). This PR's test file merges cleanly
and passes 9/9 against it.
Base automatically changed from warm/muse-proxy-serve-pool to main October 25, 2026 11:45
@dezren39
dezren39 merged commit a91b6b3 into main Oct 25, 2026
4 checks passed
@dezren39
dezren39 deleted the warm/muse-proxy-cli-flag-tolerance branch October 25, 2026 11:46
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.

1 participant