Fix agent close persistence, whitespace diff filtering, and diff param cleanup

- Persist snapshot before emitting closed agent to avoid data loss
- Flush after branch rename so state hits disk immediately
- Filter phantom whitespace-only files from ignore-whitespace diffs
- Only include ignoreWhitespace param when true to keep payloads clean
- Add createFeature test helper for AgentFeature construction
This commit is contained in:
Mohamed Boudra
2026-04-10 09:50:46 +07:00
parent e6dec3fc1a
commit 4215120d7c
5 changed files with 34 additions and 7 deletions
@@ -725,7 +725,8 @@ export class AgentManager {
const closedAgent = this.prepareAgentForClosure(agent, "agent closed");
await agent.session.close();
this.timelineStore.delete(agentId);
this.emitClosedAgent(closedAgent);
await this.persistSnapshot(closedAgent);
this.emitClosedAgent(closedAgent, { persist: false });
this.logger.trace({ agentId }, "closeAgent: completed");
}
@@ -1944,8 +1945,8 @@ export class AgentManager {
};
}
private emitClosedAgent(agent: ManagedAgentClosed): void {
this.emitState(agent);
private emitClosedAgent(agent: ManagedAgentClosed, options?: { persist?: boolean }): void {
this.emitState(agent, options);
}
private subscribeToSession(agent: ActiveManagedAgent): void {
if (agent.unsubscribeSession) {