Skip to content

fix(test-utils): bound git ls-files probe with timeout - #111171

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
tzy-17:fix/repo-files-git-ls-files-timeout
Aug 3, 2026
Merged

vincentkoc merged 1 commit into
openclaw:mainfrom
tzy-17:fix/repo-files-git-ls-files-timeout

Conversation

@tzy-17

@tzy-17 tzy-17 commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

What problem this solves

listGitTrackedFiles() synchronously runs git ls-files without a wall-clock bound. A stalled Git process can block every guard or test that consumes the shared inventory helper.

The original branch added a timeout, but still allowed four guardrails to turn inventory failure into an empty list and pass silently. It also exported a test-only timeout constant and used a platform-specific executable-shim test.

Canonical fix

  • Bound the shared git ls-files call to 5 seconds with SIGKILL.
  • Keep the timeout private to the helper.
  • Cache a failed inventory result as unavailable, preserving the helper's existing contract.
  • Make all four affected guardrails fail closed with explicit errors instead of coercing failure to [].
  • Add portable mocked spawnSync tests for the timeout options, sorted existing-file projection, and failure caching.

No config, Plugin SDK, product behavior, or runtime feature surface changes.

Evidence

Exact rewritten head: f88ce40b1af1f7792914ce7bd2fa83ae9bd38636

  • Direct stalled-child proof: the helper returned through its failure path in 5.003 seconds with ETIMEDOUT / SIGKILL; no process remained.
  • Normal Git parity: 23,485 / 23,485 tracked files matched raw git ls-files.
  • All 31 helper consumers plus the new helper tests: 929 tests passed across 9 shards.
  • Focused exact-head rerun of the helper and four fail-closed guards: 5 files, 39 tests passed.
  • Forced inventory failure: all four guardrails failed closed with their explicit diagnostic.
  • git diff --check, scoped oxfmt, and scoped oxlint: clean.
  • check-changed --dry-run: core, coreTests, extensions, and extensionTests.
  • Exact-head autoreview: no P0/P1 findings; TruffleHog clean; correctness confidence 0.95.

Scope

Production delta: +4/-0 in src/test-utils/repo-files.ts. Remaining changes are tests and guardrail assertions.

Changelog not required: this changes test/guard infrastructure only.

@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 19, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 19, 2026
@clawsweeper clawsweeper Bot added the P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. label Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 11:23 AM ET / 15:23 UTC.

ClawSweeper review

What this changes

The branch limits the shared git ls-files inventory call to five seconds, caches failures as unavailable, and makes four plugin guardrails fail explicitly rather than scan an empty file list.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking findings. This PR repairs the shared test-file inventory boundary, addresses the prior review comments, and has sufficient exact-head behavior proof; it remains open for normal maintainer landing after current-head CI completes.

Priority: P3
Reviewed head: f88ce40b1af1f7792914ce7bd2fa83ae9bd38636

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-aligned reliability repair with strong stated behavior proof and no remaining code finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides exact-head stalled-child, normal-parity, forced-failure, and focused-test evidence, and the supplied context includes a successful real-behavior-proof check.
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 provides exact-head stalled-child, normal-parity, forced-failure, and focused-test evidence, and the supplied context includes a successful real-behavior-proof check.
Evidence reviewed 7 items Current-main behavior: Current main runs git ls-files synchronously with no timeout, and caches every non-zero result as null; a stalled child can therefore block all helper consumers indefinitely.
Owner-boundary repair: The PR adds a private 5,000 ms timeout and SIGKILL at the helper that owns the synchronous child process, while retaining the established null-unavailable cache contract.
Focused regression coverage: New tests verify timeout options, sorted projection of existing files, and that a timed-out lookup is cached as unavailable rather than repeatedly spawning Git.
Findings None None.
Security None None.

How this fits together

Repository contract tests and guardrails ask a shared helper for Git-tracked paths, then inspect those paths for forbidden imports or deprecated APIs. The helper feeds either a sorted existing-file list into those scans or an unavailable result that guards must surface visibly.

