| β¦ | β¦ | @@ -267,8 +267,22 @@ export function resolveAgentAwarenessRelayPublishSnapshot(input: { | |
| 277 | + | ) || 0; | |
| 278 | + | const turnCompletedAt = Date.parse(thread.latestTurn?.completedAt ?? "") || 0; | |
| 279 | + | const sessionUpdatedAt = Date.parse(thread.session?.updatedAt ?? "") || 0; | |
| 280 | + | return turnCompletedAt > startedAt || (workStartedAt > startedAt && sessionUpdatedAt > startedAt); | |
π‘ Medium relay/AgentAwarenessRelay.ts:280
A terminal turn that settles after restart without a materialized latestTurn is filtered out, so its post-restart Done alert is never published. Because latestUserMessageAt is old while session.updatedAt is new, the workStartedAt > startedAt && sessionUpdatedAt > startedAt check returns false in both the startup snapshot and first publish; accept the post-restart session update for this no-checkpoint case.
| 1 | - return turnCompletedAt > startedAt || (workStartedAt > startedAt && sessionUpdatedAt > startedAt); |
| 2 | + return turnCompletedAt > startedAt || sessionUpdatedAt > startedAt; |
π Reply "fix it for me" or copy this AI Prompt for your agent:
| 1 | In file @apps/server/src/relay/AgentAwarenessRelay.ts around line 280: |
| 2 | |
| 3 | A terminal turn that settles after restart without a materialized `latestTurn` is filtered out, so its post-restart Done alert is never published. Because `latestUserMessageAt` is old while `session.updatedAt` is new, the `workStartedAt > startedAt && sessionUpdatedAt > startedAt` check returns `false` in both the startup snapshot and first publish; accept the post-restart session update for this no-checkpoint case. |
I checked the session lifecycle. restoreCompaction can set an existing session back to ready with a new updatedAt (ProviderCommandReactor.ts:440-459) without a new user turn. Accepting sessionUpdatedAt > startedAt alone would let that old thread emit a fresh Done alert after restart, which is the reported bug. If this process has already published an active state, the map allows its completion. For a terminal state seen first, we require evidence that the work itself began or finished after startup.