Skip to content

3.x.x: give the PRISM PostgreSQL CI shards 45 minutes and balance them by measured duration (#647) - #648

Merged
kiwidream merged 1 commit into
3.x.xfrom
kiwidream/kw-647-pg-shard-timeout
Oct 1, 2026
Merged

kiwidream merged 1 commit into
3.x.xfrom
kiwidream/kw-647-pg-shard-timeout

Conversation

@kiwidream

@kiwidream kiwidream commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Closes #647.

@Anatolie, as the CI-lane owner: please take a look.

Problem

Since 17:54Z on 2026-10-01, a Rust PRISM PostgreSQL and multi-instance contracts shard has been cancelled at its 30-minute timeout-minutes cap on every 3.x.x push and on several PR runs. No test failed. Each cancellation also fails Prove every Rust PRISM gated test executed and Lint, compile, and test, so the base is red and merges are blocked.

Run Head Result
3.x.x push, 36902925573 8dbdb57 (#642) a shard cancelled at 30 min (shard 0, 17:55→18:25)
3.x.x push, 36903032439 3f1fba6 (#644) shard 1 cancelled (17:56→18:31)
3.x.x push, 36905260160 7dee205 (#640) shard 1 cancelled (18:13→18:44), past live_regtest, in orphan_disposition_migration
PR #641, reopened run 36904674276 bcc53a1 shard 0 cancelled while in stratum_protocol
PR #645, job 110524429291 5c261ad shard 2 cancelled while live_regtest weighted_recipients_tests::real_weighted_recipients_pay_exact_pplns_outputs_through_fanout_spend was silent for more than 3m46s; the same test took 58.5 s on the previous head, where shard 2 finished in 25 min

That weighted-recipients test passed in 5 of the 7 runs since then, in about 60 s. So this is runner variance against a tight cap, not a deterministic hang from #642.

Why one shard is always slow. The per-command times in the shard logs of runs 36895086515, 36898476468, 36903032439 and 36905260160 show it. scripts/run_rust_test_shard.py assigned the sorted target list round-robin. The three heaviest targets, the qbit-prism-server lib tests (~5.5 min), compact_runtime_scale (~4 min, with its optimized --ignored run) and live_regtest (~11.5 min), sit a multiple of four apart in that list. They have landed on the same shard in every run, which spends 25–30 min in tests, while the other three spend 7–16 min. Times include each target's build.

Change

  • The shard runner balances by measured duration. Targets are assigned longest first, each to the shard with the least estimated time so far. The estimates are the measured times of the five heavy targets (live_regtest 700 s, the server lib 330 s, candidate_storm_restart 270 s, compact_runtime_scale 240 s, ledger_postgres 210 s) and 20 s for every other target, which is their mean. Each shard still runs its targets in sorted order.
    • Replaying the logged per-target times against today's 125 targets gives 14.8, 16.8, 16.6 and 17.7 min of tests per shard, down from 14.9, 29.2, 13.7 and 8.5 with round-robin. Setup adds about 4–5 min per job.
    • Coverage is unchanged. Every target runs on exactly one shard, its --ignored selection stays with it, and new targets still join automatically. prism-integration-proof checks the union of the manifests as before.
  • Each shard's job summary lists every command's duration, including a failed one, so the next re-measure has data.
  • timeout-minutes goes from 30 to 45 for this job only, as an interim margin with a comment naming 3.x.x: PRISM PostgreSQL CI shards are cancelled at their 30-minute cap on slow runners (shards 0 and 2, three times on 2026-10-01) #647. It can come back down once the job summaries confirm the balance. No other job's timeout changes: none showed this pattern in the logs.
  • docs/prism-integration-test-gate.md now describes the balancing instead of round-robin.

Tests

  • python3 -m unittest tests.test_run_rust_test_shard: 7 OK. Two of them are new:
    • test_heavy_targets_spread_across_shards_and_loads_stay_balanced: the four heaviest targets land on four different shards, every target lands on exactly one shard, and no shard's estimate exceeds the heaviest target plus one light one. It fails against the old round-robin.
    • test_job_summary_records_each_command_duration_even_on_failure: a header and one row per command run, including the failing one, and nothing for --dry-run.
  • python3 scripts/run_rust_test_shard.py --help works. --dry-run for shards 0–3 against the real workspace gives 18, 37, 39 and 35 commands. That is 129, the 125 targets plus the 4 ignored selections, with no duplicates. Each heavy target is on its own shard except compact_runtime_scale and ledger_postgres, which share shard 3.
  • python3 -c 'import yaml; yaml.safe_load(open(".github/workflows/ci.yml"))': parses.
  • scripts/check_gate_env_reads.py, check_toolchain_pin.py, check_prism_settings.py, check_deleted_test_map.py, check_version_skew.py and check_e2e_scenarios.py: ok.
  • The unit tests that read the workflow or the shard runner, tests.test_check_deleted_test_map, test_check_gate_manifest, test_check_e2e_scenarios, test_check_gate_env_reads, test_prism_container_hardening, test_install_prism_qbit, test_qbit_image_runtime_smoke, test_check_toolchain_pin, test_check_version_skew and test_prism_load_bridge: all OK.

Not run here and why

  • The shards themselves. The build host has no qbitd or docker, so the four PostgreSQL shards were not run locally. This PR's own CI runs them, with the new balance and the 45-minute cap, because PR CI uses the merge ref's workflow. Its job summaries give the first measured per-shard times.

Merge notes

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…m by measured duration (#647)

Round-robin over the sorted target list put the qbit-prism-server lib
(~5.5 min), compact_runtime_scale (~4 min, debug plus the optimized
ignored run) and live_regtest (~11.5 min) on the same shard on every run
since they are four apart in the list. That shard ran 25-30 min of tests
and was cancelled at the job's 30-minute cap on slower runners, while the
other three ran 7-16 min.

The shard runner now assigns targets longest first, each to the shard
with the least estimated time so far. The estimates are the measured
durations of the five heavy targets from the 2026-10-01 shard logs and
20 s for every other target (their mean). Replaying those logs, the four
shards come to 14.8, 16.8, 16.6 and 17.7 min of tests instead of 14.9,
29.2, 13.7 and 8.5. Each target still runs on exactly one shard, with
its ignored selection on the same shard, so the gate-manifest proof is
unchanged. Each shard's job summary now lists every command's duration,
which is the data for the next re-measure.

The job's cap goes to 45 minutes as an interim margin until the job
summaries confirm the balance.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T19:34:22.772581Z 2cd9680 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant