Skip to content

bug(goal-loop): 'unrelated traffic cannot renew the screen grace' failed on main CI (2 deliveries, expected 1) #1314

Closed

Description

@Juliusolsson05

Evidence

Suspected mechanism (not yet proven)

The test drives 4 × (turn_started, turn_completed) at 30 s intervals under fake timers. processState.active is latched, so each turn_completed re-enters requestContinue → holdUntilQuiet with the 45 s GOAL_LOOP_ACTIVITY_GRACE_MS. The first hold expires at about 45 s and delivers.

Whether a later turn_completed opens a second hold that also expires before the 120 s mark depends on how the async persistence in startLoop and the delivery (real fs I/O, real promises) interleaves with advanceTimersByTimeAsync. Under CI load, the ordering can let a second hold start early enough to deliver.

Next step

Instrument the test: record the delivery timestamps and the heldSince for each hold, and run the whole file under --sequence.shuffle and CPU load until it reproduces. Then decide whether a post-delivery turn_completed should open a new grace window at all; that would be a product bug, not a test bug. Never widen the timeouts.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    class:C9-testsTest hygienesev:P2Real bug with a workaroundtype:bugSomething works wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions