fix(security): keep no-session descendants ephemeral - #1251
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6da654721
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
jonaowen
left a comment
There was a problem hiding this comment.
The implementation propagates the parent manager’s persistence mode across all three descendant runtime paths and still initializes explicit depth for in-memory lineage. The regression gates child and grandchild managers plus absence of JSONL in both artifact directories; the documentation carefully limits the claim and discloses remaining temp/global state rather than calling --no-session a sandbox. I found no blocker at exact head e6da654721402f88c35506537f1a1d96ab5f649d.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bd7ce89. Configure here.
|
@Apocrathia ready for review at b9ab6c0. |

Summary
--no-sessionFixes #1120.
Risk
Low to medium. The behavioral change is limited to descendants of explicitly ephemeral sessions. Normal persisted sessions continue to create persisted descendants.
Provenance
Extracted directly onto current
mainfrom #1159. Commits retaincherry picked fromtrailers for4c7cdc4b6f6a7ee96e2307e0a42c3db3fe82a68f,6446bafa5fe57421cc1660ce195fd302d9643a89, andd07e5a80db1ee704d67d029c838264699f6b4793. No MCP/provider changes are included.Validation
npm run checknpm run test -- test/agent-session-recursion.test.ts— 97 passednpm run test -- test/suite/agent-session-runtime.test.ts— 24 passednpm run test -- test/daemon-mode.test.ts— 191 passeddocs.jsongit diff --check origin/main...HEADIndependent review found and fixed descendant depth initialization across inline, hosted-runtime, and daemon paths; the added assertions cover child/grandchild depth while confirming no session file is created.
Review focus
Please verify the ephemeral-session inheritance across inline, runtime, and daemon paths, and that the documentation accurately distinguishes application behavior from OS-level isolation.
Note
Keep RLM descendant sessions ephemeral when parent runs with
--no-session--no-session; this fix propagates non-persistence down to all descendants.SessionManagergainsallowsPersistence()(replacingisPersisted()), an in-memory open path (openInMemoryAsync), andwriteCheckpointFile()to snapshot state without changing persistence policy.allowsPersistence()and create an in-memorySessionManagerwhen the parent is non-persisted.persistence: "memory"marker so they can be transferred and restored without ever writing a permanent session file.--no-sessionsuppresses transcript/artifact persistence but is not a security sandbox.Changes since #1251 opened
SessionManager.writeCheckpointFileto write the manager's currentsessionIdin the checkpoint JSONL header instead of the generated file-targetsessionId, and addedAgentDaemon.removeMemoryRestartCheckpointsprivate helper that removes session files for sessions withpersistenceset tomemoryby iterating over sessions in aDaemonUpdateRestartManifestand callingrmSyncwithforce: true[e55871f]AgentDaemon.cancelPreparedUpdateRestartto invokeremoveMemoryRestartCheckpointson the transaction manifest before clearingupdateRestartand restoring deferred client environments when cancelling a prepared update-restart outside of the publishing phase [e55871f]4257-update-restart-resume.testto callbeginUpdateRestartTransactionandrunUpdateRestartPreparationinstead ofprepareUpdateRestart, assert that checkpoint headeridequals the session'sid, and verify thatcancelPreparedUpdateRestartremoves the memory checkpoint file [e55871f]Macroscope summarized bd7ce89.
Note
Medium Risk
Behavior changes for
--no-sessionand daemon update-restart paths; mistaken persistence inheritance could still leak transcripts, but scope is limited to explicitly ephemeral roots and is covered by new tests.Overview
Fixes a gap where RLM child/grandchild runs could still write session JSONL and artifacts even when the root was started with
--no-session. Inline, runtime-hosted, and daemon subagent creation now follow the parent’sallowsPersistence()(replacingisPersisted()) and use in-memorySessionManagerinstances when the ancestor is non-persisted.SessionManagergainsopenInMemoryAsync,writeCheckpointFile()for one-off snapshots without flipping persistence, and constructor support for preloaded in-memory entries. Daemon update-restart writes temporary checkpoints for busy in-memory sessions, tags them withpersistence: "memory", restores vianoSession, and deletes those files on restore or cancel so ephemeral runs are not permanently materialized.Docs and CLI help clarify that
--no-sessiononly skips root/RLM transcript and artifact persistence (not a sandbox), and addsecurity.mdwith unattended-run isolation guidance; autonomous budgets/gates are called out as execution controls, not security boundaries.Reviewed by Cursor Bugbot for commit b9ab6c0. Bugbot is set up for automated code reviews on this repo. Configure here.