Skip to content

fix(cli): advertise required CLI selector choices - #6759

Merged
gensokyo-dev merged 376 commits into
morluto:mainfrom
mvanhorn:fix/6467-cli-required-selector-discovery
Oct 23, 2026
Merged

gensokyo-dev merged 376 commits into
morluto:mainfrom
mvanhorn:fix/6467-cli-required-selector-discovery

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #6467. Advertise required selector alternatives in schema, help and the full LLM manifest for seven binary-analysis commands, including inspect-native-api, plus Frida’s exactly-one-script-source rule.

Problem and expected behavior

Separate args/options schemas omit the command description. Optional alternatives must explain their required choice while admitting named-only calls. Main partially covered six commands during review; the new inspect-native-api caller and positional fields still lacked this guidance.

Change and scope

Keep selector guidance with its shared resolver; put the choice on independently consumed fields and agreement details on commands. Decompile distinguishes --file-offset used alone. Preserve handlers, accepted inputs, current main’s path routing and canonical bounds. Split existing multi-command process tests by command with identical requests/assertions and unchanged deadlines. AI-assisted contribution.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: CLI selector owner, command discovery descriptors.
  • Contribution scope fit and linked maintainer decision: Ordinary usability fix within existing authority; separate scope decision not applicable.
  • CLI and MCP/tool-catalog contract: CLI descriptions only; MCP and schema admission unchanged.
  • Provider, bridge, target-format, or platform compatibility: No runtime/provider change.
  • Evidence, artifact, provenance, or reconstruction contract: No change.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): Existing validation and lifecycle retained.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): No authored/generated catalog or install change.

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: Public schema/help/manifest discovery, AJV admission, positional/named/equal/conflicting selectors, leading dashes, source-file offset coordinates and Frida source presence.
  • Base reproduction or other evidence: Clean main bcd18d28 lacks required-choice metadata for inspect-native-api; executed schema-guided caller needs one additional rejected request.
  • User-visible CLI/MCP output (if applicable): rea inspect-native-api --schema --json now describes both alternatives as “Supply at least one of the positional address or --procedure.” Frida fields say “Provide exactly one of --script or --script-file.”
  • Remaining proof gaps: Tests stop at missing targets or invalid PID. No provider/attachment or actual LLM error-rate verification.

For evidence-bearing changes:

Not applicable: this changes discovery guidance; no Evidence contract changes.

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Head b944d42e1, integrated with main bcd18d28; Node 24.22.1/npm 11.16.0:

  • npm run test:focused -- tests/boundary/cli/analysisSelectorCli.test.ts tests/boundary/cli/cliInputSchemaRequired.test.ts tests/boundary/cli/fridaCli.test.ts — 48 passed with default budgets.
  • npm run typecheck, npm run lint:built, npm run metadata:check, npm run verify:architecture-guards and oxfmt --threads=2 --check on all seven changed files — passed.
  • npm run check — blocked by six pre-existing formatting failures; subsequent npm run knip also reports an existing unused export. Both failures reproduced unchanged on clean main bcd18d28; no unrelated files changed.
  • Executed four-command discovery→selector-admission comparison, clean bcd18d28 versus b944d42e1: 9→8 calls, 3,009→2,920 tokenx-estimated argument/reply tokens, 28.18→25.68 s elapsed, 22.62→20.30 CPU-s, sampled family peak 455→451 MiB. Two allowed CPUs, fresh processes, warm filesystem; one observation each, no OS-cold samples. Actual model tokens, prompting/protocol overhead and backend costs are unmeasured. These are constructed caller measurements, not a model-performance claim.
  • CI 40031159513: eight failing test/verification lanes match the actual clean checkout base 1252f17f0 and its main CI run; seven portable shards were cancelled. Static/build/docs and other completed conformance checks passed. Aggregate gate is pending at the time of this update. Exact job links and failure comparisons. Authorized bypass applies only to these proven baseline failures. The earlier local formatting/knip problems on bcd18d28 were fixed by newer main; actual CI static checks pass.

