githubnext / githubnext/gh-aw-cao
[self-care:docs-build-time-investigator] Skip dispatched dashboard-build workflow when docs cache is warm
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 1
- Avg merge
- 49m
- Merged PRs (30d)
- 837
Description
### Summary
The Documentation Pages workflow is spending most of its time waiting on a second workflow that is already serving cached data. In the latest 18 successful `docs.yml` schedule runs from the last 14 days, the top-level workflow median was 85.5s (p90 93s), and the `dashboard` job alone consumed 36.5s median (p90 39s). For the same runs, the dispatched `dashboard-build.yml` workflow used cached activity every time, and its own work finished in about 15–20s total. The remaining ~16–22s per run is dispatch/polling overhead that can be removed by building the dashboard directly inside `docs.yml` when `mode=cache`.
### Timing evidence
- Evidence window: latest 20 completed `docs.yml` runs from the last 14 days; 18 comparable successful schedule runs, 2 disclosed failures.
- Full `docs.yml` duration: median 85.5s, p90 93s.
- Queue time before first job start: median 3.5s, p90 5s.
- Job durations across successful runs:
- `dashboard`: median 36.5s, p90 39s
- `build`: median 28.5s, p90 35s
- `deploy`: median 9.5s, p90 11s
- Step timings inside successful `build` jobs:
- `Restore node_modules`: median 5.5s, p90 8s
- `Build documentation`: median 5s, p90 6s
- `Mount dashboard at /cao`: median 1s, p90 2s
- `Upload Pages artifact`: median 2s, p90 3s
- Dashboard subworkflow evidence from 10 representative successful dispatches:
- `dashboard-build.yml` `activity` job: median 6s, p90 7s
- `dashboard-build.yml` `build` job: median 12s, p90 15s
- In all 10 checked runs, `Check for a cached activity snapshot` succeeded and `Dispatch activity refresh` was skipped.
- Confidence: high for schedule/cache-mode behavior in the sampled window because the successful runs were homogeneous and repeated on the same trigger.
### Bottleneck
The dominant repeated cost is not Astro generation, npm install, artifact upload, or Pages deployment. Those are all small relative to the `dashboard` job’s 36.5s median. The expensive part is the indirection in `.github/workflows/docs.yml` where the `dashboard` job dispatches `.github/workflows/dashboard-build.yml` and waits for it to complete even when that subworkflow immediately finds a warm cached activity snapshot and skips the activity refresh.
This design adds orchestration overhead from workflow dispatch, scheduling, and cross-workflow artifact handoff on every scheduled docs run. In the sampled runs, that overhead accounts for roughly 16–22s beyond the actual cached dashboard build work, or about 19–26% of the full workflow median.
### Recommended changes
In `.github/workflows/docs.yml`, keep the current dispatched path for `mode=live`, but add a fast path for the default scheduled/cache case:
1. Restore the cached activity snapshot directly in `docs.yml`.
2. Run the existing dashboard assembly commands from `.github/workflows/dashboard-build.yml` inline in a local job when the cache is present.
3. Upload the resulting dashboard artifact directly for the docs `build` job to mount, instead of dispatching and waiting on a separate workflow.
4. Fall back to the current dispatched `dashboard-build.yml` path only when the activity cache is missing or when `mode=live` is explicitly requested.
This preserves freshness and correctness because live refresh still uses the current path, while cache-mode runs stop paying dispatch latency just to confirm the cache already exists.
### Expected effect and validation
Expected effect: save about 16–22 seconds per normal scheduled docs build, which is above the workflow threshold of 60s-or-15% only on the percentage criterion. Against the observed 85.5s median, the expected reduction is about 19–26%.
Validation plan:
- Compare 10 like-for-like successful schedule runs before and after the change.
- Acceptance check: `docs.yml` median duration drops by at least 15%, with `dashboard` job median dropping from 36.5s toward the low- to mid-teens, while cached runs still publish the same dashboard artifact shape and live runs continue to refresh activity correctly.
- Guardrail: confirm the fallback path still dispatches `dashboard-build.yml` when the activity cache is absent.
### Caveats
- This recommendation is specific to reusable dashboard generation in cache mode; dependency installation, Astro docs build, Pages packaging, and deploy were not the main bottlenecks in the sampled runs.
- Two sampled schedule runs failed because artifact download hit installation rate limits in `Mount dashboard at /cao`; this issue should also be reduced indirectly if fewer runs rely on cross-workflow artifact download, but the primary recommendation here is about avoiding unnecessary dispatch overhead.
- The evidence window was dominated by schedule-triggered cache-mode runs. If maintainers care more about `workflow_dispatch` with `mode=live`, they should measure that path separately.
### Control Plane
- Correlation ID: `33960192642-214`
- Central repository: `githubnext/gh-aw-cao`
- Control plane run: `https://github.com/githubnext/gh-aw-cao/actions/runs/33960192642`
### References
- Workflow source: `.github/workflows/docs.yml`
- Workflow source: `.github/workflows/dashboard-build.yml`
- Successful sample runs: 33960380055, 33959540500, 33958200172, 33957765340, 33956860871, 33956158753, 33955735773, 33955266935, 33954162792, 33952772393, 33952344014, 33951410905, 33950904610, 33950118467, 33948753307, 33948044122, 33947405373, 33947008021
- Disclosed failed/outlier runs: 33958860090, 33953444030
- Example run links:
- https://github.com/githubnext/gh-aw-cao/actions/runs/33960380055
- https://github.com/githubnext/gh-aw-cao/actions/runs/33960386181
- https://github.com/githubnext/gh-aw-cao/actions/runs/33958860090
> Generated by [SelfCare / Docs Build Time](https://github.com/githubnext/gh-aw-cao/actions/runs/33960351649) · pi · gpt54 · 48.4 AIC · ⌖ 9.57 AIC · ⊞ 8.7K · [◷](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 19, 2026, 10:28 AM UTC
Contributor guide
Research direction
Start by comparing the dashboard job in .github/workflows/docs.yml with the cache and assembly steps in .github/workflows/dashboard-build.yml. Trace the cache-mode, live-mode, and missing-cache paths, then validate with like-for-like scheduled runs: cached runs should avoid unnecessary dispatch overhead, preserve the dashboard artifact shape, and retain the live refresh fallback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100