Versions
Reproduced in a local TypeScript integration with agents-runtime 0.6.3 based on
91758919586d7c0c70a7b8190a39b6e06fc2ea14. This build has downstream compaction
configuration changes, but the background processWake lifecycle is unchanged.
I also inspected main at bb397424db0e1c153dc356713fd3dfd40315470c; the same
lifecycle is present there. I have not run the integration against that main SHA.
Bug description
Background compaction can finish successfully after the normal idle timeout
ends its wake, but its checkpoint stays running and the summary is never
applied. The original conversation remains available.
The non-blocking behavior in #4605 is intentional. The problem is the unfinished
checkpoint after the background work has ended, not that a user turn returns
before its summary finishes.
To reproduce without live inference, use a fixture turn whose reported usage
exceeds the background threshold and hold the public summarizeComplete hook
behind a barrier:
const gate = Promise.withResolvers<void>()
const returned = Promise.withResolvers<void>()
const summarizeComplete: NonNullable<AgentConfig['summarizeComplete']> = async () => {
await gate.promise
returned.resolve()
return { content: [{ type: 'text', text: 'Generated summary.' }], stopReason: 'stop' }
}
- Configure a 100 ms runtime idle timeout and a longer summary deadline.
- Send one user message. Let the turn finish and background summarization start.
- Keep the gate closed until the runtime reports that the wake has ended.
- Resolve the gate and await
returned.promise.
- Read the persisted stream again. The latest status for that compaction
generation is still running; no complete or failed checkpoint is saved.
The local regression fails with BACKGROUND_CHECKPOINT_MUST_FINISH, after
confirming summarySettled: true and checkpointStatuses: ["running"].
This uses controlled completion, not a sleep or a stopped runtime process.
In packages/agents-runtime/src/process-wake.ts, the promise callback only
updates the wake-local pendingBackgroundCompaction slot and interrupts an
active idle wait. After an idle timeout with a pending slot, the loop exits and
cleanup closes the writer and sends done. There is no continuation or
cancellation for that slot. A subsequent wake creates a new slot.
The 100 ms idle window makes the test quick. The defaults also allow this
ordering: 20 seconds idle versus a 120 second summary deadline. This does not
mean every background summary fails.
Expected behavior
On a normal idle exit, finish the generation through an owned continuation, or
cancel it and record a terminal status. Either policy is reasonable. A summary
that has finished should not leave an orphaned running checkpoint or perform
work whose result no active wake can use.
Versions
Reproduced in a local TypeScript integration with agents-runtime 0.6.3 based on
91758919586d7c0c70a7b8190a39b6e06fc2ea14. This build has downstream compactionconfiguration changes, but the background
processWakelifecycle is unchanged.I also inspected main at
bb397424db0e1c153dc356713fd3dfd40315470c; the samelifecycle is present there. I have not run the integration against that main SHA.
Bug description
Background compaction can finish successfully after the normal idle timeout
ends its wake, but its checkpoint stays
runningand the summary is neverapplied. The original conversation remains available.
The non-blocking behavior in #4605 is intentional. The problem is the unfinished
checkpoint after the background work has ended, not that a user turn returns
before its summary finishes.
To reproduce without live inference, use a fixture turn whose reported usage
exceeds the background threshold and hold the public
summarizeCompletehookbehind a barrier:
returned.promise.generation is still
running; nocompleteorfailedcheckpoint is saved.The local regression fails with
BACKGROUND_CHECKPOINT_MUST_FINISH, afterconfirming
summarySettled: trueandcheckpointStatuses: ["running"].This uses controlled completion, not a sleep or a stopped runtime process.
In
packages/agents-runtime/src/process-wake.ts, the promise callback onlyupdates the wake-local
pendingBackgroundCompactionslot and interrupts anactive idle wait. After an idle timeout with a pending slot, the loop exits and
cleanup closes the writer and sends done. There is no continuation or
cancellation for that slot. A subsequent wake creates a new slot.
The 100 ms idle window makes the test quick. The defaults also allow this
ordering: 20 seconds idle versus a 120 second summary deadline. This does not
mean every background summary fails.
Expected behavior
On a normal idle exit, finish the generation through an owned continuation, or
cancel it and record a terminal status. Either policy is reasonable. A summary
that has finished should not leave an orphaned
runningcheckpoint or performwork whose result no active wake can use.