Skip to content

perf(test): avoid Canvas Git timeout wait - #124547

Merged
steipete merged 1 commit into
mainfrom
perf/canvas-git-timeout-test
Aug 16, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/canvas-git-timeout-test

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Canvas A2UI bundle regression spends the full five-second production Git timeout proving that stalled tracked-input discovery falls back to filesystem hashing. That one case accounts for essentially the entire six-test file runtime.

Why This Change Was Made

Split the regression at the side-effect boundary it owns:

  • listTrackedInputFiles now receives its Git runner explicitly, letting the test prove the exact five-second timeout, SIGKILL policy, command shape, and timeout result classification without sleeping.
  • A fast real subprocess integration now computes the tracked-input hash, makes Git fail immediately, and proves filesystem fallback produces the identical hash and retained bundle output.

The production timeout, fallback behavior, hash inputs, and bundle policy are unchanged.

User Impact

Maintainer Canvas test feedback is about five seconds faster while timeout and fallback regressions now fail directly instead of only after a real deadline.

Evidence

Controlled same-Testbox A/B on tbx_01m055cvpx01134s8q61sn1h3m, with one excluded warmup and two retained samples per state, the same command, one worker, distinct filesystem module caches, import diagnostics, and /usr/bin/time -v:

Metric Before After Gain
Wall 8.47s 3.44s -5.04s (-59.4%)
Vitest 5.77s 0.79s -86.3%
Test body 5.14s 0.17s -96.7%
Imports 1.85s 1.83s effectively flat

CPU and peak RSS were effectively flat, so this PR makes no resource-usage claim.

Validation:

  • 7/7 focused Canvas bundle tests.
  • Removing the production timeout option fails the new owner-boundary assertion immediately.
  • The real fallback integration proves failed Git discovery matches the normal tracked-input hash.
  • Full extension changed gate, including native A2UI resource reproducibility, production/test typechecks, targeted lint, plugin boundaries, dead exports, and import cycles.
  • Fresh autoreview: no accepted/actionable findings.
  • Runtime script LOC: +8/-9; declaration surface: +12/-0; test LOC: +49/-25.

Testbox benchmark and hydration: https://github.com/openclaw/openclaw/actions/runs/31944514338

Final post-rebase changed gate: https://github.com/openclaw/openclaw/actions/runs/31945366263

AI-assisted: yes. The change and evidence were reviewed by the maintainer agent and fresh autoreview.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 16, 2026 11:58
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 8:04 AM ET / 12:04 UTC.

ClawSweeper review

What this changes

The PR injects the Canvas bundle script’s Git runner for a fast timeout-policy test and changes the real fallback integration to compare normal and failed-Git bundle hashes.

Merge readiness

✅ Ready for maintainer review

Keep open. This maintainer-authored Canvas test-performance refactor remains necessary because current main still waits for the real Git timeout; the patch preserves production fallback behavior while covering the timeout policy without sleeping, with no blocking correctness or security finding.

Priority: P3
Reviewed head: 7049882c9b11b571e4a4aefab9b95420959d51f3

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, behavior-preserving test refactor with direct timeout-policy coverage and a retained real subprocess fallback check.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-authored PR, so the external-contributor proof gate does not apply; its body nevertheless links post-change Testbox benchmark and changed-gate evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-authored PR, so the external-contributor proof gate does not apply; its body nevertheless links post-change Testbox benchmark and changed-gate evidence.
Evidence reviewed 6 items Current-main behavior: Current main’s integration test creates a fake Git executable that stays alive for 30 seconds, then runs the bundle script with a 12-second outer deadline; this is the five-second internal wait the PR removes from the focused suite.
Owner-boundary change: The updated helper owns Git invocation and still receives the real spawnSync runner in production; only the test supplies a controlled runner.
Fallback proof in source: The integration executes the actual bundle script once with normal Git and once with an immediate failing Git executable, then asserts identical hashes and retained bundle output.
Findings None None.
Security None None.

How this fits together

Canvas builds a checked-in A2UI browser bundle from tracked package and source inputs. The bundle script first asks Git for those inputs, falls back to filesystem traversal when Git fails, then hashes the inputs before deciding whether to rebuild.

flowchart LR
  A[Canvas A2UI sources] --> B[Input discovery]
  B --> C{Git list succeeds?}
  C -->|yes| D[Tracked input hash]
  C -->|no| E[Filesystem fallback]
  E --> D
  D --> F[Bundle output]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +11, Tests +24. Total +35 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 20 9 +11
Tests 1 48 24 +24
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 68 33 +35

Review metrics

Metric Value Why it matters
Production vs test LOC production -1 net (8 added, 9 removed); declarations +12; tests +24 net (48 added, 24 removed) The runtime bundle path is slightly smaller; added lines are a narrow typed test seam and focused timeout/fallback coverage.

Technical review

Best possible solution:

Keep the narrow Git-runner seam and real subprocess fallback comparison, then merge after the remaining exact-head changed-extension check completes successfully.

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

Not applicable: this PR removes test latency rather than fixing a reported product failure; current main source directly shows the slow timeout fixture it replaces.

Is this the best way to solve the issue?

Yes. It separates assertion of the Git timeout policy from a real bundle-process fallback check, retaining behavior coverage without a five-second sleep.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a low-risk maintainer test-performance improvement with no user-facing behavior change.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored PR, so the external-contributor proof gate does not apply; its body nevertheless links post-change Testbox benchmark and changed-gate evidence.

Label justifications:

  • P3: This is a low-risk maintainer test-performance improvement with no user-facing behavior change.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored PR, so the external-contributor proof gate does not apply; its body nevertheless links post-change Testbox benchmark and changed-gate evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Introduced the Canvas A2UI bundler, its timeout fallback test, and this focused follow-up in the same file history. (role: feature introducer and recent Canvas asset contributor; confidence: high; commits: 7563682c3fc3, 7049882c9b11; files: extensions/canvas/scripts/bundle-a2ui.mjs, extensions/canvas/scripts/bundle-a2ui.test.ts, extensions/canvas/scripts/bundle-a2ui.d.mts)

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 7049882c9b11b571e4a4aefab9b95420959d51f3:

  • Controlled same-Testbox A/B on tbx_01m055cvpx01134s8q61sn1h3m, with one excluded warmup and two retained one-worker samples per state: wall 8.47s → 3.44s (-59.4%), Vitest 5.77s → 0.79s (-86.3%), and test body 5.14s → 0.17s (-96.7%). Imports, CPU, and peak RSS were effectively flat.
  • Focused proof: 7/7 Canvas bundle tests passed on the final rebased head.
  • Mutation proof: removing the production timeout option fails the direct owner-boundary assertion immediately.
  • The real subprocess integration proves immediate Git failure produces the same filesystem-fallback hash as normal tracked-input discovery and retains bundle output.
  • The post-rebase full extension changed gate passed, including native A2UI resource reproducibility, production/test typechecks, targeted lint, plugin boundaries, dead exports, and import cycles: https://github.com/openclaw/openclaw/actions/runs/31945366263
  • Fresh post-rebase autoreview found no accepted/actionable findings.
  • Exact-head CI is green: https://github.com/openclaw/openclaw/actions/runs/31945788556
  • Runtime script LOC: +8/-9; checked declaration surface: +12/-0; test LOC: +49/-25.

@steipete
steipete merged commit 66db701 into main Aug 16, 2026
167 of 168 checks passed
@steipete
steipete deleted the perf/canvas-git-timeout-test branch August 16, 2026 12:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

extensions: canvas maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

1 participant