flowchart LR
  A[Test or contract guard] --> B[Tracked-file helper]
  B --> C[Git tracked-file lookup]
  C --> D{Lookup succeeds?}
  D -->|Yes| E[Existing sorted paths]
  D -->|Timeout or failure| F[Unavailable result]
  E --> G[Guard scans files]
  F --> H[Guard throws diagnostic]
Loading

Before merge

  • Complete next step (P2) - No mechanical repair is needed; this PR is ready for ordinary maintainer review once its exact-head checks complete.
Agent review details

Security

None.

PR surface

Source +4, Tests +65. Total +69 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 0 +4
Tests 5 80 15 +65
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 84 15 +69

Review metrics

Metric Value Why it matters
Production versus test delta production +4/-0, tests and guardrails +80/-15 The only production growth is the helper-level timeout boundary; the remaining change verifies and enforces the existing unavailable-inventory contract.

Stored data model

Persistent data-model change detected: serialized state: src/test-utils/repo-files.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Merge the focused helper-owner repair once required checks finish on the exact head, retaining null as the canonical unavailable result and explicit failures for guardrails that require complete inventory.

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

Yes, by source and exact-head behavior evidence: current main has no wall-clock bound on the synchronous Git child, and the submitted proof exercises a stalled child returning through the helper's unavailable path in about five seconds.

Is this the best way to solve the issue?

Yes. The timeout belongs in the shared helper that owns the child process; changing only individual guardrails would leave other consumers exposed, while the branch separately fixes the four guards that could silently pass on unavailable inventory.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P3: This is a small internal test and guardrail reliability repair with no user-facing runtime, configuration, or Plugin SDK surface change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 provides exact-head stalled-child, normal-parity, forced-failure, and focused-test evidence, and the supplied context includes a successful real-behavior-proof check.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head stalled-child, normal-parity, forced-failure, and focused-test evidence, and the supplied context includes a successful real-behavior-proof check.

Evidence

What I checked:

  • Current-main behavior: Current main runs git ls-files synchronously with no timeout, and caches every non-zero result as null; a stalled child can therefore block all helper consumers indefinitely. (src/test-utils/repo-files.ts:36, 7fabb5564831)
  • Owner-boundary repair: The PR adds a private 5,000 ms timeout and SIGKILL at the helper that owns the synchronous child process, while retaining the established null-unavailable cache contract. (src/test-utils/repo-files.ts:37, f88ce40b1af1)
  • Focused regression coverage: New tests verify timeout options, sorted projection of existing files, and that a timed-out lookup is cached as unavailable rather than repeatedly spawning Git. (src/test-utils/repo-files.test.ts:19, f88ce40b1af1)
  • Fail-closed guardrails: All four changed guardrails previously coerced unavailable inventory to an empty list; the branch instead throws a diagnostic, preventing those policy checks from silently passing after lookup failure. (src/plugins/contracts/model-catalog-core-imports.test.ts:37, f88ce40b1af1)
  • Sibling contract handling: Other callers that use an empty fallback first assert that inventory is non-null, while channel contract guardrails preserve null explicitly; the four patched call sites were the silent-pass guardrail cases. (test/scripts/plugin-contract-test-plan.test.ts:8, 7fabb5564831)
  • Current-main provenance: Blame attributes the helper implementation and its null-on-failure cache contract to the current-main commit that introduced this file, making the PR a narrow change to the owning boundary. (src/test-utils/repo-files.ts:36, fe6fa891ea4e)

Likely related people:

  • steipete: Current-main blame attributes the complete helper and its unavailable-result contract to this commit. (role: current helper introducer and recent area contributor; confidence: high; commits: fe6fa891ea4e; files: src/test-utils/repo-files.ts)

Rank-up moves

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

  • Allow the current-head required checks to complete before merge.

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.

History

