Skip to content

fix(pwntools): report actionable configuration recovery - #3088

Closed
jpdefo wants to merge 1 commit into
morluto:mainfrom
jpdefo:fix/pwntools-recovery-guidance
Closed

jpdefo wants to merge 1 commit into
morluto:mainfrom
jpdefo:fix/pwntools-recovery-guidance

Conversation

@jpdefo

@jpdefo jpdefo commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #3055.

Unavailable pwntools operations now name the relevant configuration key and the actual refusal in both the top-level error message and recovery action. Previously these fields recommended rea doctor, which cannot diagnose pwntools.

Problem and expected behavior

On Linux x64, run inspect-binary-layout or inspect-recorded-crash with REA_PWNTOOLS_PYTHON unset, pointing to a directory, or pointing to a missing file. Before this change all six cases recommend doctor. They now expose the configuration requirement or path failure already retained in the provider rejection.

For example, a directory produces REA_PWNTOOLS_PYTHON: Selected Python executable must be a regular executable file, not a directory: <selected path> in message and remediation.action.

Change and scope

Add optional provider-owned recovery guidance to ProviderSelectionError, preserving its existing default. Supply that guidance from pwntoolsUnavailable, using its actual configuration key so input-limit errors still identify REA_PWNTOOLS_MAX_INPUT_BYTES. Narrow the CLI guide's doctor advice to its supported providers.

Contract and boundary impact

  • Semantic owner and earliest changed stage: pwntools refusal construction, before shared CLI/MCP error projection.

  • Contribution scope fit and maintainer decision: routine correction within an existing provider. Advance scope decision is not applicable.

  • CLI and MCP/tool-catalog contract: message and recovery text change. Error codes, retryability, provider identity, rejection details, and captured output are preserved. No schema or catalog change.

  • Provider, bridge, target-format, and platform compatibility: no provider execution, bridge, supported-format, or host-admission change. Default Hopper/Ghidra/IDA advice is preserved.

  • Evidence, artifacts, provenance, and reconstruction: unchanged.

  • Target selection, authority, and cleanup: unchanged. Regression fixtures use exact-path cleanup.

  • Generated metadata, package, and installation: no changes.

  • Documentation or usability only, no new target interaction.

Evidence and regression coverage

  • Two new portable regressions failed on the original source and passed after the fix.
  • The original compiled CLI at c7105d9723c835b5e0122f5fc6cfbea86265c349 reproduced the misleading guidance in all six scenarios on Ubuntu WSL x64. The same six compiled-CLI checks passed with the corrected guidance.
  • New integration tests exercise both real provider admission paths for unset, directory, and missing Python configuration.
  • Portable tests cover launch failure, alternate configuration keys, retained output, and default doctor recovery for Hopper/Ghidra/IDA.

Validation performed

Using the pinned Node 24.18.0 and npm 11.16.0:

  • Windows npm run check: passed, including typecheck, lint, format, knip, metadata, module boundaries, and architecture guards.
  • Windows npm run docs:check: passed, including five README consistency tests.
  • Windows selected source tests: 77 passed.
  • npm run verify:test-discovery: all 1,235 test files discovered exactly once.
  • Linux focused source and binary-diagnostics boundary tests: 155 passed, one expected skip for the unsupported-host case.
  • Linux compiled CLI: six before/after configuration scenarios passed.
  • Linux real pwntools 4.15.0, pyelftools 0.33, and Unicorn 2.1.2: a configured inspect-binary-layout call on a locally compiled ELF passed, and the selected file's SHA-256 remained unchanged.

Compatibility, safety, and release

No breaking change, migration, or release metadata change. Tests cover refusal and existing provider-boundary behavior. The full real-provider verification lanes, including strace and the optional GDB/pwndbg recorded-core workflow, were not run. Windows was used for portable checks, Ubuntu WSL for this Linux-specific issue.

Implementation and two independent code-review rounds used Codex, with four Luna reviewers and one Sol reviewer per round. The final round reported no actionable findings. A documentation overclaim found in the first round was corrected and all five reviews repeated.

Before merge

  • Concrete problem and linked issue.
  • Existing scope and authority preserved.
  • One focused outcome with a conventional title.
  • Regression coverage for changed observable behavior.
  • Owning guidance updated and generated checks passed.
  • Representative caller-visible output included.
  • Final diff checked for secrets, unrelated changes, and unsupported claims.

Preserve provider-owned guidance in selection errors so unavailable pwntools operations identify their configuration and failure instead of recommending an unsupported doctor route.

Fixes morluto#3055
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Pwntools failures now name the relevant configuration key and actual refusal in both message and remediation.action.

  • Pwntools errors name the setting and refusal callers need to fix.

No actionable correctness or security issues were found. Tests were inspected, not run. Whether this PR is superseded could not be checked because GitHub access required authentication.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Pwntools refusal] --> B[pwntoolsUnavailable]
  B --> C[ProviderSelectionError with userMessage]
  D[Other provider selection failure] --> E[Existing default message]
  E --> F[Shared error projection]
  C --> F
  F --> G[message]
  F --> H[remediation.action]
Loading

Reviews (1) · Last reviewed commit: "fix(pwntools): report actionable configu..." · Reviewed by Greptile

@jpdefo

jpdefo commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #3087, which was opened shortly before this PR while our work was already underway. The production fixes overlap, so keeping both open would add duplicate review work. Our local verification also reproduced the original error through both real CLI commands on Ubuntu Linux, checked the unset/directory/missing-Python cases after the fix, and completed a positive configured pwntools 4.15.0 run against a benign ELF. This evidence applies to the overlapping recovery approach, not a claim that the exact head of #3087 was tested. Thanks for addressing this.

@jpdefo jpdefo closed this Oct 14, 2026
@morluto morluto added the bug Something isn't working label Oct 14, 2026
@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

@jpdefo, thanks for showing that the generic doctor recommendation could not resolve a pwntools configuration refusal. The provider error now carries the selected key and concrete reason into the user-facing recovery guidance (main).

@morluto morluto added area: setup Setup, packaging, upgrade, install, Doctor, and client registration provider: pwntools Analysis provider / engine: pwntools labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working provider: pwntools Analysis provider / engine: pwntools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Unconfigured pwntools commands recommend rea doctor, which cannot diagnose pwntools

2 participants