Skip to content

feat(daemon): reconstruct managed session catalog - #1261

Open
sethkarten wants to merge 27 commits into
core02-host-request-dispatcherfrom
core03-managed-session-catalog
Open

feat(daemon): reconstruct managed session catalog#1261
sethkarten wants to merge 27 commits into
core02-host-request-dispatcherfrom
core03-managed-session-catalog

Conversation

@sethkarten

@sethkarten sethkarten commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reconstruct immutable managed-session family catalog authorization across resident, saved, passive, and remote sessions
  • thread one duplicate-fail-closed topology snapshot through message, observe, hydration, and supervisor delivery
  • preserve passive lifecycle surfaces and closing-session fences while rejecting incompatible persisted/live or malformed remote topology

Stack

Validation

  • Focused configured catalog suite: 228/228
  • Post-commit exact configured suite: 228/228
  • Nonwriting Biome on six paths: pass
  • Root tsgo --noEmit: pass
  • git diff-check / clean hygiene: pass

Exclusions

  • no MCP/project settings, kernel host-request, launchEnv/lifecycle recovery, probe, or saved-sibling follow-up

Note

High Risk
Changes authorization for agent-to-agent messaging, observation, and session topology across daemon and supervisor; incorrect catalog merge or trusted-read bugs could deny service or mis-scope reach.

Overview
Replaces ad-hoc sibling/registry lookups with listCatalogFamilySessions, which walks RLM registries under descriptor-anchored (O_NOFOLLOW) managed roots, reads session bytes via a trusted openat helper (no pathname reopen), and fails closed on cycles, symlink/path tricks, registry limits, and header/registry mismatches. Catalog RPC gains family; siblings and name checks take sessionDir.

Daemon and supervisor build one frozen agentFamilyCatalogEntries / familyCatalogEntries snapshot from persisted, artifact, passive, resident, and remote rows (merge only when topology claims agree; duplicates/conflicts deny ACLs). Agent-origin send, observe, roster, and cross-worker wake/delivery use that snapshot end-to-end—including post-wake session-id checks so hydration cannot substitute a different target.

agent-messages tightens nuclear-family logic: siblings need a single catalog-resolved parent, parent edges reject contradictory id+path claims, and passive rows can reserve names via direct parent claims without widening reach. readSessionInfoFromBuffer parses metadata from already-trusted bytes.

Protocol schema revision 17 adds optional sessionDir on detached rename_saved_session so inactive renames use the correct catalog authority.

Reviewed by Cursor Bugbot for commit 3bc6523. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Reconstruct managed session catalog with TOCTOU-safe family traversal and snapshot-based ACL enforcement

  • Introduces listCatalogFamilySessions in daemon-catalog-process.ts, which traverses the full session artifact tree using descriptor-bound (O_NOFOLLOW) opens and a Python openat sidecar to prevent symlink/rename races during reads.
  • Authorization decisions in daemon-mode.ts and daemon-supervisor.ts now operate on a single immutable catalog snapshot captured before any hydration or delivery, preventing TOCTOU drift between topology checks and action.
  • Catalog entries are merged from persisted headers, artifact-resident registries, and live runtime state; conflicting claims across sources cause authorization to fail closed rather than being silently coerced.
  • sessionDir is threaded through rename, sibling lookup, name-availability, and worker-creation flows so that catalog authority is always scoped to the correct root.
  • Daemon schema advances to revision 17; rename_saved_session now requires protocol ≥7 and schema ≥17 and accepts an optional sessionDir field.
  • Risk: any saved session with mismatched, ambiguous, or externally-pathed topology headers will be rejected by the new traversal, which fails closed rather than degrading gracefully.

Macroscope summarized 3bc6523.

Comment thread packages/coding-agent/src/modes/daemon/daemon-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/daemon/daemon-supervisor.ts Outdated
@sethkarten
sethkarten force-pushed the core03-managed-session-catalog branch from 4e1b046 to 4f87ab5 Compare August 12, 2026 18:34
Comment thread packages/coding-agent/src/modes/daemon/daemon-supervisor.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d685ec4. Configure here.

Comment thread packages/coding-agent/src/modes/daemon/daemon-catalog-process.ts Outdated
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