Skip to content

test(core): let the goal-audit fixture's held preparation observe shutdown cancellation - #366

Merged
lg2m merged 1 commit into
mainfrom
fix/goal-audit-shutdown-flake
Oct 19, 2026
Merged

lg2m merged 1 commit into
mainfrom
fix/goal-audit-shutdown-flake

Conversation

@lg2m

@lg2m lg2m commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

What changes

This is a test-only fix for the main CI flake sessions::tests::goal_model_audit::goal_model_audit_late_and_stale_confirmation_cannot_achieve (ShutdownTimedOut). It failed main CI on a9bff3ef and on 7750ec7f, and failed about 1 in 30 local stress runs. Tracked as gate G-flake in docs/plans/release-0.1.8.md (#364, ENG-1077).

Root cause

The fixture's Loader returned std::future::pending() for every load after the second. The goal driver can queue a further goal run before the test calls shutdown(). Shutdown cancels that run, but the owner awaits runtime preparation before settling (execution.rs: "the loader owns construction until it returns"). A pending load that never resolves never returns, so shutdown hit SHUTDOWN_GRACE (30 s).

The runtime behaves as designed: the RuntimeLoader contract requires cooperative or eventually-returning loaders. The fixture violated that contract.

Fix

The held load now implements load_with_progress. It awaits RuntimeLoadProgress::cancelled() and then returns an error, the same pattern as CooperativePreparationLoader in tests/deadlines.rs. The test's assertions are unchanged: request count 3, no achievement, and the expected terminal goal states.

Verification

  • cargo nextest run -p qq-core -E 'test(/goal_model_audit/)' --retries 0 --stress-count 40: 40/40 iterations passed, all 4 goal-audit tests in each. Before: 1 failure in 30 iterations of the single test.
  • fmt, cargo xtask lint and cargo clippy -p qq-core --all-targets --all-features -D warnings are clean.

No runtime, protocol, schema or descriptor change.

…tdown cancellation

The audit fixture's loader returned a never-resolving future for every load after the second. The goal driver can queue a further goal run before the test calls shutdown; shutdown cancels it, but the owner awaits preparation before settling, and a non-cooperative pending load never returns, so shutdown hit SHUTDOWN_GRACE and failed with ShutdownTimedOut (about 1 in 30 stress runs, and main CI on a9bff3e and 7750ec7).

The held load now awaits RuntimeLoadProgress cancellation and returns an error, matching the loader contract the runtime relies on. No runtime change.
@chatgpt-codex-connector

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 ⚠️ Failed 2026-10-19T06:07:00.589108Z d25ff71 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m
lg2m merged commit ed2b9d6 into main Oct 19, 2026
6 checks passed
@lg2m
lg2m deleted the fix/goal-audit-shutdown-flake branch October 19, 2026 06:18
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