Skip to content

perf(agent-manager): reduce registry refresh writes - #161

Merged
codeaholicguy merged 1 commit into
mainfrom
feature-agent-registry-write-optimization
Aug 15, 2026
Merged

perf(agent-manager): reduce registry refresh writes#161
codeaholicguy merged 1 commit into
mainfrom
feature-agent-registry-write-optimization

Conversation

@codeaholicguy

Copy link
Copy Markdown
Owner

Summary

  • skip unchanged AgentRegistry upserts and avoid the batch write transaction when no persisted fields change
  • preserve atomic changed batches, conflict cleanup, updated_at semantics, forced pruning, and SQLite migration compatibility
  • replace per-refresh passive pruning with a first-call-then-30-second cadence
  • key manager overlays by type plus PID and clean cross-type PID reuse conflicts

Pruning contract

AgentManager.listAgents calls pruneIfDue. The first call scans immediately and subsequent calls scan at most once every 30 seconds per registry instance. AgentRegistry.prune remains an immediate forced scan for start and other correctness-sensitive callers. Empty scans do not open delete transactions.

Validation

  • focused AgentRegistry and AgentManager: 67/67 passed
  • full CLI on rebased HEAD: 967/967 passed
  • full agent-manager on rebased HEAD: 509/510 passed; the unrelated ClaudePrintAgent integration fake provider timed out waiting for stdin EOF in this execution environment, while the same full suite passed before the rebase and origin/main changed no agent-manager files
  • agent-manager typecheck passed
  • all 6 projects built successfully
  • all 6 projects linted with 0 errors and 6 pre-existing warnings
  • feature docs lint passed

Overlap and integration order

Land this PR before feature-console-main-thread-responsiveness. Then rebase that branch and preserve this PRs conditional registration and pruneIfDue call while integrating its process-snapshot changes. Expected overlap is limited to AgentManager.ts and AgentManager.test.ts; registry SQL and cadence remain owned here.

Risks

Passive stale rows may remain for at most 30 seconds. Start still forces prune, rename and registration retain targeted liveness/conflict cleanup, and kill continues to operate on live adapter results. Same-type PID reuse remains the existing documented limitation pending reliable process-start metadata.

@codeaholicguy
codeaholicguy merged commit bea4e9d into main Aug 15, 2026
7 checks passed
@codeaholicguy
codeaholicguy deleted the feature-agent-registry-write-optimization branch August 15, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant