refactor(daemon): consolidate rlm subagent metadata onto the spawn ledger - #1390
Merged
Conversation
snimu
force-pushed
the
feat/rlm-ledger-consolidation
branch
from
August 14, 2026 15:55
5f1ad74 to
6f3b2f7
Compare
snimu
force-pushed
the
feat/rlm-ledger-consolidation
branch
2 times, most recently
from
August 14, 2026 16:17
7b8dcc5 to
769ec5d
Compare
sethkarten
self-requested a review
August 14, 2026 18:38
sethkarten
previously approved these changes
Aug 14, 2026
stack merge was automatically disabled
August 14, 2026 19:02
Pull Request is not mergeable
stack merge was automatically disabled
August 14, 2026 19:08
Pull Request is not mergeable
stack merge was automatically disabled
August 14, 2026 21:02
Pull Request is not mergeable
sethkarten
force-pushed
the
feat/rlm-ledger-consolidation
branch
from
August 14, 2026 21:03
769ec5d to
ee8d43f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ee8d43f. Configure here.
xeophon
self-requested a review
August 16, 2026 09:57
xeophon
approved these changes
Aug 16, 2026
xsyetopz
pushed a commit
to xsyetopz/prime-agent-next
that referenced
this pull request
Aug 16, 2026
…dger (PrimeIntellect-ai#1390) * feat(daemon): add per-child rlm subagent display files * feat(daemon): serve passive rlm subagents from the ledger and stop writing registries * refactor(daemon): drop the unconsumed catalog siblings walk * test(daemon): cover display files and legacy registry metadata fallback * refactor(daemon): share rlm subagent metadata field spreading * refactor(daemon): derive the legacy registry entry type from the passive entry * fix(daemon): resolve deleted-child paths for job cleanup and harden display writes * fix(daemon): fail admission on lost spawn records and never clobber-publish seeds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What this is
PR 2 of the spawn-ledger stack (base: #1387). With the ledger as the topology authority, the per-parent
rlm-subagents.jsonlregistries stop being written entirely. Hydration metadata (prompt, spawn code, model, names, status) moves to one small JSON display file per child, and every registry consumer now answers topology questions from the ledger and metadata questions from the display file — with a read-only legacy fallback so existing profiles keep working.What changes
rlm-subagent-display.ts(88 lines): onerlm-subagent.jsonper child in the artifact dir the child already owns (session-artifacts/<parentId>/<childId>/). Atomic temp+rename writes (0600), tolerant reads (missing/malformed → undefined, unknown fields kept for forward compat). Deliberately contains no topology fields — parent, depth, and current name always come from the ledger; the display file is hydration metadata only. Written at the same three moments the registry used to be: spawn admission, completion, deletion.sub-*ids, absent depths, malformed lines skipped) serving two purposes: the ledger seed source from PR 1, and metadata fallback for children spawned before this PR.siblingscommand, its client method, and the registry-walkinglistSavedSessionSiblings(unconsumed since feat(daemon): supervisor-owned rlm spawn ledger as family authority #1387 moved the supervisor to ledger-backed siblings), plus all registry-write plumbing.Compatibility
Numbers
Net src +125 lines (new display module +88, daemon-mode +105 net for the fallback chain and hardened deletion, catalog process −68). The registry merge semantics — last-writer-wins reconstruction at every read — are gone; metadata now has one source order. The large deletion (the catalog family walk and its helper) belongs to the v0.8 stack rebase, not this PR.
Testing
Targeted daemon suites: 458 passed / 8 skipped (env-stripped),
npm run checkclean, reviewed twice (all findings addressed or explicitly accepted as nits: display-file trust is display-grade only;createdAtepoch default for metadata-less children; the tombstone→ledger crash window keeps its retry self-heal from #1387). The full suite has the same ~93 pre-existing env-dependent failures as the merge base.Known follow-ups deliberately not in this PR: surfacing the ledger spawn timestamp for metadata-less children's
createdAt, and tightening the legacy entry type to mark unvalidated fields as optional.Note
High Risk
Changes core daemon session topology, admission, and deletion durability with migration/rollback edge cases; incorrect ordering or ledger failures could leave ghost or unreachable subagents.
Overview
RLM subagent persistence is split: the spawn ledger owns topology only; new per-child
rlm-subagent.jsondisplay files hold hydration metadata (prompt, model, status, etc.) with atomic writes. Per-parentrlm-subagents.jsonlis no longer written—only read for pre-ledger fallback and seeding.The daemon rewrites passive listing, spawn/completion recording, hydration, and deletion to walk ledger edges and resolve metadata via display file → legacy registry → defaults. Spawn admission now awaits a durable ledger append and fails closed (closes the runtime and removes a stray display file) if the append fails. Deletion writes a display tombstone first, then requires a successful ledger delete; tombstoned edges still resolve paths for job cleanup and legacy-only children.
Removes the catalog
siblingscommand, client API, andlistSavedSessionSiblings. Ledger seed publish drops the rename fallback when hard links are unavailable (skips seeding instead of risking clobber).RlmSpawnLedger.edges()can include deleted tombstones for retries.Reviewed by Cursor Bugbot for commit b74f6e4. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Consolidate RLM subagent metadata onto a durable spawn ledger
rlm-subagents.jsonlregistries as the source of truth.listPassiveRlmSubagents,recordRlmSubagentState, andrecordRlmSubagentDeletionin daemon-mode.ts to derive topology from the ledger and metadata from display files, with legacy registry as a read-only fallback for pre-ledger children.catalog.siblings()to ledger-backedrlmLedgerSiblings(); removes thesiblingscommand from the catalog process entirely.rlmSpawnLedger.flush()before returning the runtime; deletion durability order is display tombstone then ledger tombstone with an explicit reason (userorrevoked).Changes since #1390 opened
RlmSpawnLedger.publishSeedFileto skip seeding entirely when hard links are unavailable instead of falling back to non-atomic rename [b74f6e4]📊 Macroscope summarized ee8d43f. 4 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.