Skip to content

fix(core): pause the goal when a held approval times out after its expired owner cancelled the run - #515

Merged
lg2m merged 2 commits into
mainfrom
fix/goal-deadline-held-approval
Oct 30, 2026
Merged

lg2m merged 2 commits into
mainfrom
fix/goal-deadline-held-approval

Conversation

@lg2m

@lg2m lg2m commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Change

Fixes the flake that turned main red after #510 (goal_parent_deadline_preserves_a_sponsored_childs_unanswered_approval). The flake came from a real ordering bug in the runtime.

The scenario: a goal's run spawns a child, and the child asks the user a question. The parent's run deadline expires before anyone answers. The goal should pause on that unanswered question so the user can answer and resume it.

Two timers race: the child's approval wait (10 min by default) and the parent's run deadline.

  • If the parent's deadline is handled first, the child's hold is torn down through expire_goal_hold. That path passes the expired goal owners, and the goal pauses. ✔
  • If the child's approval timer fires in the window after the parent has already been cancelled, conclude → Store::conclude_tool_approval passed &[] as the expired owners. pause_for_approval then saw a cancelled run with no expired owner and left the goal Active. ✘ The user loses the "needs your answer" pause.

conclude now collects the expired goal owners the same way expire_goal_hold does and passes them through. This is one helper, expired_goal_owners, used by both paths.

Verification

  • New test a_childs_timed_out_hold_pauses_the_goal_after_its_expired_owner_cancelled_it forces the bad ordering: the child's hold, an expired parent deadline, a cancelled child, then the approval timeout fires. It fails on origin/main with must pause the goal: Active and passes with the fix.
  • cargo nextest run -p qq-core --profile ci -E 'test(=…goal_parent_deadline_preserves_a_sponsored_childs_unanswered_approval)' --stress-count 300: 300/300 passed.
  • cargo nextest run -p qq-core -E 'test(/approval|goal/)': 245 passed.
  • cargo xtask check --full: passed.
  • Labelled ci:full, so the PR runs the full suite like main does.

Known impact

None. No protocol, store or config change. The release PR (chore(release): v0.1.10) is stacked on this one.

…pired owner cancelled the run

A sponsored child's ask_user hold could time out in the window after its
goal-paying parent hit its run deadline and cancelled it. The timeout path
concluded the approval with no expired owners, so pause_for_approval saw a
cancelled run and left the goal Active instead of pausing it on the
unanswered approval. The timeout path now passes the expired owners the
same way the cancellation path does.
@lg2m lg2m added the ci:full label Oct 30, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-30T21:15:27.687863Z 6ddc94f Manual request
ℹ️ 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 added a commit that referenced this pull request Oct 30, 2026
@lg2m lg2m mentioned this pull request Oct 30, 2026
@lg2m
lg2m added this pull request to stack #516 October 30, 2026 20:42
@lg2m

lg2m commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f387633ff

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lg2m

lg2m commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 6ddc94fbf8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lg2m
lg2m merged commit 9f94e72 into main Oct 30, 2026
10 checks passed
@lg2m
lg2m deleted the fix/goal-deadline-held-approval branch October 30, 2026 21:19
lg2m added a commit that referenced this pull request Oct 30, 2026
* chore(release): v0.1.10

* docs(changelog): move the v0.1.10 Upgrading block into its release section and list #515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant