Job-log tree.json step now recommends a 5-second sleep so slow-stamping runners still reuse CI results (GST-3339) (#4589)

When a repository's artifact storage is full, gstack's reuse of CI test
results reads tree.json from one log line, and the docs' `sleep 2` after
that line was too short on a Ubicloud runner, so gstack refused the run
and fell back to running tests locally.

The docs, the troubleshooting entry and the refusal's fix line now say
`sleep 5`, and a new test checks the documented sleeps against GitHub's
whole-second step times.

Repositories that copied the old step should change `sleep 2` to `sleep
5`.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-21 06:49:28 +00:00
1 parent ebc867422e
commit 0adfab9dd9
5 files changed
+48 -5

No files matched your search

+10 -3
View File
@@ -850,14 +850,21 @@ hit", so the run holds no `tree.json` and every carry refuses it as
`artifact_missing`. A profile that sets `tree_log_step` to the name of one step
in its job lets gstack read `tree.json` from that job's log instead, only when
the run holds no unexpired artifact by the profile's name at all (an artifact
always wins). The step prints one line, after the test step, a second after
that step ends and a second before the next step starts:
always wins). The step prints one line, after the test step, at least a
second after that step ends, then sleeps 5 seconds before the next step starts:
```yaml
- name: Print tree.json
run: sleep 1 && echo "GSTACK_TREE_JSON checks-tree $(base64 -w0 tree.json)" && sleep 2
run: sleep 1 && echo "GSTACK_TREE_JSON checks-tree $(base64 -w0 tree.json)" && sleep 5
```
The long sleep after the line is what matters. The jobs API cuts each step's
start and finish to the whole second, and the runner stamps a line when it
reads the output, a fraction of a second to a second or more after the `echo`
ran. With `sleep 2` the next step started 1.65 s after the line's stamp on a
Ubicloud runner (run 44845717681), inside the second the check keeps clear, and
the run was refused; `sleep 5` leaves room for about 3 s of stamping delay.
gstack reads the log with `gh api --allow-escape-sequences
repos/<repo>/actions/jobs/<job id>/logs` for every profile job at the attempt
that ran, and counts lines matching
+2 -1
View File
@@ -7552,7 +7552,8 @@ or `no_verified_run` detail) and the lane runs here instead
([pregate.md](pregate.md#tree-log-step)).
**Fix.** Print the line only from the named step, after the test step, with
`sleep 1` before it and `sleep 2` after it, and make sure no test prints `GSTACK_TREE_JSON`. Then
`sleep 1` before it and `sleep 5` after it (`sleep 2` after it is too short on
runners that stamp output late), and make sure no test prints `GSTACK_TREE_JSON`. Then
dispatch a fresh run at the same head and rerun `gstack-ci-carry wait`.
<a id="ci-carry-rerun-malformed"></a>