Skip to content

fix(android): name the JADX deadline and recover apktool decode - #6024

Merged
morluto merged 4 commits into
mainfrom
cursor/android-jadx-apktool-deadlines-5ac1
Oct 21, 2026
Merged

morluto merged 4 commits into
mainfrom
cursor/android-jadx-apktool-deadlines-5ac1

Conversation

@morluto

@morluto morluto commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Refs #5910 (parent #5808). JADX operation timeouts now name REA_JADX_OPERATION_TIMEOUT_MS, the effective milliseconds, the range 1 to 2147483647, and that a change applies on the next process start.

Apktool decode accepts decode_timeout_ms (CLI --decode-timeout-ms). Omitted means 600000 ms. The integer range is 1 to 2147483647. A timeout names that key, and a change applies on the next decode. It does not raise the 4194304-byte output capture allowance.

ADB command deadlines, the adb version probe, the apktool version probe, and the JADX Java module-listing probe stay at their current numbers and say this release has no runtime override.

Problem and expected behavior

A JADX operation that reached its deadline reported only the generic provider timeout. The failure did not name REA_JADX_OPERATION_TIMEOUT_MS, the effective milliseconds, the accepted range, or that the value is read from the environment captured at process start.

apktool d used a fixed 600000 ms wall clock. A stopped decode did not name a control the caller could set on the next decode. The 4194304-byte output capture allowance stayed fixed.

ADB deadlines and version probes failed without saying this release has no runtime override.

Change and scope

  • JADX timeout projection (captureJadxFailure, archive inspection, and the Java probe when the operation deadline aborts it) uses jadxOperationTimeoutGuidance. The env var, parser, and 120000 ms default are unchanged. The provider still receives the snapshotted launch environment, so a change applies on the next process start. The 30000 ms bridge startup handshake stays fixed.
  • decode_android_resources gains optional decode_timeout_ms. Omitted stays omitted in Evidence and the provider uses 600000. CLI --decode-timeout-ms maps to that field. At 2147483647 the recovery says not to increase it further.
  • ADB runAdbCapture timeouts and output-cap refusals, the adb version probe, the apktool version probe (including Windows PATH lookup), and the Java module-listing probe name the effective value and say there is no runtime override. decode_timeout_ms and REA_JADX_OPERATION_TIMEOUT_MS do not raise those probes.
  • Capture refusals keep that no-runtime-override sentence in the fixed-allowance name. Recovery is derived from the allowance. decode_timeout_ms does not raise the apktool output cap.
  • A POSIX production-boundary test launches a hanging interpreter and a pipe-holding child through ApktoolProvider, waits until both are alive, and requires the owned-command deadline to elapse before provider_timeout with completed cleanup.

Out of scope: MCP response and startup ceilings, JEB/IDA/command_timeout_ms, JavaScript heap and semantic ceilings, browser, native, swiftc, engines, and ASAR. The measured JADX JAR central-directory budget is unchanged.

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.

Not applicable. This names an existing JADX launch-environment deadline and adds a caller-selected wall clock to the existing apktool decode. It does not add a provider, target execution, injection, mutation, or protection recovery.

Contract and boundary impact

  • Semantic owner and earliest changed stage: JadxRelease owns the JADX deadline sentence. apktoolInputSchemas.decode_android_resources owns decode_timeout_ms. ApktoolProvider applies it to the decode command. ADB and version-probe text stays at the command owners that already fail the call.
  • Contribution scope fit and linked maintainer decision: not applicable. Recovery and one existing-workflow deadline inside the current Android and apktool boundaries.
  • CLI and MCP/tool-catalog contract: decode_android_resources accepts optional decode_timeout_ms (CLI --decode-timeout-ms). Omitted means 600000 and is absent from parameters. Tool description names the default, range, and that the output cap and version probe stay fixed. docs/public/product-catalog.json is generated and was not committed.
  • Provider, bridge, target-format, or platform compatibility: none. JADX still requires the caller-supplied JAR. Apktool is still bring-your-own.
  • Evidence, artifact, provenance, or reconstruction contract: a selected decode_timeout_ms is retained in Evidence parameters. Omitted stays omitted. Result fields are unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): the selected deadline bounds the existing owned apktool d process. It does not raise the output capture allowance. On POSIX, the hanging-launcher test observes the launcher and its pipe-holding child gone after the deadline, with cleanupIncomplete false.
  • 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): the Android skill sentence now names the JADX range and next process start. No package 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: tests/boundary/providers/apktoolDecodeDeadline.test.ts, src/android/JadxOperationTimeout.test.ts, src/apktool/ApktoolDecodeTimeout.test.ts, src/domain/apktool/apktoolResourceAnalysis.test.ts, src/apktool/ApktoolVersionProbe.test.ts, src/adb/AdbCommand.test.ts, src/adb/AdbVersionProbe.test.ts, tests/boundary/android/jadxConfiguration.test.ts, tests/boundary/cli/apktoolBooleanOptions.test.ts.
  • Base reproduction or other evidence: source inspection. JADX AnalysisTimeoutError sites passed only the millisecond count into the generic timeout sentence. DECODE_TIMEOUT_MS was a private 600000 constant with no input field. The module test still projects the omitted 600000 deadline, a selected 5000 ms decode, and the maximum "do not increase it further" sentence. The boundary test runs a real hanging launcher.
  • User-visible CLI/MCP output (if applicable): --decode-timeout-ms 900000 is accepted and omitted means the field is absent. 0 and 2147483648 are rejected before the provider runs. MCP advertisement of decode_android_resources still matches the contract.
  • Remaining proof gaps: the maximum 2147483647 ms sentence is projected, not waited out. No upstream apktool or JADX distribution was launched; the hanging launcher is a Node script selected with REA_APKTOOL_COMMAND. The deadline test skips Windows, so it does not establish Job Object cleanup. The Java module-listing probe test did run a hanging fake JDK and observed the 10000 ms no-override sentence.

For evidence-bearing 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

  • npm run check:fast — typecheck and lint succeeded.
  • npm run test:focused -- the apktool, android, and adb source tests plus tests/boundary/providers/apktoolDecodeDeadline.test.ts, tests/boundary/android/jadxConfiguration.test.ts, tests/boundary/cli/apktoolBooleanOptions.test.ts, tests/boundary/cli/apktoolLocaleOption.test.ts, tests/boundary/cli/apktoolCli.test.ts, and tests/boundary/mcp/apktoolMcp.test.ts — 24 files, 487 tests passed. The hanging-launcher case settled in about 2600 ms for a 2500 ms deadline.

Merged origin/main through d8a9673fc before these runs. The branch was behind and CI on the previous head was green.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Omitted decode_timeout_ms keeps today's 600000 ms decode. Existing JADX environment values parse as before. Callers that matched the generic timeout sentence will see the named control.
  • Real Hopper/Ghidra, browser, or OS coverage: POSIX process-group cleanup of the hanging apktool launcher was observed. Windows Job Object cleanup of that launcher was not run. No Hopper, Ghidra, or browser behavior changed.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the new field only lengthens or shortens the existing owned apktool decode, within 1..2147483647 ms. It does not add authority. Fixed capture allowances are unchanged.

Author readiness

Human owner: @morluto

  • 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.
Open in Web Open in Cursor 

JADX operation timeouts now name REA_JADX_OPERATION_TIMEOUT_MS, the
effective milliseconds, the 1..2147483647 range, and that a change applies
on the next process start. Apktool decode accepts decode_timeout_ms,
omitted means 600000, and a timeout names that key. ADB deadlines and
apktool and Java version probes stay fixed and say there is no runtime
override.

Refs #5910

Co-authored-by: morluto <[email protected]>

@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: cad82918d4

ℹ️ 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".

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T16:11:29.799269Z 0ef83e4 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.

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

This PR names the JADX timeout setting and adds an optional apktool decode deadline.

  • Apktool resource decoding accepts a deadline chosen for each decode.
  • JADX timeout messages explain which deadline was reached and how to change it.
  • Android command and probe errors name their fixed time and output limits.

Review checks used source inspection; no tests were run during this review. Whether another PR supersedes this one could not be checked because GitHub access was unavailable.

Reviews (2) · Last reviewed commit: "test(apktool): observe a real decode dea..." · Reviewed by Greptile

cursoragent and others added 2 commits October 21, 2026 15:57
Main now stores a fixed allowance instead of a prebuilt remediation
string. Apktool and adb capture refusals keep the no-runtime-override
sentence in that allowance name, including that decode_timeout_ms does
not raise the apktool output cap.

Co-authored-by: morluto <[email protected]>
A hanging interpreter launcher and its pipe-holding child stay alive
until decode_timeout_ms elapses. The provider then reports
provider_timeout with completed cleanup, and both processes are gone.

Co-authored-by: morluto <[email protected]>
@morluto
morluto merged commit 01788ba into main Oct 21, 2026
41 of 42 checks passed
@morluto
morluto deleted the cursor/android-jadx-apktool-deadlines-5ac1 branch October 21, 2026 16:31
@github-actions github-actions Bot mentioned this pull request Oct 21, 2026
3 tasks done
@morluto morluto added bug Something isn't working provider: apktool Analysis provider / engine: apktool provider: jadx Analysis provider / engine: jadx area: runtime Process capture and runtime observation labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working provider: apktool Analysis provider / engine: apktool provider: jadx Analysis provider / engine: jadx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants