mirror of
https://github.com/openai/codex.git
synced 2026-11-13 06:45:07 +00:00
Wait for memory consolidation shutdown before finishing jobs (#36140)
## Why A phase-two memory job could release its lease while its consolidation agent was still shutting down, allowing another worker to race the existing agent. ## What changed - Await consolidation-agent shutdown before validating artifacts and completing the job. - Keep the lease until it expires if shutdown fails, and remove the agent from the thread manager only after shutdown succeeds. ## Testing Update startup tests to wait for the phase-two job lifecycle to finish and verify that the consolidation thread has been removed. GitOrigin-RevId: 7ac3a7369529822ac95fd2ee9dcb27d39c191d20
This commit is contained in:
1 parent
9588f660be
commit
5ad367fb95
3 files changed
+41
-38
No files matched your search
@@ -361,18 +361,14 @@ impl MemoryStartupContext {
|
||||
agent: SpawnedConsolidationAgent,
|
||||
) -> anyhow::Result<()> {
|
||||
let SpawnedConsolidationAgent { thread_id, thread } = agent;
|
||||
let thread = self
|
||||
.thread_manager
|
||||
.remove_thread(&thread_id)
|
||||
.await
|
||||
.unwrap_or(thread);
|
||||
|
||||
tokio::time::timeout(Duration::from_secs(10), thread.shutdown_and_wait())
|
||||
.await
|
||||
.map_err(|_| {
|
||||
anyhow::anyhow!("memory consolidation agent {thread_id} shutdown timed out")
|
||||
})??;
|
||||
|
||||
self.thread_manager.remove_thread(&thread_id).await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user