githubnext / githubnext/gh-aw-cao
[self-care:docs-build-time-investigator] Build dashboard inline in docs.yml cached path to remove workflow/artifact round-trip
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 1
- Avg merge
- 49m
- Merged PRs (30d)
- 837
Description
### Summary
The docs workflow is already getting consistent cache hits, but it still spends roughly a third of median wall time on an avoidable second workflow and artifact handoff before the site can upload to Pages. The fastest evidence-backed improvement is to build the dashboard directly inside `docs.yml`'s `build` job when running in cached mode, instead of dispatching `dashboard-build.yml`, uploading `central-agentic-ops-dashboard`, then downloading it back into the same workflow.
### Timing evidence
Evidence window: latest 20 completed `docs.yml` runs from the last 14 days, with 12 successful comparable samples and 4 disclosed failures/outliers excluded from medians (`33868278135`, `33863037006`, `33862582071`, `33861249069`).
Across the 12 successful samples:
- Full `docs.yml` workflow median: 105s; p90: 126.7s.
- `dashboard` job median: 36s; p90: 45.8s.
- `build` job median: 29.5s; p90: 38.8s.
- `deploy` job median: 10s; p90: 10.9s.
Like-for-like cached dashboard-build samples paired to those runs show:
- `dashboard-build.yml` `activity` job median: 7s.
- `dashboard-build.yml` `build` job median: 11s.
- `docs.yml` artifact download step (`Mount dashboard at /cao`) median: about 1.7s.
- `dashboard-build.yml` uploads two artifacts on every cached run: about 4.6 MB for `central-agentic-ops-dashboard-data` and about 4.8 MB for `central-agentic-ops-dashboard`.
Trusted cache evidence from logs/metadata:
- `actions/setup-node` npm cache restored on sampled runs.
- `Restore node_modules` reported a cache hit on all 12 sampled successful `docs.yml` runs.
- Cached dashboard mode also reported `cao-activity-*` cache hits before reusing prior activity data.
Even with those cache hits, the dispatched reusable workflow still adds repeated fixed costs for workflow startup, job scheduling, artifact packaging, artifact upload, artifact download, and job-to-job waiting.
### Bottleneck
The current cached path performs a second workflow round-trip for dashboard generation:
1. `docs.yml` dispatches `dashboard-build.yml` from the `dashboard` job.
2. `dashboard-build.yml` restores cached activity data and assembles the dashboard.
3. `dashboard-build.yml` uploads the dashboard artifact.
4. `docs.yml` waits, then downloads that artifact into `dist` before uploading Pages.
That design dominates wall time more than the actual local build work. The heavy work that remains in `docs.yml` is not Astro generation: sampled `npm run docs:build` executions were about 5s median, while `node_modules` restore was about 6.6s median and the extra dashboard workflow plus handoff commonly consumed roughly 20s+ before queue gaps.
### Recommended changes
In `.github/workflows/docs.yml`, replace the current dispatch/download pattern for cached dashboard generation with an in-process build inside the existing `build` job:
- keep `dashboard-build.yml` available for standalone dashboard production or live refresh cases if still needed;
- for `docs.yml` cached runs, restore the `cao-activity-*` cache directly in `docs.yml` and run the same dashboard assembly commands used in `dashboard-build.yml` (`dashboard/site/scripts/build.mjs` and `dashboard/report/dashboard-language-sources.mjs`) into `dist/cao` before `upload-pages-artifact`;
- remove the `dashboard` job dependency and the `download-artifact` hop for the cached path.
Relevant source locations:
- `.github/workflows/docs.yml`: `dashboard` job dispatch, `build` job artifact download, and Pages upload path.
- `.github/workflows/dashboard-build.yml`: cached activity restore, dashboard assembly, source generation, and artifact upload steps.
### Expected effect and validation
Expected effect: eliminating the second workflow startup and one upload/download artifact hop should save about 20-30 seconds on typical cached runs, based on:
- `dashboard` job median 36s,
- paired `dashboard-build.yml` work of roughly 18s median before queue/wait overhead,
- plus about 1.7s median to download the dashboard artifact back into `docs.yml`.
That is above the 15% threshold against the 105s median full workflow time and should preserve correctness if the same cached activity inputs are restored and the same dashboard build scripts are executed.
Validation:
1. Compare at least five post-change cached scheduled runs against the current 12-run baseline.
2. Confirm median full workflow time drops by at least 15% or 60s-equivalent relative savings on the affected path.
3. Verify generated `dist/cao` contents match the current reusable workflow output for the same source SHA and cached activity snapshot.
4. Confirm Pages deployment contents remain unchanged apart from expected timestamp/digest differences.
### Caveats
- This recommendation is for the cached path analyzed here. If live activity refresh is required, a separate dispatched workflow may still be appropriate.
- Queue time and runner variance affect total wall time, so the strongest claim is reduction of fixed orchestration overhead rather than raw CPU savings.
- Issues are disabled in this repository, so if maintainers want to act on this they may need to translate it into their preferred tracking channel.
### Control Plane
- Correlation ID: `33873018135-157`
- Central repository: `githubnext/gh-aw-cao`
- Control plane run: https://github.com/githubnext/gh-aw-cao/actions/runs/33873018135
### References
- `docs.yml` runs: `33873408704`, `33870779846`, `33870283338`, `33869499149`, `33869060795`, `33868387607`, `33868316885`, `33867561074`, `33867473151`, `33865999634`, `33865645042`, `33865545862`
- Paired `dashboard-build.yml` runs: `33873426731`, `33870789852`, `33870293163`, `33869514535`, `33869070344`, `33868476199`, `33868352792`, `33867602905`, `33867485369`, `33866020582`, `33865710142`, `33865557449`
- Workflow sources: `.github/workflows/docs.yml`, `.github/workflows/dashboard-build.yml`
> Generated by [SelfCare / Docs Build Time](https://github.com/githubnext/gh-aw-cao/actions/runs/33873394595) · pi · gpt54 · 59.5 AIC · ⌖ 8.5 AIC · ⊞ 8.6K · [◷](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 18, 2026, 12:42 PM UTC
Contributor guide
Research direction
Start by reading `.github/workflows/docs.yml` and `.github/workflows/dashboard-build.yml`, focusing on the dashboard dispatch, cached activity restore, artifact transfer, and Pages upload steps. Run the existing workflow or inspect its referenced commands, including `dashboard/site/scripts/build.mjs` and `dashboard/report/dashboard-language-sources.mjs`. Done means the cached path builds `dist/cao` in the existing build job, preserves deployment contents, and meets the stated timing validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, javascript
- Domain
- build-system, ci-cd, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100