Compatibility, safety, and release

  • Breaking changes or migration steps: None.

  • Real Hopper/Ghidra, browser, or OS coverage: Linux CLI only; provider execution unnecessary for metadata changes.

  • Package or release metadata impact: None.

  • Security, privacy, process, or containment review: Input acceptance and handlers unchanged.

Author readiness

Human owner: @mvanhorn

  • 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.

Post-merge verification at 9dde3fd6: all 48 targeted tests passed again, and the constructed four-command discovery/selector workflow completed with all 8 calls/assertions passing. This verifies the actual merged runtime, not only the PR branch.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T22:07:25.023003Z b944d42 New commits
ℹ️ 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.

@mvanhorn mvanhorn changed the title fix: advertise required CLI selector choices fix(cli): advertise required CLI selector choices Oct 23, 2026
@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no blocking issues remain.

Summary

The PR adds selector-choice guidance to CLI descriptions without changing accepted inputs or handler checks.

  • CLI command descriptions spell out the selector choices callers need.

Reviews (5) · Last reviewed commit: "test(cli): bound selector rejection case..." · Reviewed by Greptile

Comment thread src/cli/coreBinaryCommands.ts Resolved

@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: 32ae0a8181

ℹ️ 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 src/cli/coreBinaryCommands.ts Resolved
@gensokyo-dev

Copy link
Copy Markdown
Collaborator

Follow-up in 698f8cf6c and 564245156 addresses the discovery-size and test-brittleness concerns.

--schema emits only args and options, without the command description. Moving the required-choice rule entirely to the command would therefore leave schema-only consumers without it. I retained the choice on each independently consumed field, shortened the repeated agreement text, and left the source-file-offset explanation on its own field. Decompile schema/LLM-manifest tokenx estimates changed from the proposed 652/596 to 586/508; the old main values were 449/328. These are estimates of rendered outputs, not actual model tokens. The file-offset-alone rule and named leading-dash guidance remain visible.

An initial combined run hit the existing 30-second rejection-case budget; an isolated base run passed in 18.7 s, and the updated-head case later passed in 26.8 s. The structural cause was 12 external CLI invocations sharing one test deadline. That test is now six command-specific cases with the same 12 calls and assertions; no timeout was increased and no semantic case was removed. All 38 tests passed under default budgets, with those cases taking at most 5.7 s. Full npm run check also passed with bounded CPU/memory.

For scope: this is an ordinary discovery-guidance correction; input schemas keep their optional alternatives and handlers are unchanged. There is no new capability or authority requiring a separate maintainer decision. The original author readiness declaration is retained.

A constructed three-command discovery→selector-validation task (missing targets/invalid PID, no backend admission) used 9 calls on main versus 6 when the caller followed the new metadata: 2,674/2,273 estimated request/reply tokens, 37.68/32.08 elapsed seconds, 26.13/14.82 CPU-seconds and sampled family peak 441/438 MiB. Both used two allowed CPUs, fresh processes and warm filesystem. This illustrates the avoided validation retry; it is not an observed LLM error-rate or backend-performance measurement. Raw discovery outputs, all calls/replies and coverage limits were retained locally.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator

CI run 40026612762 is complete with failure. I pinned the actual checkout, rather than relying on the PR branch’s earlier main merge: the CI test merge is e46f4bb89dbee89362a343ef1c820548574f97f8, whose parents are main f4179f511fc78f14d422c42408ecff7336a8d1eb and PR head 5642451561add410b5dbb149e73be548975bd41b.

Every reported test failure reproduced on that clean actual CI base, with identical failure titles:

  • Source tests: 11 failures/155 passes across FridaInstrumentationService, javascriptStaticAnalysis.mapEndpoints, javascriptStaticAnalysisReturnedInvocation and BundleResourcesMcp.
  • Shard 3: 2 failures/23 passes in processCaptureLifecycle.test.ts (external symlink metadata) and advertisedPatternsVMode.test.ts (portable patterns).

Commands: npm run test:local -- src/application/frida/FridaInstrumentationService.test.ts src/domain/javascript/javascriptStaticAnalysis.mapEndpoints.test.ts src/domain/javascript/javascriptStaticAnalysisReturnedInvocation.test.ts src/server/BundleResourcesMcp.test.ts; npm run test:focused -- tests/boundary/process/processCaptureLifecycle.test.ts tests/boundary/mcp/advertisedPatternsVMode.test.ts. Baseline runtime artifacts were rebuilt first.

The other seven shards were cancelled by fail-fast; they did not pass. Portable tests and CI required failed as aggregates. Static checks, package build, bundled Windows native controls and Linux native package baseline passed. Latest Codex review has no actionable findings, Greptile passed, and both old coordinate-guidance threads are resolved with executed CLI evidence.

Independent default-budget selector/schema/help/manifest/Frida validation passed all 38 tests and full npm run check. Main has since advanced to f4703505 without changing CLI/dependencies; final local integration verification is running there. No pass is yet claimed for that last rerun.

@gensokyo-dev gensokyo-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed final head 5642451561add410b5dbb149e73be548975bd41b. The discovery correction preserves the existing selector-validation owner and accepted inputs. Mandatory choices remain visible in each independently emitted args/options schema; equal-selector guidance excludes source-file offsets, whose own description retains the separate coordinate meaning. Frida’s exactly-one-script guard remains before target admission.

The follow-up avoids repeating unnecessary explanation and removes a deadline-sharing representation in the touched selector rejection test: one 12-invocation case became six command-specific cases with the same 12 calls and assertions. No global timeout was increased and no semantic coverage was removed. All 38 relevant default-budget schema/help/manifest/AJV/CLI/Frida tests and full npm run check passed. The exact equal-text address/file-offset case was executed through the compiled CLI; both old review threads are resolved. Detailed output-token estimates, constructed workflow measurements and their limits are in the body/follow-up; no backend or actual LLM-token verification is claimed.

Main advanced to f470350528ffdfd3f1ec800ffafbf24ae5c7b593; I integrated the unchanged PR there (tree 4cf499db919559f0aad1e3e337e56a365d02da34) and reran the same 38 tests plus full check successfully. I found no remaining directly related cleanup.

CI run 40026612762 completed with 13 test failures; every failure title reproduced on the actual clean CI checkout base f4179f511fc78f14d422c42408ecff7336a8d1eb, confirmed from test-merge e46f4bb89dbee89362a343ef1c820548574f97f8 parents. The other seven shards were cancelled by fail-fast and did not pass. Static/build/native-package checks and automated reviews succeeded. Approval records the code review and executed validation above; it does not relabel failed/cancelled CI checks.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator

Final verification for reviewed head 5642451561add410b5dbb149e73be548975bd41b: 38 default-budget tests and full npm run check passed again after integrating onto latest fetched main f470350528ffdfd3f1ec800ffafbf24ae5c7b593 (tree 4cf499db919559f0aad1e3e337e56a365d02da34). The final constructed discovery→selector-validation workflow also passed: 6 calls, 23.33 elapsed seconds, 17.11 CPU-seconds, sampled process-family peak 442 MiB. The comparative samples documented above were pinned to main 33d00a06 and pre-publication integration c9dfc2fc; their production CLI selector implementation is identical to the published follow-up. Timing observations do not establish an LLM/backend speedup.

CI run 40026612762 completed with 13 test failures, all reproduced on actual clean CI base f4179f511fc78f14d422c42408ecff7336a8d1eb (11 Source tests failures and 2 shard-3 failures; exact titles matched). That base was verified from the parents of CI checkout merge e46f4bb89dbee89362a343ef1c820548574f97f8, separately from the PR branch’s older main ancestor. The other seven shards were cancelled by fail-fast, not passed; Portable tests and CI required failed as aggregates. Full baseline commands/results are linked in the previous attribution comment.

Static checks, package build, Windows native controls, Linux native package baseline, PR title/readiness and Greptile passed. Updated Codex review has no actionable findings. Both coordinate-guidance threads are resolved with exact compiled CLI checks and no directly related cleanup remains.

