Skip to content

feat: add BeadsDB mesh queue backend#6

Merged
vilmire merged 2 commits into
mainfrom
feat/beads-queue-backend
May 25, 2026
Merged

feat: add BeadsDB mesh queue backend#6
vilmire merged 2 commits into
mainfrom
feat/beads-queue-backend

Conversation

@vilmire

@vilmire vilmire commented May 25, 2026

Copy link
Copy Markdown
Owner

Reworks the PR #5 BeadsDB idea as a focused mesh queue storage feature.\n\nChanges:\n- add a better-sqlite3-backed BeadsDB store for mesh queue rows\n- keep the existing mesh-work-queue public API intact\n- migrate existing .queue.json files on first read\n- use immediate SQLite write transactions for queue mutations\n- update mesh queue tests to avoid JSON-file coupling\n\nIntentionally not included here:\n- GasTown/Refinery automatic requeue policy; that should be a separate queue policy feature.\n\nVerified:\n- npm run typecheck -w packages/daemon-core\n- npm run test -w packages/daemon-core -- mesh-work-queue.test.ts mesh-events.test.ts\n- npm run build -w packages/session-host-core\n- npm run test -w packages/daemon-core

@vilmire vilmire merged commit 51a76b6 into main May 25, 2026
3 checks passed
vilmire added a commit that referenced this pull request Jun 1, 2026
…s file, pending guard, cooldown sweep

appendRemoteLedgerEntries (#1):
- dedup now uses tail:1000 instead of full O(n) readLedgerEntries;
  P2P replication is cursor-based so duplicates appear in the recent tail

Archive rotation (#4):
- compactLedger now rotates .archive.jsonl to .archive.N.jsonl (max 5)
  when the archive exceeds 50MB before appending new entries

Worker JSON extraction validation (#5):
- extractJsonObjectFromSummary now requires at least one mesh worker result
  field (changedFiles|errors|gitStatus|nextAction|validationResults) before
  accepting a JSON block; prevents false positives from tool/log JSON in
  the final summary

Archived counts file (#6):
- compactLedger writes cumulative counts to <meshId>.archived-counts.json
- getLedgerSummary reads and merges archived counts so taskCompleted/Failed/
  Stalled and totalEntries are accurate even after compaction

Pending events size guard (#2):
- queuePendingMeshCoordinatorEvent trims the pending-events.jsonl to the
  last 50 events when it exceeds 100KB before appending; prevents unbounded
  growth when coordinator stops draining

autoLaunchCooldownUntil cleanup (#3):
- sweepExpiredCooldowns() removes expired entries from the cooldown Map
  whenever a new cooldown is set; inline check at read site also cleans up
  the checked key; prevents long-lived daemon Map accumulation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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