Skip to content

fix(permissions): raise Windows command timeout - #99

Merged
steipete merged 1 commit into
mainfrom
fix/permission-timeout-budget
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/permission-timeout-budget

Conversation

@steipete

@steipete steipete commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Raise the built-in Windows permission-command deadline from 10 seconds to 30 seconds per process.
  • Add real child-process coverage showing a slow command succeeds before its deadline while an infinite command is still terminated.
  • Keep the permission documentation and existing Unreleased changelog entry aligned with the corrected default.

Why 30 seconds per process

Recent Windows fallback runs put the affected secure-read test between 1.930s and 5.400s when successful. Under contention, PR #94 reached 10.130s and PR #95 reached 10.173s; both failures were the old bound firing, and PR #95 passed at 3.694s on rerun. Thirty seconds provides more than 5.5x the slowest pre-fix success and roughly 3x the overloaded cutoff without turning a genuinely wedged command back into an indefinite hang.

The deadline stays per process. Each PowerShell, icacls, or whoami child is the independently wedgable unit, and the sequence is structurally finite. An overall deadline would make multiple slow-but-successful commands compete for one budget and could reproduce the false permission-unverified result this fixes.

No public timeout option is added. The measured default has ample headroom, while callers that inject a custom executor continue to own that executor's deadline. Fail-closed behavior is unchanged: a genuine command failure or timeout still yields source: "unknown", and secure reads still reject it as permission-unverified.

Proof

  • pnpm check: 680 passed, 32 skipped
  • pnpm test:security: 64 passed
  • git diff --check
  • Autoreview (Codex): clean, no accepted/actionable findings
  • Explicit default-budget probe: a 12-second child succeeded in 12.064s
  • Explicit default-budget probe: an infinite child was terminated in 30.005s

Windows fallback proof on commit 4c2b809:

  • PR matrix: Node 22 passed the affected test in 4.444s; Node 24 passed it in 9.349s.
  • Independent manual-dispatch repeat: Node 22 passed it in 3.257s; Node 24 passed it in 4.434s.
  • Each Windows leg passed all 519 runnable tests. The 9.349s sample is a useful near-boundary success that had only about 651ms of margin under the old default.

@steipete
steipete requested a review from a team as a code owner August 2, 2026 22:22
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 6:25 PM ET / 22:25 UTC.

ClawSweeper review

What this changes

The PR raises the built-in Windows permission-command timeout from 10 to 30 seconds, documents the corrected default, and adds real child-process timing coverage.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer merge review: current main still uses the 10-second Windows permission-command deadline, while this focused patch raises the bound without removing the existing timeout or fail-closed classification.

Priority: P2
Reviewed head: 4c2b8098ae39ac2fda6215667296444f1a4bcb4c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) This is a focused, documented correction with real-process timing evidence and no identified functional or security defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body supplies after-fix real child-process results: a default-budget command ran for 12.064 seconds and completed, while an infinite child was terminated at 30.005 seconds; completed Windows check runs also pass.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies after-fix real child-process results: a default-budget command ran for 12.064 seconds and completed, while an infinite child was terminated at 30.005 seconds; completed Windows check runs also pass.
Evidence reviewed 5 items Current main retains the affected default: Current main sets the permission-command default to 10,000 ms and passes it directly to execFile; the PR's 30,000 ms behavior is not already implemented.
Fail-closed consumer path: permissions.ts wires the bounded executor as the default Windows permission command runner, so its timeout outcome feeds the existing permission-inspection flow rather than adding a parallel path.
Feature provenance: The current bounded executor, including its 10-second default and SIGKILL timeout handling, was introduced by the Windows ACL command-bounding commit; the PR updates the same focused surface.
Findings None None.
Security None None.

How this fits together

The Windows permission fallback runs owner and ACL system commands before secure reads accept a file. Their results feed a fail-closed classification: command failure or timeout leaves permissions unverified and blocks the secure read.

flowchart LR
  A[Secure read request] --> B[Windows permission fallback]
  B --> C[Owner and ACL commands]
  C --> D[Per-process deadline]
  D --> E[Permission classification]
  E --> F[Allow verified file]
  E --> G[Reject unverified file]
Loading

Before merge

  • Resolve merge risk (P1) - A genuinely wedged Windows owner or ACL command will now delay the fail-closed result for up to 30 seconds per process rather than 10 seconds; this is bounded and intentional, but it is an availability-latency tradeoff for secure reads.
  • Complete next step (P2) - No mechanical repair is needed; wait for the remaining Windows/native checks and perform the normal maintainer merge decision.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch surface 4 files affected; 18 added, 4 removed The implementation, regression coverage, docs, and Unreleased changelog are changed together without unrelated repository churn.
Timeout bound 10 seconds → 30 seconds per process This is the material operational change and the relevant merge-time latency tradeoff.

Merge-risk options

Maintainer options:

  1. Land the bounded tolerance increase (recommended)
    Accept the documented worst-case 30-second per-process delay because it avoids contention-driven false failures while preserving termination and fail-closed handling.
  2. Keep the current 10-second deadline
    Retain lower worst-case latency if maintainers judge the added delay more harmful than the reported Windows contention failures.

Technical review

Best possible solution:

Adopt the measured 30-second per-process deadline while retaining SIGKILL termination, unverified permission classification, and the documented custom-executor escape hatch.

Do we have a high-confidence way to reproduce the issue?

Yes—current main has a concrete 10-second executor default, and the PR body records real child-process probes where a 12-second command succeeds and an infinite command is terminated at roughly 30 seconds. No separate local runtime execution was performed in this read-only review.

Is this the best way to solve the issue?

Yes—the change is the narrowest maintainable correction because it raises only the internal per-process bound while preserving the existing timeout, kill signal, custom executor contract, and fail-closed result.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against eda9a61fcf7f.

Labels

Label changes:

  • add P2: This corrects a bounded Windows permission-inspection failure under contention without evidence of data loss, a security bypass, or core-runtime unavailability.
  • add merge-risk: 🚨 availability: The intentional timeout increase can delay secure-read rejection when a Windows permission command genuinely wedges, even though the path remains bounded and fail closed.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix real child-process results: a default-budget command ran for 12.064 seconds and completed, while an infinite child was terminated at 30.005 seconds; completed Windows check runs also pass.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies after-fix real child-process results: a default-budget command ran for 12.064 seconds and completed, while an infinite child was terminated at 30.005 seconds; completed Windows check runs also pass.

Label justifications:

  • P2: This corrects a bounded Windows permission-inspection failure under contention without evidence of data loss, a security bypass, or core-runtime unavailability.
  • merge-risk: 🚨 availability: The intentional timeout increase can delay secure-read rejection when a Windows permission command genuinely wedges, even though the path remains bounded and fail closed.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies after-fix real child-process results: a default-budget command ran for 12.064 seconds and completed, while an infinite child was terminated at 30.005 seconds; completed Windows check runs also pass.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix real child-process results: a default-budget command ran for 12.064 seconds and completed, while an infinite child was terminated at 30.005 seconds; completed Windows check runs also pass.

Evidence

What I checked:

  • Current main retains the affected default: Current main sets the permission-command default to 10,000 ms and passes it directly to execFile; the PR's 30,000 ms behavior is not already implemented. (src/permission-exec.ts:6, eda9a61fcf7f)
  • Fail-closed consumer path: permissions.ts wires the bounded executor as the default Windows permission command runner, so its timeout outcome feeds the existing permission-inspection flow rather than adding a parallel path. (src/permissions.ts:117, eda9a61fcf7f)
  • Feature provenance: The current bounded executor, including its 10-second default and SIGKILL timeout handling, was introduced by the Windows ACL command-bounding commit; the PR updates the same focused surface. (src/permission-exec.ts:6, 64f77429ede1)
  • Patch scope and hygiene: The proposed branch changes four aligned files—executor default, child-process test, permission documentation, and Unreleased changelog—and git diff --check reports no whitespace errors. (test/permissions-exec.test.ts:18, 4c2b8098ae39)
  • Branch remains distinct from main: Neither the PR head nor current main is an ancestor of the other, and current main still contains the old default; this is not an implemented-on-main or obsolete-fix PR. (src/permission-exec.ts:6, 4c2b8098ae39)

Likely related people:

  • steipete: Peter Steinberger introduced the current main-branch bounded Windows permission executor, and this PR updates that same executor and its tests. (role: feature introducer and recent area contributor; confidence: high; commits: 64f77429ede1, 4c2b8098ae39; files: src/permission-exec.ts, test/permissions-exec.test.ts, docs/permissions.md)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the remaining Windows/native checks finish, then merge if they remain green.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(permissions): raise Windows command timeout This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 209fbd1 into main Aug 2, 2026
43 checks passed
@steipete
steipete deleted the fix/permission-timeout-budget branch August 2, 2026 22:29
steipete added a commit that referenced this pull request Aug 28, 2026
Windows ACL verification subprocess failures from the PowerShell owner
query, icacls, and whoami were flattened to a generic
permission-unverified FsSafeError, discarding stderr, exit status, and
timing.

Propagate structured PermissionCommandFailure diagnostics from
executePermissionCommand through the owner and ACL inspectors onto
FsSafeError details and cause. The failure records command, durationMs,
timedOut, exitCode, signal, and sanitized, bounded stderr so CI flakes on
contended runners are diagnosable and a future retry condition can key on
real diagnostics.

Verification semantics, error codes, and fail-closed behavior are
unchanged. No retries are added.

Refs #99.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant