Skip to content

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

Merged
thymikee merged 10 commits into
fix/a1-extraction-unused-import-20261116from
fix/0.22-command-output-fuzz-prerequisite
Nov 17, 2026
Merged

thymikee merged 10 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 decoding, timeout and cancellation behavior. Cloud WebDriver host commands use a 10 MiB per-stream cap. Typed command_output_limit errors retain bounded stdout/stderr, including with allowFailure.

The deadline now retries termination when the first output-limit kill fails, preserving the earlier output-limit reason. Move fuzz support to test-kit and keep fixed-seed Maestro completeness beside the parser. This 12-file, 477-gross-line prerequisite supports #4617 and targets #4579.

Validation

Published head: ccbf9edfc5e1bc34e21e459bb875617b1d3ee6c3, based on A1 c6103613. Pinned frozen install/build and the exact affected gate passed: 42 checks passed, 25 skipped, unchanged checkout. Compared with the last reviewed e60df0c, nine patches are unchanged; ccbf9ed is the sole new commit. Its change is three production lines plus a regression. The new-commit Chief of Staff review remains pending.

The real-process deadline regression failed on the old source for both allowFailure settings and passed with the fix; all 32 executor cases passed. Root reviewed the fix and tests. Existing prefix regressions cover both streams.

The prior public conflict is repaired by the pushed rebase. Hosted results at this head completed: 13 successful, one skipped and one neutral. Sentinel reports no open findings and no longer raises the deadline concern; one below-minor finding is hidden by its configured threshold. All six review threads are resolved. Land #4579 first, after Chief of Staff clearance for this commit.


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 +599 B
Package (unpacked) 6.13 MB 6.13 MB +599 B
Package (download) 1.86 MB 1.86 MB +275 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.5 ms 30.2 ms +2.7 ms
CLI --help 52.6 ms 55.2 ms +2.6 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 · 1 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

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

💬 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 e60df0ce · 17.11.2026 15:41 UTC

Apex Sentinel · ✅ Approve

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

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/host-kit/src/internal/exec.ts:309 🆕 An output-limit kill that fails to stop the child now hangs runCmd forever — the deadline is skipped

2 findings below minor hidden (user_settings.min_severity).

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

Review of 0399650f · 17.11.2026 12:56 UTC

Apex Sentinel · ✅ Approve

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

No open findings.

1 finding below minor hidden (user_settings.min_severity).

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

Review of 472f2c2d · 17.11.2026 11:44 UTC

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

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 2 times, most recently from 472f2c2 to 0399650 Compare November 17, 2026 12:34
@thymikee
thymikee removed this pull request from stack #4625 November 17, 2026 13:43
@thymikee
thymikee added this pull request to stack #4637 November 17, 2026 13:44
@thymikee
thymikee force-pushed the fix/0.22-command-output-fuzz-prerequisite branch from 0399650 to e60df0c Compare November 17, 2026 15:24

@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 e60df0c. 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 branch now conflicts with its base after #4579 moved to c610361. Please rebase it onto the current fix/a1-extraction-unused-import-20261116; the code reviewed at e60df0c was fine, and I will re-check the rebased head.

@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 17, 2026
@thymikee
thymikee force-pushed the fix/0.22-command-output-fuzz-prerequisite branch from e60df0c to ccbf9ed Compare November 17, 2026 17:52
@thymikee

Copy link
Copy Markdown
Member Author

The rebase requested in #4621 (comment) is published: ccbf9ed is based on current A1 c610361. Range-diff confirms the nine previously reviewed patches are unchanged.

The sole new commit is the deadline termination fix: three production lines and a real-child regression. It retries a failed first kill at the existing deadline while retaining the earlier output-limit error. The controlled old-source run failed both allowFailure cases; the corrected executor suite passed all 32 cases. Root cold review found no actionable issue. The exact published head passed affected validation (42 passed, 25 skipped, unchanged checkout) and hosted CI (13 successful, one skipped, one neutral). Sentinel withdrew the deadline finding; all six review threads are resolved.

The remaining gate is the Chief of Staff review of this new commit. I have not changed readiness labels. All four stack heads will stay fixed while that review completes; no further code change or rebase is currently needed.

@thymikee

Copy link
Copy Markdown
Member Author