Applying the maintainer’s explicit authorization to bypass proven pre-existing/unrelated CI failures and merge this exact reviewed head. Failed and cancelled checks remain recorded as such.

@gensokyo-dev gensokyo-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the reconciled final diff against main bcd18d28. The missing rule belongs to discovery metadata: separate args/options schemas cannot inherit the command description. Shared selector guidance now lives with the selector owner, covers the new inspect-native-api consumer, and preserves the actual handler and schema admission rules, including source-file-offset coordinate separation. Current main path routing and canonical bounds are retained. The affected CLI tests now assign process budgets per command while preserving all requests/assertions and default deadlines. All 48 targeted tests, typecheck, lint/module boundaries, metadata, architecture guards and touched-file formatting passed. The full-check formatting failures and knip unused export reproduce on clean main; CI for this head remains pending. No related cleanup remains in the touched guidance ownership. This is an AI-assisted technical review and does not assert a new human review.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator

Final CI attribution for head b944d42e1d5f04a2e0837827d45dca9cd2367283:

The CI checkout is merge 2ca2752711c2c32e55275b0a320d0d689db3e3f6, whose first parent is 1252f17f0ebd9a072e30b97056be503590a81dd9. This is the actual base, rather than the PR API’s older base field. Its own main CI run 40030983321 provides same-platform controls.

Failing lane PR job Exact-base main job Compared evidence
Source head base Identical 101 unique failing test titles; no head-only failures
Portable shard 5 head base Identical 42 unique failing test titles; no head-only failures
Windows capability/package head base Identical 25 unique failing test titles; no head-only failures
Reverse tools quality head base Identical 11 failing titles; also reproduced all 11 on clean local base
Apple E2E head base Same partial versus complete assertion at macos-dylib-e2e.mjs:190
Binary layout head base Same missing PLT entries at verify-binary-layout.mjs:1024
Browser head base Same stable capture-identity reconciliation error at verify-real-browser.mjs:197
Web runtime head base Same CLI exit 1 versus 0 at browser-runtime-e2e.mjs:277

Static checks, build, documentation, website checks, Windows native controls, Ghidra bridge compilation and the remaining completed conformance lanes passed. Seven other portable shards were cancelled by fail-fast, not passed. The aggregate CI required job is still queued when writing this note. The product-catalog failure inside shard 5 specifically concerns unchanged recover-javascript-sources.options.extractionMode/rewriteLevel, not this PR’s descriptors.

All 48 targeted discovery/selector/Frida tests passed locally at the final head with default budgets. Typecheck, lint/module boundaries, metadata, architecture guards and all seven changed-file formatting checks passed. Initial full local check failures on integration base bcd18d28 are documented in the body; clean actual CI base 1252f17f0 has since fixed both its formatting and knip issues, and CI static checks passed. No unrelated cleanup was added.

The description has been rewritten for the final seven-command/shared-owner scope and current benchmark pins. Original author initial readiness is preserved. Final technical review: 5634947383. User authorization permits bypass for proven unrelated/main failures; using it for merge with these validation gaps recorded. No new human review is asserted.

@gensokyo-dev
gensokyo-dev merged commit 9dde3fd into morluto:main Oct 23, 2026
33 of 50 checks passed
@gensokyo-dev

Copy link
Copy Markdown
Collaborator

Verified actual squash-merge commit 9dde3fd6a4da2a4b00141e59771b7c6765e1bfb9: all 48 targeted tests passed again with default budgets after rebuilding its runtime. The four-command public CLI discovery→selector-admission workflow also passed all 8 calls/assertions. Test/build task: 84.13 s elapsed, 115.75 CPU-s, sampled peak process-family RSS 1,700 MiB; workflow: 18.33 s, 22.00 CPU-s, 460 MiB. These are bounded Linux verification runs, not provider or model-performance claims.

@morluto morluto mentioned this pull request Oct 25, 2026
3 tasks done
@morluto morluto added area: cli CLI adapter and one-shot commands bug Something isn't working labels Nov 23, 2026
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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] decompile and related CLI schemas omit required selector choices

4 participants