fix daemon stale-progress semantics and hydrate replay

This commit is contained in:
thevortex8
2026-03-21 18:41:10 -04:00
parent 1d8a138d0d
commit ff89c85255
5 changed files with 89 additions and 10 deletions
@@ -1588,6 +1588,34 @@ describe("AgentManager", () => {
}
});
test("notifyAgentState does not mutate updatedAt", async () => {
const workdir = mkdtempSync(join(tmpdir(), "agent-manager-test-"));
const storagePath = join(workdir, "agents");
const storage = new AgentStorage(storagePath, logger);
const manager = new AgentManager({
clients: {
codex: new TestAgentClient(),
},
registry: storage,
logger,
idFactory: () => "00000000-0000-4000-8000-000000000121",
});
const snapshot = await manager.createAgent({
provider: "codex",
cwd: workdir,
});
const before = manager.getAgent(snapshot.id);
expect(before).toBeDefined();
manager.notifyAgentState(snapshot.id);
const after = manager.getAgent(snapshot.id);
expect(after).toBeDefined();
expect(after!.updatedAt.getTime()).toBe(before!.updatedAt.getTime());
});
test("recordUserMessage can skip emitting agent_state when run start will emit running", async () => {
const workdir = mkdtempSync(join(tmpdir(), "agent-manager-test-"));
const storagePath = join(workdir, "agents");
@@ -847,7 +847,6 @@ export class AgentManager {
if (!agent || agent.internal) {
return;
}
this.touchUpdatedAt(agent);
this.emitState(agent);
}