Skip to content

refactor(cli)!: name a failure's per-call control flag at the CLI boundary - #11413

Merged
morluto merged 3 commits into
mainfrom
refactor/cli-limit-flag-owner
Nov 15, 2026
Merged

morluto merged 3 commits into
mainfrom
refactor/cli-limit-flag-owner

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Services now name only the contract field a per-call control failure reports; the CLI adds the flag. details.limit with control_kind: "parameter" keeps parameter (the contract field) on every surface, and a contract command's output projection adds cli_flag from that command's own field-to-flag binding. Native deadline remediation text no longer names CLI flags. Structural audit plan W1 item 4, first slice under the coordinator decision: "services name the field only; the CLI adapter, through the one field-to-flag mapping owner, renders the CLI option in CLI output". The cli-option-text-outside-cli guard (#11315) ratchets from 41 to 37.

Problem and expected behavior

nativeDeadlineRecovery took a cliFlag from each service (--native-command-timeout-ms, --native-ui-deadline-ms, --pwntools-timeout-ms), wrote "or pass --flag on the CLI" into the remediation and returned limit.cli_flag. Every service thus held a copy of the CLI's option spelling, which goes stale when a command renames its option, and MCP callers received CLI instructions. Expected: the service names the field; the CLI, which owns the spelling, names the flag in CLI output.

Change and scope

  • ContractCliDescription.inputBinding.flags (owner): each contract field, or field.member for a flattened member option, that the command takes as an option, mapped to its --kebab-case flag. Positionals and delivery options are excluded.
  • projectCliInputFields (already applied to every contract command's output): besides renaming issue paths, it adds details.limit.cli_flag when the failure reports a parameter control the command takes. The longest bound prefix of the parameter path names the flag, so producer_limits.output_bytes maps to --producer-limits. A control the command does not take gets no flag.
  • Domain: AnalysisControlLimit drops cli_flag; nativeDeadlineRecovery drops cliFlag, and its text names the field only. Sites: NativeUiInterruptionControl, NativeCommandAnalysisError (2), PwntoolsFailures (timeout).
  • docs/design/limits-and-recovery.md states who adds cli_flag.
  • Not included (37 remaining guard sites, listed in the coordinator record): numeric controls still written as text (several of their commands are hand-built cli.commands that do not pass through this owner yet, so they first need registerContractCommand), result limitation text, selection hints, and text that names CLI-only commands.

Ordinary refactor within existing boundaries; maintainer scope decision covered by the coordinator's item 4 decision.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the contract command description owns field-to-flag spelling; services own limit.parameter.
  • Contribution scope fit and linked maintainer decision: coordinator decision on item 4 (W1).
  • CLI and MCP/tool-catalog contract: MCP failures lose details.limit.cli_flag and the "or pass --flag on the CLI" clause; CLI failures of contract commands keep cli_flag. Schemas unchanged (details is open).
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): unchanged.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/cli/cliControlFlag.test.ts (new): a contract command whose handler returns a deadline failure built by nativeDeadlineRecovery reports cli_flag: "--worker-timeout-ms" on the CLI while the MCP projection has no cli_flag and no -- text; member and whole-field flags and unbound controls. NativeCommandAnalysisError.test.ts and PwntoolsFailures.test.ts no longer expect cli_flag from the service; projectCliAnalysisResult.test.ts binding gains flags.
  • Base reproduction or other evidence: with this PR's tests and the previous projectCliAnalysisResult.ts, the build fails (the binding has no flags), and the CLI assertion needs the added cli_flag.
  • User-visible CLI/MCP output (if applicable): MCP details.limit for native_command_timeout_ms: { control_kind: "parameter", parameter: "native_command_timeout_ms", effective_value, unit, minimum, maximum, default_value, applies_at }; CLI inspect-macho adds cli_flag: "--native-command-timeout-ms".
  • Remaining proof gaps: no real macOS native command or pwntools timeout run.

Validation performed

  • npm run check:fast — passed; node scripts/verify/architecture-guards.mjs --shrink-baselines lowered cli-option-text-outside-cli to 37 sites in 21 files.
  • npm run test:focused -- over cliControlFlag, projectCliAnalysisResult, NativeCommandAnalysisError, PwntoolsFailures, NativeUiObservation, cliContractCommandParity, utilityIntegerOptions, nativeDeadlineFlags, contractCommandInputFields, contractJsonInputChecks — 10 files, 1126 passed.
  • npm run docs:check — passed.
  • 14c1c3b (Greptile): nested flattened members are keyed by their dotted path, and the test restores process.exitCode. The new nested-binding test fails with the old key. npm run check:fast passed; cliControlFlag, cliContractCommandParity, projectCliAnalysisResult: 1047 passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: yes (!). Before, an MCP provider_timeout for native_command_timeout_ms carried details.limit.cli_flag: "--native-command-timeout-ms" and remediation "... or pass --native-command-timeout-ms on the CLI". Now MCP carries the field only; CLI output of contract commands still carries cli_flag. Read details.limit.parameter for the field; a CLI wrapper reads cli_flag from CLI output. No alias: the domain no longer knows CLI spellings.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Collapsed into this PR

  • refactor(reverse): bind command_timeout_ms as the per-call control of an objdump or Rizin deadline #11442 refactor(reverse): an objdump or Rizin command deadline now comes from nativeDeadlineRecovery and binds command_timeout_ms (details.limit, control_kind: "parameter"); the service no longer writes --command-timeout-ms. Regression: reverseEngineeringCommands.test.ts runs the objdump CLI command over the real service with an owned-command timeout and asserts cli_flag: "--command-timeout-ms" (fails with the service change reverted: 1 failed, 14 passed). Baseline ReverseEngineeringService.ts 2 → 1.
  • refactor(wasm): bind max_artifact_paths as the per-call control of an auxiliary path admission refusal #11444 refactor(wasm): an inspect_wasm_artifact glue/candidate selection over max_artifact_paths binds that field as its limit (unit: "count"); the remediation drops --max-artifact-paths. Regression: wasmAcquiredInputsCli.test.ts runs the built rea inspect-wasm-artifact ... --max-artifact-paths 1 and asserts cli_flag: "--max-artifact-paths" (fails with the change reverted). Baseline WasmArtifactService.ts 1 → 0.
  • Validation for both: npm run test:focused -- reverseEngineeringCommands, reverseEngineeringPartialMcp, reverseProviderLaunchErrors, wasmAcquiredInputsCli, wasmArtifactMcp — all passed; --shrink-baselines and npm run check:fast — passed.
  • Neither is breaking: details.limit is additive and only remediation prose changes.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

BREAKING CHANGE: MCP failures no longer carry details.limit.cli_flag, and native deadline remediation text no longer names the CLI flag. CLI output of contract commands still reports cli_flag.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T19:27:47.759321Z
We couldn’t complete this review. Comment @codex review to try again.
07cffd8 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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge; no new actionable issue was found.

Summary

Services report the contract field that controls a failure. The CLI adds its own flag spelling through the shared command description.

  • Contract-command failures show the flag that sets each per-call control.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Service["Service reports parameter and limit facts"] --> Error["Shared error output"]
  Error --> MCP["MCP keeps contract field"]
  Error --> CLI["CLI reads command binding"]
  Binding["Command owns field-to-flag map"] --> CLI
  CLI --> Output["CLI adds cli_flag when bound"]
Loading

Reviews (4) · Last reviewed commit: "refactor(reverse): bind command_timeout_..." · Reviewed by Greptile

Comment thread src/cli/contractCliDescription.ts Resolved
…ndary

Services name the contract field a deadline failure reports in
details.limit.parameter; a contract command's output projection adds
details.limit.cli_flag from the command's own field-to-flag binding.

BREAKING CHANGE: MCP failures no longer carry details.limit.cli_flag, and
native deadline remediation text no longer names the CLI flag. CLI output
still reports cli_flag for the command that ran.
@morluto
morluto force-pushed the refactor/cli-limit-flag-owner branch from 07cffd8 to 14c1c3b Compare November 15, 2026 19:40
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review

… an objdump or Rizin deadline (#11442)

* refactor(reverse): bind command_timeout_ms as the per-call control of an objdump or Rizin deadline

The deadline failure now comes from nativeDeadlineRecovery: it names command_timeout_ms and carries limit {control_kind: "parameter"}, so the CLI projection adds --command-timeout-ms and MCP output names the field only. The service no longer writes CLI flag text.

* refactor(wasm): bind max_artifact_paths as the per-call control of an auxiliary path admission refusal (#11444)
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant