Skip to content

fix: bound command output and colocate fuzz coverage - #4621

Open
thymikee wants to merge 9 commits into
fix/a1-extraction-unused-import-20261116from
fix/0.22-command-output-fuzz-prerequisite
Open

thymikee wants to merge 9 commits into
fix/a1-extraction-unused-import-20261116from
fix/0.22-command-output-fuzz-prerequisite

Conversation

@thymikee

@thymikee thymikee commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Bound captured host-command output by raw bytes per stream while preserving timeout, cancellation and decoding behavior. Cloud WebDriver host commands use a 10 MiB per-stream cap; exceeding it rejects with command_output_limit. Output-limit errors retain already-captured stdout and stderr, including when allowFailure is set. Move fuzz support to test-kit and keep fixed-seed Maestro completeness beside the parser. The 12-file prerequisite supports #4617 and targets #4579.

Validation

At 472f2c2ded1c0994131f77e420d87b5e8fa595b6, local exact-head affected passed (42 passed, 25 skipped; unchanged checkout). Real-process prefix regression passed for both streams; an isolated parent experiment failed on missing details. The nine prerequisite patches are unchanged by range-diff onto #4579 at dfa349fd5d8dbdf89b22a9ef53c9e0bb149f3db1. Prior bounded source reviews and coordinator follow-ups covered executor and fuzz ownership; the diagnostic fields received a coordinator cold review. Hosted checks completed without failures: 13 successful, one skipped and one neutral. Sentinel reports no findings; all five review threads are resolved. Land #4579 first. Its new review fixes and the dependent restack remain pending; no merge clearance.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.13 MB 6.13 MB +596 B
Package (unpacked) 6.12 MB 6.13 MB +596 B
Package (download) 1.86 MB 1.86 MB +304 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 23.4 ms 26.3 ms +2.8 ms
CLI --help 49.6 ms 50.8 ms +1.1 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 12 files

You’re at about 99% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/host-kit/src/internal/exec.ts Resolved
@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

Reviewed with this repository's own Sentinel configuration (fce2fa6247c5).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

Earlier reviews

Review of 00e8e055 · 17.11.2026 09:38 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised

No open findings.

2 findings below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (e0ab0c255c3d).

Review of 34b1daa0 · 17.11.2026 08:31 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 1 still open · 0 no longer raised

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/host-kit/src/internal/exec.ts:264 Output-limit breach throws even for callers that pass allowFailure: true

Reviewed with this repository's own Sentinel configuration (e0ab0c255c3d).

Review of 372a542f · 17.11.2026 07:17 UTC

Apex Sentinel · ✅ Approve

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/host-kit/src/internal/exec.ts:264 Output-limit breach throws even for callers that pass allowFailure: true

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (e0ab0c255c3d).

@apex-sentinel-staging apex-sentinel-staging 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.

Apex Sentinel: 1 new finding on 372a542. The verdict and the full list are in the summary comment.

Comment thread packages/host-kit/src/internal/exec.ts Resolved
@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 34b1daa. The code looks correct, and all 14 checks pass at that commit. There are no conflicts. The default path (maxBuffer omitted) is covered by the real-subprocess tests in exec.test.ts, so no device run is needed. Nothing blocks merge except order: the PR targets the stacked base fix/a1-extraction-unused-import-20261116, so it merges after that layer.

Not blocking, and you can take or leave these: (1) the precedence abort > timeout > output_limit lives in both commandSettlementReason and the guard in settle, so branching settle on the final reason would give the ladder one owner; (2) commandSettlementReason and normalizeTimeoutMs are not tracing code and only exec.ts uses them, so they fit better in exec.ts or an exec-settlement module, unless a size gate forced the move; (3) bindCommandLifecycle now sits between the CommandKillSettlement doc block and its type, and execResult lost its doc line; (4) validation-case.ts re-exports encodeValidationCase, so validation-arbitraries-cli.ts has two spellings of one symbol, and it would be cleaner to import from @agent-device/test-kit and drop the re-export; (5) CASE_GENERATION_INPUTS lists the test-kit barrel, which changes for unrelated helpers, so listing only the two generator files is enough; (6) provider-webdriver.ts is the only production caller that passes maxBuffer (10 MiB), so cloud WebDriver host commands above that now fail with command_output_limit, which is worth naming in the PR body, and runCmdSync could map ENOBUFS to the same details.

On the other review threads: the threads on background maxBuffer, retry block, runScript waiver and coversCommand matching are fixed at this head, so they can be resolved. The allowFailure thread does not apply: allowFailure covers non-zero exits only, timeouts and sync buffer overflow already throw regardless, and an output-limit breach is a resource violation, so throwing is consistent.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 17, 2026
@thymikee

Copy link
Copy Markdown
Member Author

Reviewed the six optional notes against 00e8e055093a50498c9e5809b191a61ef71decf7:

  • (1) Consolidating settlement predicates is a valid maintenance improvement. The current timeout/abort/output-limit precedence and rejection behavior are covered; this validated round retains that structure.
  • (2) The helpers stay in an already-loaded module after the earlier eager-closure gate failure. Their placement is a packaging constraint, rather than a new settlement owner.
  • (3) The misplaced documentation block and missing short doc line are cosmetic cleanup; deferred in this round.
  • (4) The re-export/import spelling cleanup is also deferred; both names resolve to the same test-kit owner.
  • (5) The barrel can redirect the generator exports, so it remains in the conservative generation hash. Removing it needs closure proof; unrelated edits currently cause extra invalidation rather than stale corpus acceptance.
  • (6) The PR body now names the Cloud WebDriver 10 MiB per-stream limit and typed command_output_limit rejection. Synchronous ENOBUFS classification is unchanged and remains a separate consistency improvement.

The output-limit error now retains bounded captured prefixes. The five tracked review threads are resolved. New-head hosted checks and parent-layer acceptance remain separate from the prior 34b1daa result.

@thymikee
thymikee added this pull request to stack #4625 November 17, 2026 09:50
@thymikee

Copy link
Copy Markdown
Member Author

I reviewed 00e8e05 against the earlier review at 34b1daa (#4621 (comment)). I found no new problems in the delta. The output limit error now carries the bounded stdout and stderr prefixes, and the trace reports output_limit before the allowFailure check. CI is green: 14 checks, none failing. Not blocking: src/provider-webdriver.ts passes maxBuffer (10 MiB) in runCmd, so a limit breach on that route now attaches up to 10 MiB per stream to the error details. That is the same order as the timeout and exit-failure errors that already attach stdout and stderr. Is that serialized or truncated before it reaches the client on that route? The one open inline thread on allowFailure does not apply, so you can resolve it: rejecting on the output limit is a deliberate hard limit, and the trace and error agree (#4621 (comment)). Nothing else in this delta needs to change. Before merge, land the stacked base fix/a1-extraction-unused-import-20261116 first.

@thymikee

Copy link
Copy Markdown
Member Author

Re the output-size question in #4621 (comment): CLI and daemon wire errors pass through normalizeError, which redacts and truncates details before serialization. At this head, stdout uses the generic 400-character limit; stderr retains a head and tail within 8,192 characters, including a middle truncation marker. These are JavaScript string-length limits, separate from the executor’s raw-byte capture bound. See normalization, string bounds, and CLI normalization. A direct in-process caller catching the raw AppError can still inspect the bounded captured prefixes; those are not truncated in place. The deliberate hard-limit thread is already resolved. The stacked base must still land first.

@thymikee
thymikee force-pushed the fix/0.22-command-output-fuzz-prerequisite branch from 00e8e05 to 472f2c2 Compare November 17, 2026 11:28

This branch has not been deployed

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

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant