Repository navigation
Conversation
EwoutH
changed the base branch from
lifecycle-actions-remove
to
lifecycle-actions-vocabulary
November 22, 2026 09:43
Merged
1 task done
EwoutH
force-pushed
the
lifecycle-actions-invariants
branch
from
November 22, 2026 09:54
28d9ad8 to
1bafd12
Compare
Contributor
|
could Probe.on_progress also check self.progress against the progress reported so far? the checks after the outer call miss the value seen inside the hook: interrupting a duration-10 action at t=2 gives delta=0.2 but self.progress=0.4 there, then progress returns to 0.2 after settlement. a hook-time assertion catches that with the existing seeds. |
EwoutH
force-pushed
the
lifecycle-actions-invariants
branch
from
November 24, 2026 16:03
1bafd12 to
8403712
Compare
EwoutH
force-pushed
the
lifecycle-actions-invariants
branch
from
November 24, 2026 16:11
8403712 to
8fbfa57
Compare
Member
Author
|
@atul-upadhyay-7 added in 8fbfa57. On the old code it fails 8 seeds, so it would have caught the double count. |
atul-upadhyay-7
approved these changes
Nov 24, 2026
atul-upadhyay-7
left a comment
Contributor
There was a problem hiding this comment.
checked the updated test. it catches the progress double count inside the hook. lgtm
EwoutH
force-pushed
the
lifecycle-actions-invariants
branch
3 times, most recently
from
November 25, 2026 19:28
2964d9e to
790a5e8
Compare
EwoutH
added a commit
that referenced
this pull request
Nov 26, 2026
…ss/on_stop, removal (#4172) Implements the actions part of #4120 (section 3) as one contract: a final `cancel()`, separate `interrupt()`/`resume()`, completion wins on time, `on_progress(delta)` and `on_stop()`, re-entry guards, and removal that cancels an agent's actions with their hooks. It sits between #4171 (dropped-wake warning, below) and #4176 (randomized invariant test, above). The four commits follow the spec's sections and can be reviewed one at a time: vocabulary and state, completion wins and scheduling, hooks and guards, removal. Or read the final `actions.py` against the spec.
A seeded test makes random lifecycle calls, some of them from inside hooks and some at the exact deadline of an action, and checks the invariants from #4120 between every call and every event: the slot holds exactly the ACTIVE action, an ACTIVE action has one completion event at its deadline, reported progress matches, one on_stop() per attempt and one final hook per final state, final states never change, and a removed agent leaves nothing running. A call that raises ValueError must leave everything unchanged. Refs #4120 Assisted-by: Claude Opus 5.5
The checks after each outer call missed the value seen inside the hook, where progress was counted twice before the previous commit's fix. Assisted-by: Claude Code
EwoutH
force-pushed
the
lifecycle-actions-invariants
branch
from
November 26, 2026 18:38
790a5e8 to
0b7eb9a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-PR Checklist
Approval Link
#4120, section 3.9 (invariants) and section 5, step 4.
Summary
A seeded randomized test that makes random lifecycle calls and checks the invariants of section 3.9 between every call and every event. Part 6 of 6.
Motive
The earlier parts each fix specific sequences. The invariants are what the contract promises for any sequence, including hooks that make lifecycle calls, which is where most lifecycle bugs came from.
Implementation
interrupt_foran interrupted action, cancel any open action, remove an agent, and schedule a random call at the exact deadline of the current action. Hooks occasionally interrupt, cancel or resume their own action, andon_idlestarts new ones.Model._advance_time), so invariants are checked between events, not just between run calls.on_stop()per ended attempt and one final hook per final state; final states never change; a removed agent has nothing ACTIVE or INTERRUPTED and no wake. A call that raisesValueErrormust leave everything unchanged.Usage Examples
Not applicable; test only.
Additional Notes
on_progress, skippingon_stop, skipping interrupted actions on removal, and queuing wakes after removal. Each makes it fail. Completion-wins itself isn't an invariant (an action interrupted at its deadline still satisfies them), so the dedicated tests in part 3 cover it.Written with help from Claude Code (Claude Opus 5.5).