githubnext / githubnext/gh-aw-cao
[self-care:docs-build-time-investigator] Skip cache-mode dashboard rebuild dispatches when a same-revision dashboard bundle already exists
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 1
- Avg merge
- 49m
- Merged PRs (30d)
- 837
Description
### Summary
Scheduled `docs.yml` runs are already hitting both dependency and activity caches, but they still dispatch `dashboard-build.yml` every time in cache mode. Across 10 comparable successful scheduled runs in the last 14 days, that extra dispatch-and-handoff path accounts for about 56.5 seconds of median execution time, or roughly 63% of the 89 second median workflow runtime.
### Timing evidence
Evidence window: 2026-09-10T08:02:05Z to 2026-09-10T11:21:54Z.
Sample: 10 successful scheduled `docs.yml` runs and their 10 dispatched `dashboard-build.yml` child runs.
Parent `docs.yml` median / p90:
- Queue time: 4.0s / 35.9s
- Workflow execution: 89.0s / 100.3s
- `dashboard` job: 39.0s / 43.0s
- `build` job: 30.5s / 40.6s
- `deploy` job: 9.0s / 10.1s
- `Dispatch dashboard build` step: 33.5s / 38.0s
Child `dashboard-build.yml` median / p90:
- Workflow execution: 23.0s / 30.1s
- `activity` job: 5.0s / 7.0s
- `build` job: 14.5s / 20.3s
- `Restore collected activity data`: 1.0s / 2.0s
- `Build Dashboard Language sources`: 1.0s / 2.0s
- `Upload dashboard artifact`: 3.0s / 3.0s
Cache verification from trusted Actions metadata:
- Parent `build` job skipped both `Install dependencies` and `Save node_modules` in all 10 samples, confirming node_modules cache hits.
- Child `activity` job completed `Dispatch activity refresh` in 0s in all 10 samples after the cache lookup step, consistent with cache-mode reuse of the prior activity snapshot rather than a fresh refresh.
Comparable run links:
- Parent runs: 34470899416, 34469146942, 34467759060, 34466649482, 34465827096, 34463871122, 34462481341, 34461522732, 34455609861, 34452995123
- Child runs: 34470918014, 34469160548, 34467771423, 34466724136, 34465839656, 34463885197, 34462492468, 34461534324, 34455663739, 34453006823
Confidence: medium-high. The step and job timings were read from trusted Actions metadata for all 20 sampled runs, but duplicate-open-issue verification was incomplete because `gh issue list` returned a non-zero exit in this environment.
### Bottleneck
The dominant repeated cost is not Astro generation, dependency installation, or dashboard source assembly. It is the mandatory workflow dispatch to `dashboard-build.yml` on every scheduled cache-mode run, followed by child-run cache restore and artifact upload/download even when no fresh activity refresh was needed.
Relevant source locations:
- `.github/workflows/docs.yml`: the `dashboard` job always dispatches `dashboard-build.yml`, and the `build` job restores the dashboard cache only after waiting for that child run.
- `.github/workflows/dashboard-build.yml`: in cache mode, the child workflow first checks for cached activity data and often skips the refresh, yet still rebuilds and re-uploads the dashboard artifact.
### Recommended changes
In `.github/workflows/docs.yml`, add a same-revision reusable dashboard fast path before dispatching `dashboard-build.yml` for schedule-driven cache-mode runs:
1. Try to restore a persisted dashboard bundle keyed by the workflow source revision and cache mode, for example a key derived from `github.workflow_sha` plus `inputs.mode || 'cache'`.
2. If that dashboard bundle is restored successfully, skip the `dashboard` dispatch job entirely and continue directly to Pages packaging.
3. Dispatch `dashboard-build.yml` only when:
- `mode == 'live'`, or
- no matching dashboard bundle exists for the current workflow revision.
4. After a successful child build, save the produced dashboard bundle under the same reusable key so the next scheduled cache-mode run can consume it directly.
This keeps live refresh behavior unchanged while allowing cache-mode schedules to reuse a dashboard artifact that already reflects the same workflow source revision.
### Expected effect and validation
Expected savings:
- About 33.5s median directly from the parent `Dispatch dashboard build` wait.
- About 56.5s combined median when also avoiding the child workflow's execution and artifact handoff.
- Roughly 63% of the current 89s median workflow execution time.
Validation plan:
1. Compare at least 5 scheduled cache-mode runs before and after the change.
2. Confirm the parent `dashboard` dispatch path is skipped on cache hits.
3. Recompute median and p90 for parent workflow execution and `build`/`deploy` jobs.
4. Verify the deployed Pages output still contains the expected `/cao` dashboard files and current docs content.
5. Run at least one `workflow_dispatch` with `mode=live` to confirm freshness and fallback behavior remain correct.
### Caveats
- The shortcut should be limited to cache-mode runs and should never bypass explicit `mode=live` refreshes.
- The reusable key must be tied to the workflow source revision so dashboard content is not reused across incompatible source changes.
- This recommendation does not assume target data freshness beyond what the current cache-mode contract already allows.
- Open-issue duplicate verification could not be completed in this environment because `gh issue list` exited non-zero, so maintainers should do a quick duplicate check before acting.
### Control Plane
- Correlation ID: 34470492877-516
- Central repository: githubnext/gh-aw-cao
- Control plane run: https://github.com/githubnext/gh-aw-cao/actions/runs/34470492877
### References
- Workflow source: `.github/workflows/docs.yml`
- Workflow source: `.github/workflows/dashboard-build.yml`
- Parent runs:
- https://github.com/githubnext/gh-aw-cao/actions/runs/34470899416
- https://github.com/githubnext/gh-aw-cao/actions/runs/34469146942
- https://github.com/githubnext/gh-aw-cao/actions/runs/34467759060
- https://github.com/githubnext/gh-aw-cao/actions/runs/34466649482
- https://github.com/githubnext/gh-aw-cao/actions/runs/34465827096
- https://github.com/githubnext/gh-aw-cao/actions/runs/34463871122
- https://github.com/githubnext/gh-aw-cao/actions/runs/34462481341
- https://github.com/githubnext/gh-aw-cao/actions/runs/34461522732
- https://github.com/githubnext/gh-aw-cao/actions/runs/34455609861
- https://github.com/githubnext/gh-aw-cao/actions/runs/34452995123
- Child runs:
- https://github.com/githubnext/gh-aw-cao/actions/runs/34470918014
- https://github.com/githubnext/gh-aw-cao/actions/runs/34469160548
- https://github.com/githubnext/gh-aw-cao/actions/runs/34467771423
- https://github.com/githubnext/gh-aw-cao/actions/runs/34466724136
- https://github.com/githubnext/gh-aw-cao/actions/runs/34465839656
- https://github.com/githubnext/gh-aw-cao/actions/runs/34463885197
- https://github.com/githubnext/gh-aw-cao/actions/runs/34462492468
- https://github.com/githubnext/gh-aw-cao/actions/runs/34461534324
- https://github.com/githubnext/gh-aw-cao/actions/runs/34455663739
- https://github.com/githubnext/gh-aw-cao/actions/runs/34453006823
> Generated by [SelfCare / Docs Build Time](https://github.com/githubnext/gh-aw-cao/actions/runs/34471006840) · pi · gpt54 · 39.1 AIC · ⌖ 7.19 AIC · ⊞ 8.8K · [◷](https://github.com/search?q=repo%3Agithubnext%2Fgh-aw-cao+is%3Aissue+%22gh-aw-workflow-call-id%3A+githubnext%2Fgh-aw-cao%2Fself-care-docs-build-time-investigator%22&type=issues)
> - [x] expires on Sep 24, 2026, 11:30 AM UTC
Contributor guide
Research direction
Start by reading the dashboard job and cache handling in .github/workflows/docs.yml, then compare the cache-mode flow in .github/workflows/dashboard-build.yml. Trace how the dashboard bundle is restored, dispatched, and consumed before changing the workflow. Done means scheduled cache-mode runs skip the child dispatch on same-revision hits, live mode still refreshes, and the stated Pages and timing validations pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd, devops, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100