Skip to content

perf(ci): content-hash boundary artifact freshness and resize Telegram shards - #123649

Merged
obviyus merged 2 commits into
mainfrom
t3code/ci-boundary-hash-and-shard-resize
Aug 14, 2026
Merged

obviyus merged 2 commits into
mainfrom
t3code/ci-boundary-hash-and-shard-resize

Conversation

@obviyus

@obviyus obviyus commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Two CI capacity losses surfaced while auditing PR wall clock after the hybrid runner backend (#123479):

  1. Hosted jobs restore the extension package boundary artifact cache in ~2s and then rebuild it anyway (~60s tsgo + ~2m46s CPU, silent) on every run. A fresh checkout stamps every input file mtime, so the prep script's mtime freshness check can never pass on a hosted runner; the cache added for hosted lint is dead weight. The same tax hits local checkouts after every branch switch or rebase.
  2. A Telegram-touching diff fans out ~42 changed-extensions-config jobs at 5 files each (~45s runner setup per job, ~60 runner-minutes). The 5-file cap was sized around Telegram test files that paid a multi-minute silent import, fixed in fix(telegram): resolve native command names from the loaded registry only #123607; per-file cost is back to seconds.

Why This Change Was Made

  • The boundary stamp files now record the lane's input content digest. When the mtime fast path fails, a matching digest keeps the artifacts fresh and repairs output mtimes so subsequent checks take the fast path again. The digest walks exactly the file set the mtime scan sees; the per-file digest memo is keyed by stat identity because entry-shim inputs include .tsbuildinfo files rewritten mid-run. The entry-shims lane's child-written timestamp stamp is overwritten by the parent with the digest after prerequisite builds settle. Legacy timestamp stamps fail the digest check once, then self-heal.
  • TELEGRAM_EXTENSION_TEST_JOB_FILE_LIMIT 5 → 10: halves the fanout (~42 → ~22 jobs) while keeping the worst job near 3 minutes, off the PR critical path. The 1-file-per-process isolate recycling from fix(ci): keep Telegram shards alive after the first isolated file #123576 is unchanged.

User Impact

None at product runtime; both changes are CI/tooling. Hosted lint/boundary jobs drop ~60s each once caches carry hash stamps; Telegram-heavy PRs register ~20 fewer runners per run; local pnpm lint/check-changed stop paying a ~58s rebuild after branch switches.

Evidence

  • Local CI simulation: git ls-files | xargs touch (fresh-checkout mtimes) → prep run skips all 10 lanes via digest match in 0.17s (previously: full ~49s rebuild). Second run takes the repaired mtime fast path. Cold rebuild still works and mints hash stamps.
  • New regression test: mtime-stale + digest-match → fresh, repaired mtimes; changed bytes → stale; legacy timestamp stamp → stale. test/scripts/prepare-extension-package-boundary-artifacts.test.ts 19/19.
  • Planner: ci-changed-node-test-plan shard-count assertions derive from the constant; test/scripts/{ci-changed-node-test-plan,test-extension,test-projects,ci-workflow-guards}.test.ts 585/585, run-oxlint.test.ts 55/55.
  • pnpm tsgo:scripts, check:test-types, oxlint, oxfmt, git diff --check clean.

Hosted runners restore the extension package boundary artifact cache and
then rebuild anyway: a fresh checkout stamps every input mtime, so the
mtime freshness check can never pass in CI (~60s tsgo rebuild plus ~2.7m
CPU per hosted lint/boundary job).

Record the lane's input digest in its stamp file and accept mtime-stale
artifacts whose digest still matches, repairing output mtimes on the way
so later runs take the fast path again. The digest walk sees exactly the
files the mtime scan sees; hashing costs ~0.2s warm.
Five files per job was sized around Telegram test files that paid a
multi-minute silent import (fixed in #123607). With per-file cost back to
seconds, a Telegram-touching diff fanned out ~42 jobs at ~45s runner
setup each. Ten files per job halves the fanout while keeping the worst
job near three minutes, off the PR critical path.
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@obviyus
obviyus marked this pull request as ready for review August 14, 2026 12:29
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: M maintainer Maintainer-authored PR labels Aug 14, 2026
@obviyus
obviyus enabled auto-merge (squash) August 14, 2026 12:32
@obviyus
obviyus disabled auto-merge August 14, 2026 12:32
@obviyus
obviyus enabled auto-merge (squash) August 14, 2026 12:33
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 14, 2026, 8:35 AM ET / 12:35 UTC.

ClawSweeper review

What this changes

The PR records content digests in extension-boundary artifact stamps so cached declarations survive checkout mtime changes, and raises Telegram changed-test job packing from five to ten files.

Merge readiness

⛔ Blocked by patch quality or review findings - 5 items remain

Keep open: the content-digest fallback can accept stale declaration artifacts from a prefix-restored cache after a re-exported source dependency changes, because several lane digests omit their source directories. The approach is useful once each lane hashes its full declaration-input closure.

Priority: P2
Reviewed head: f81b141ecdf402cc39073b457763a364caed9b15

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The stated CI measurements are useful, but the digest omission creates a blocking stale-cache correctness path.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned CI PR is not subject to the external-contributor proof gate; the supplied terminal evidence remains useful supplemental validation.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned CI PR is not subject to the external-contributor proof gate; the supplied terminal evidence remains useful supplemental validation.
Evidence reviewed 6 items Current freshness owner: Current main uses an mtime-only decision at the artifact owner; blame attributes this implementation region to Peter Steinberger in commit 8e398d9.
Incomplete digest input closure: The branch enables hash-stamp freshness for Telegram while its declared inputs remain only api.ts and tsconfig.json.
Telegram public API depends on omitted sources: The unchanged Telegram API barrel re-exports its channel implementation from src, so a source-only change can change generated declarations without changing the current digest inputs.
Findings 1 actionable finding [P1] Hash every source that contributes to a declaration lane
Security None None.

How this fits together

Extension-boundary preparation decides whether cached declaration artifacts can be reused before CI lint and boundary jobs run. The changed-test planner turns Telegram test files into isolated processes packed into bounded CI jobs.

flowchart LR
  A[Source and config inputs] --> B[Boundary artifact preparation]
  B --> C{Mtime or digest fresh?}
  C -->|fresh| D[Reuse cached declarations]
  C -->|stale| E[Rebuild declarations]
  F[Telegram test files] --> G[Changed-test planner]
  G --> H[Packed CI jobs]
Loading

Before merge

  • Hash every source that contributes to a declaration lane (P1) - The hash fallback is enabled here, but TELEGRAM_DTS_INPUTS contains only api.ts and its tsconfig. Since api.ts re-exports modules under src/, a prefix-restored cache from an older source revision still matches after a source-only change and skips declaration regeneration. Include the full declaration source closure for this and the similarly partial lanes, and add that restored-cache regression.
  • Resolve merge risk (P1) - Merging as written can let a prefix-restored cache suppress declaration regeneration after a source-only API dependency change, weakening CI's package-boundary validation.
  • Complete next step (P2) - A narrow source-level cache-validity repair and regression test are clear; the PR should not merge before that repair.
  • Improve patch quality - Hash every declaration-affecting source path for each lane.
  • Improve patch quality - Add and run a restored-cache regression where an unchanged barrel re-exports changed source.

Findings

  • [P1] Hash every source that contributes to a declaration lane — scripts/prepare-extension-package-boundary-artifacts.mts:964-969
Agent review details

Security

None.

PR surface

Tests +42, Other +139. Total +181 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 43 1 +42
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 167 28 +139
Total 3 210 29 +181

Review metrics

Metric Value Why it matters
Production versus test LOC production +167/-28 (net +139); tests +43/-1 (net +42) Most growth is new artifact-cache decision logic, so its source-closure invariant needs direct regression coverage.
Telegram CI packing limit 1 limit changed: 5 → 10 files per job This directly changes CI fanout and per-job runtime for Telegram-touching pull requests.

Merge-risk options

Maintainer options:

  1. Complete declaration-input coverage (recommended)
    Expand each lane’s digest inputs to its complete declaration source closure and add a restored-cache regression before merging.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Expand every declaration lane digest to its complete source closure, add an unchanged-barrel/changed-source restored-cache regression, and rerun focused artifact and planner tests.

Technical review

Best possible solution:

Keep the digest-based mtime recovery, but define each declaration lane’s digest over every source and configuration input that can affect its emitted declarations, with a regression covering an unchanged barrel and changed re-exported source.

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

Yes, from source: restore a digest stamp from revision A, modify a re-exported Telegram source file without changing api.ts, then run freshness evaluation; the new digest still matches and reports fresh. This read-only review did not execute that scenario.

Is this the best way to solve the issue?

No. Content identity is the right cache-reuse mechanism, but its current input lists are too narrow for declaration lanes whose public entrypoints re-export source modules.

Full review comments:

  • [P1] Hash every source that contributes to a declaration lane — scripts/prepare-extension-package-boundary-artifacts.mts:964-969
    The hash fallback is enabled here, but TELEGRAM_DTS_INPUTS contains only api.ts and its tsconfig. Since api.ts re-exports modules under src/, a prefix-restored cache from an older source revision still matches after a source-only change and skips declaration regeneration. Include the full declaration source closure for this and the similarly partial lanes, and add that restored-cache regression.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The defect can make CI boundary validation accept stale generated declarations, but it does not affect product runtime directly.
  • add merge-risk: 🚨 automation: The changed cache-freshness predicate can cause automated CI validation to skip required declaration regeneration.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-owned CI PR is not subject to the external-contributor proof gate; the supplied terminal evidence remains useful supplemental validation.

Label justifications:

  • P2: The defect can make CI boundary validation accept stale generated declarations, but it does not affect product runtime directly.
  • merge-risk: 🚨 automation: The changed cache-freshness predicate can cause automated CI validation to skip required declaration regeneration.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-owned CI PR is not subject to the external-contributor proof gate; the supplied terminal evidence remains useful supplemental validation.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs test/scripts/prepare-extension-package-boundary-artifacts.test.ts test/scripts/ci-changed-node-test-plan.test.ts.
  • [P1] node scripts/check-changed.mjs --dry-run -- scripts/prepare-extension-package-boundary-artifacts.mts test/scripts/prepare-extension-package-boundary-artifacts.test.ts scripts/lib/extension-test-plan.mts.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • Peter Steinberger: Git blame ties the current mtime freshness owner and stamp writer to this commit. (role: introduced artifact freshness behavior; confidence: high; commits: 8e398d95913c; files: scripts/prepare-extension-package-boundary-artifacts.mts)
  • obviyus: The related merged Telegram shard repair supplies the existing process-isolation limit this PR retunes. (role: recent CI test-planner contributor; confidence: medium; commits: fc87337c1469; files: scripts/lib/extension-test-plan.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.

@obviyus
obviyus merged commit af0221b into main Aug 14, 2026
305 of 310 checks passed
@obviyus
obviyus deleted the t3code/ci-boundary-hash-and-shard-resize branch August 14, 2026 12:43
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 15, 2026
…m shards (openclaw#123649)

Hosted CI runners restored the boundary-artifact cache and rebuilt it anyway: fresh checkouts re-stamp every input mtime, so mtime freshness never passed. Stamp files now record the input content digest and byte-identical inputs skip the rebuild (~60s saved per hosted lint/boundary job, 0.17s verify). Telegram CI shards pack ten files per job instead of five now that per-file import cost is back to seconds (openclaw#123607), halving the ~42-job fanout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant