Repository navigation
fix(cli): reject an unknown or empty lobster run --mode value - #220
KrasimirKralev wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review Summary: ✅ CompletedThis 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. |
|
Codex review: ready, awaiting a maintainer decision. What this changesReject unknown, empty, or missing run-mode values with exit code 2 before executing a pipeline or workflow. Example: Run lobster run 'exec --json "echo [1]"' --mode tools.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⏳ Ready, awaiting maintainer decision This PR addresses behavior still present on main with a focused, correct patch; accepting the removal of the longstanding human-mode fallback remains an owner decision. Priority: P2 Decision needed
Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe CLI parses run arguments, resolves a pipeline or workflow file, executes it, and renders human output or a tool JSON envelope. flowchart TD
A[CLI arguments] --> B[Parse run arguments]
B --> C[Validate mode]
C --> D[Input error and exit 2]
C --> E[Resolve pipeline or workflow]
E --> F[Execute and render output]
Technical reviewBest possible solution: Land the focused validation through the existing CLI error reporter once the CLI owner accepts the compatibility change. Do we have a high-confidence way to reproduce the issue? Current-main parsing and normalization establish the silent fallback, corroborated by the contributor's base-versus-branch CLI transcript; no target code was executed during this read-only review. Is this the best way to solve the issue? Preserving the supplied value, validating before execution, and reusing reportRunError is the smallest complete fix shown. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3d168c79cdd8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 16, 2026, 3:01 AM ET / 08:01 UTC (Revision 2). |
8f41577 to
38f5687
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What Problem This Solves
lobster run --mode tools '<pipeline>'(a one-letter typo oftool) runs the pipeline in human mode and exits 0, so a caller that asked for the JSON tool envelope gets plain human output and no error. The same happens for--mode=TOOL,--mode=and a trailing--modewith no value; a bare--modeplaced before the pipeline swallows the pipeline as its value and then fails with an unrelatedParse error: Empty pipeline.normalizeModeinsrc/cli.tsmapped every value other thantooltohuman, andparseRunArgsturned an empty--mode=intohumanand ignored a trailing--modewith no value.lobster run --mode.human(still the default when--modeis absent) andtoolbehave exactly as before;resume,graph, the core tool API and every pipeline command are untouched.User Impact
A tool integration or script with a mistyped or empty
--modenow getsParse error: --mode must be "human" or "tool", got "<value>"on stderr with exit code 2, before anything runs, instead of a silent fallback to human output that its JSON parser then chokes on. This narrows the accepted values to the two documented ones; any script that relied on an arbitrary--modevalue meaning "human" now has to drop the flag or passhuman.Why This Change Was Made
normalizeModereturns"human" | "tool" | null, andhandleRunreportsnullas a parse error (exit 2, human stderr form because the requested mode is unknown).parseRunArgskeeps an empty--mode=and a trailing value-less--modeas"", the same way it already handles--args-json, so both are rejected too.=== "tool" ? "tool" : "human"fallback, so every unrecognised value silently became human mode.--mode. New cases intest/cli_run_errors.test.tsrunbin/lobster.js runwith--mode tools,--mode=TOOL,--mode=and a trailing--mode, and check exit 2, empty stdout and the exact stderr line; one more pins that--mode humanstill prints the human output.src/cli.tschange reverted, the full suite fails exactly the 4 rejection cases (753/757); with it, 757/757 pass.pnpm lintandpnpm typecheckare clean.## Unreleased.Evidence
lobster run --mode <unknown or empty>no longer falls back to human output with exit 0.pnpm run build) at upstream473b1f7+ this commit.node bin/lobster.js run 'exec --json "echo [1]"' --mode <value>with the same six--modeforms below, onmainand on this branch (each followed byecho "exit=$?").node bin/lobster.js runwithtools,TOOL, an empty value or no value now stops with the parse error and exit 2 before the pipeline runs;humanandtoolproduce the same output as onmain.--file) with a bad--mode; it goes through the same check at the top ofhandleRun, before the target is resolved.