I found no problems in ccbf9ed. The conflict from the earlier review (#4621 (comment)) is resolved. The output-limit kill no longer skips the deadline: exec.ts:309-314 re-requests the kill and keeps didTimeout false, so a failed first kill cannot hang runCmd. That fixes the open thread at #4621 (comment), so you can resolve it.

CI is green: 15 checks, none failing (13 success, 1 skipped, 1 neutral). The test stubs child.kill to return false without sending the signal. That reaches the retry branch, because signalProcessTree ignores the return value. #4579 needs to land first, and nothing else stops this PR.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 17, 2026
@thymikee
thymikee merged commit 9a25700 into 0.22 Nov 17, 2026
15 checks passed
@thymikee
thymikee deleted the fix/0.22-command-output-fuzz-prerequisite branch November 17, 2026 21:01
thymikee added a commit that referenced this pull request Nov 19, 2026
* refactor(test): colocate Maestro fuzz coverage with parser

* fix(host-kit): bound captured command output

* fix(host-kit): count raw output bytes before decoding

* refactor(host-kit): isolate command settlement classification

* fix(host-kit): preserve timeout and eager closure

* fix(test-kit): cover complete Maestro command tokens

* style(test): format Maestro coverage assertion

* fix(host-kit): retain bounded output on capture limit errors

* test: coordinate bounded output regression

* fix(host-kit): retry output-limit termination at deadline
thymikee added a commit that referenced this pull request Nov 19, 2026
…ent vocabulary

0.22 (#4621 bounded output) and main (#4777 startup progress) each grew
packages/host-kit/src/internal/exec.ts, so the merged file passed its legacy
1032-line cap and lint failed. Re-home the kill/settle ordering —
signalProcessGroupBestEffort, bindCommandLifecycle, the kill settlement, the abort
watch, killProcessTree and destroyCommandStreams — into exec-trace.ts, which already
owns the exec settlement vocabulary and sits in every closure that reaches exec.ts,
so no eager closure grows. exec.ts now fits the 1000-line rule and its legacy cap
entry is removed.
thymikee added a commit that referenced this pull request Nov 20, 2026
* refactor(test): colocate Maestro fuzz coverage with parser

* fix(host-kit): bound captured command output

* fix(host-kit): count raw output bytes before decoding

* refactor(host-kit): isolate command settlement classification

* fix(host-kit): preserve timeout and eager closure

* fix(test-kit): cover complete Maestro command tokens

* style(test): format Maestro coverage assertion

* fix(host-kit): retain bounded output on capture limit errors

* test: coordinate bounded output regression

* fix(host-kit): retry output-limit termination at deadline
thymikee added a commit that referenced this pull request Nov 20, 2026
…ent vocabulary

0.22 (#4621 bounded output) and main (#4777 startup progress) each grew
packages/host-kit/src/internal/exec.ts, so the merged file passed its legacy
1032-line cap and lint failed. Re-home the kill/settle ordering —
signalProcessGroupBestEffort, bindCommandLifecycle, the kill settlement, the abort
watch, killProcessTree and destroyCommandStreams — into exec-trace.ts, which already
owns the exec settlement vocabulary and sits in every closure that reaches exec.ts,
so no eager closure grows. exec.ts now fits the 1000-line rule and its legacy cap
entry is removed.
thymikee added a commit that referenced this pull request Nov 20, 2026
* refactor(test): colocate Maestro fuzz coverage with parser

* fix(host-kit): bound captured command output

* fix(host-kit): count raw output bytes before decoding

* refactor(host-kit): isolate command settlement classification

* fix(host-kit): preserve timeout and eager closure

* fix(test-kit): cover complete Maestro command tokens

* style(test): format Maestro coverage assertion

* fix(host-kit): retain bounded output on capture limit errors

* test: coordinate bounded output regression

* fix(host-kit): retry output-limit termination at deadline
thymikee added a commit that referenced this pull request Nov 20, 2026
…ent vocabulary

0.22 (#4621 bounded output) and main (#4777 startup progress) each grew
packages/host-kit/src/internal/exec.ts, so the merged file passed its legacy
1032-line cap and lint failed. Re-home the kill/settle ordering —
signalProcessGroupBestEffort, bindCommandLifecycle, the kill settlement, the abort
watch, killProcessTree and destroyCommandStreams — into exec-trace.ts, which already
owns the exec settlement vocabulary and sits in every closure that reaches exec.ts,
so no eager closure grows. exec.ts now fits the 1000-line rule and its legacy cap
entry is removed.
thymikee added a commit that referenced this pull request Nov 21, 2026
* refactor(test): colocate Maestro fuzz coverage with parser

* fix(host-kit): bound captured command output

* fix(host-kit): count raw output bytes before decoding

* refactor(host-kit): isolate command settlement classification

* fix(host-kit): preserve timeout and eager closure

* fix(test-kit): cover complete Maestro command tokens

* style(test): format Maestro coverage assertion

* fix(host-kit): retain bounded output on capture limit errors

* test: coordinate bounded output regression

* fix(host-kit): retry output-limit termination at deadline
thymikee added a commit that referenced this pull request Nov 21, 2026
…ent vocabulary

0.22 (#4621 bounded output) and main (#4777 startup progress) each grew
packages/host-kit/src/internal/exec.ts, so the merged file passed its legacy
1032-line cap and lint failed. Re-home the kill/settle ordering —
signalProcessGroupBestEffort, bindCommandLifecycle, the kill settlement, the abort
watch, killProcessTree and destroyCommandStreams — into exec-trace.ts, which already
owns the exec settlement vocabulary and sits in every closure that reaches exec.ts,
so no eager closure grows. exec.ts now fits the 1000-line rule and its legacy cap
entry is removed.
thymikee added a commit that referenced this pull request Nov 21, 2026
* refactor(test): colocate Maestro fuzz coverage with parser

* fix(host-kit): bound captured command output

* fix(host-kit): count raw output bytes before decoding

* refactor(host-kit): isolate command settlement classification

* fix(host-kit): preserve timeout and eager closure

* fix(test-kit): cover complete Maestro command tokens

* style(test): format Maestro coverage assertion

* fix(host-kit): retain bounded output on capture limit errors

* test: coordinate bounded output regression

* fix(host-kit): retry output-limit termination at deadline
thymikee added a commit that referenced this pull request Nov 21, 2026
…ent vocabulary

0.22 (#4621 bounded output) and main (#4777 startup progress) each grew
packages/host-kit/src/internal/exec.ts, so the merged file passed its legacy
1032-line cap and lint failed. Re-home the kill/settle ordering —
signalProcessGroupBestEffort, bindCommandLifecycle, the kill settlement, the abort
watch, killProcessTree and destroyCommandStreams — into exec-trace.ts, which already
owns the exec settlement vocabulary and sits in every closure that reaches exec.ts,
so no eager closure grows. exec.ts now fits the 1000-line rule and its legacy cap
entry is removed.
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