Review history (7 earlier review cycles)
  • reviewed 2026-07-19T03:24:54.715Z sha 9d2081c2d6552b1516217cb9a61bc4df861db0d2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-20T01:54:15.143Z sha e841daaf146e8c0da82cb079b4b44ffee818511a :: needs real behavior proof before merge. :: [P2] Exercise the exported helper in the timeout regression test
  • reviewed 2026-07-20T04:27:08.639Z sha b7c263bb2437e1e393001a0225d8ed5b8dc284a3 :: needs changes before merge. :: [P3] Remove review-specific narrative from the regression test
  • reviewed 2026-07-20T05:47:17.043Z sha b7c263bb2437e1e393001a0225d8ed5b8dc284a3 :: needs changes before merge. :: [P3] Remove review-specific narrative from the regression test | [P3] Correct the timeout outcome comment
  • reviewed 2026-07-20T08:12:33.554Z sha b7c263bb2437e1e393001a0225d8ed5b8dc284a3 :: needs changes before merge. :: [P3] Remove review-specific narrative from the regression test | [P3] Describe the actual timeout result
  • reviewed 2026-07-27T08:33:57.089Z sha 888c9d798ab633aad0a2c0fee83d13f828871760 :: needs changes before merge. :: [P3] Remove review-specific narrative from the regression test | [P3] Describe the helper fallback, not a non-zero timeout status
  • reviewed 2026-07-31T20:53:50.153Z sha 888c9d798ab633aad0a2c0fee83d13f828871760 :: needs changes before merge. :: [P3] Remove PR review transcript from the regression test | [P3] Describe the timeout fallback without claiming a non-zero status

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 20, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 20, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 20, 2026
@tzy-17

tzy-17 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@tzy-17
tzy-17 force-pushed the fix/repo-files-git-ls-files-timeout branch from b7c263b to 888c9d7 Compare July 27, 2026 08:28
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 27, 2026
@vincentkoc
vincentkoc force-pushed the fix/repo-files-git-ls-files-timeout branch from 888c9d7 to f88ce40 Compare August 3, 2026 15:17
@vincentkoc vincentkoc self-assigned this Aug 3, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 3, 2026
@vincentkoc
vincentkoc merged commit 53d442e into openclaw:main Aug 3, 2026
124 of 128 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main:
  fix(parallels): recover Windows poll transport failures (#118479)
  fix(channels): deny unauthorized Discord and Telegram binding access (#118704)
  fix(test): bound shared git inventory lookup (#111171)
vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main: (78 commits)
  fix(parallels): recover Windows poll transport failures (#118479)
  fix(channels): deny unauthorized Discord and Telegram binding access (#118704)
  fix(test): bound shared git inventory lookup (#111171)
  fix(onboard): keep referenced provider secrets out of plaintext (#118702)
  docs: show canonical agent roster configuration (#118722)
  fix(channels): generate catalog from package manifests (#118097)
  fix(zalouser): distinguish probe timeout from auth failure (#111336)
  improve(ui): cut E2E shard runtime by reusing the bundle (#118697)
  fix(cli): publish completion caches atomically (#118715)
  fix(whatsapp): honor disabled self-chat without widening group access (#118711)
  fix(voice-call): terminate carrier calls after realtime startup failures (#118699)
  fix(slack): isolate GovSlack media trust and delivery (#118695)
  fix(browser): wrap page-controlled action results (#118691)
  fix(security): sanitize JSON-escaped forged content boundaries (#118698)
  test(qa): prove real yielded-child completion and channel delivery (#118707)
  fix(doctor): honor explicit plugin-only migration authority (#118700)
  fix(security): detect child_process calls through aliases and computed members (#116304)
  test(gateway): avoid async facade mock race (#118708)
  fix(gateway): preserve final speech during transcription shutdown (#118693)
  fix(gateway): resume durable outbound delivery retries (#118694)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
* origin/main:
  fix(parallels): recover Windows poll transport failures (openclaw#118479)
  fix(channels): deny unauthorized Discord and Telegram binding access (openclaw#118704)
  fix(test): bound shared git inventory lookup (openclaw#111171)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

2 participants