You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automations mint a new thread on every fire; the store grows without bound #134
electron/automations.js:108 (runAutomation) calls services.createThread() each time an automation fires. Nothing ever archives or deletes these threads. electron/store.js has caps only for per-thread lists (MAX_MESSAGES_PER_THREAD, store.js:165); there is no cap on the number of threads, messagesByThread keys, or any pruning of old threads anywhere.
Impact
One hourly automation = 24 threads/day, roughly 8,700/year, each with its own transcript. Every debounced save re-stringifies the entire blob, and sidebar/search/summaries scale with total threads. The store file grows monotonically even for a user who deletes nothing, and automation threads are the worst case because the growth needs zero user action. This feeds directly into the store-size pain of #124.
Fix direction
Retention policy for automation threads (keep last N per automation, or auto-archive settled ones).
Fixed on branch coder/automations-mint-a-new-thread-on-every-f-9a04e0 (awaiting the worktree merge).
createThread now takes an optional automationId and stamps it on the thread (electron/services.js). No store migration: migrateThread spreads ...t, and absent = falsy on old rows.
runAutomation tags the thread it mints and, after startRun settles, purges everything past the newest 20 for that automation (MAX_THREADS_PER_AUTOMATION), skipping threads that are working, worktree-backed, or pinned. Skipped threads still occupy a keep slot. purgeThread drops the messagesByThread / workLogByThread / usage entries with the row.
Prune has its own try/catch: a retention failure never stamps lastError or fails the fire.
Tests: 4 new cases in electron/test/automations.test.js (cap holds and keeps the newest, purged transcripts are gone, live/pinned/worktree threads survive, other automations and hand-made threads untouched). npm run test:electron 805/806, npm run test:renderer 716/716, npm run typecheck clean. The single electron failure (wireClient x webBridge over a real socket) fails on main too, unrelated.
Not done, deliberately: no settings knob for the retention number, and no global thread-count cap — the other unbounded minter (orchestrator fork threads) is #213.
Activity
currentbits commentedon Aug 17, 2026
Fixed on branch
coder/automations-mint-a-new-thread-on-every-f-9a04e0(awaiting the worktree merge).createThreadnow takes an optionalautomationIdand stamps it on the thread (electron/services.js). No store migration:migrateThreadspreads...t, and absent = falsy on old rows.runAutomationtags the thread it mints and, afterstartRunsettles, purges everything past the newest 20 for that automation (MAX_THREADS_PER_AUTOMATION), skipping threads that areworking, worktree-backed, or pinned. Skipped threads still occupy a keep slot.purgeThreaddrops themessagesByThread/workLogByThread/ usage entries with the row.lastErroror fails the fire.Tests: 4 new cases in
electron/test/automations.test.js(cap holds and keeps the newest, purged transcripts are gone, live/pinned/worktree threads survive, other automations and hand-made threads untouched).npm run test:electron805/806,npm run test:renderer716/716,npm run typecheckclean. The single electron failure (wireClient x webBridge over a real socket) fails onmaintoo, unrelated.Not done, deliberately: no settings knob for the retention number, and no global thread-count cap — the other unbounded minter (orchestrator fork threads) is #213.
Merge pull request #216 from currentbits/coder/automations-mint-a-new…
fix: retain only the last 20 threads per automation (#134)