Skip to content

feat(ledger): record the creating session on session/opened - #11472

Merged
bolichen97 merged 1 commit into
mainfrom
feat/ledger-session-parent
Sep 18, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/ledger-session-parent

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

The append-only session ledger (the "crew log") records what a session did, but not who made it. A worker session that a conductor opened through session_create writes a session/opened entry identical to a tab a person opened by hand. Nothing in any ledger says "this session exists because that session asked for it", so no tree of sessions can be folded from the log. The only record of that edge today is _created_by on the in-memory slot and the transcript's metadata line, neither of which is the ledger.

Why it matters

Session control now lets one session create and drive others, and crew mode will lean on that. A conductor's fan-out is invisible in the record that is supposed to be the source of truth: a reader cannot answer "which sessions did this one spawn" from the ledgers, the System page cannot be made a projection of the log, and a session tree would have to be assembled from a second, in-memory source that is gone after a restart.

What changed (motivation → approach → change)

A reader can now tell from the ledgers alone which session opened which. A created session names its creator in its own session/opened entry.

Before After
session/opened.data on a session_create child agent, slot, model, cwd, owner, resumed same, plus parent {slot, sid?}
a person's own tab, a fork no lineage no parent key at all
registry (crew_log/entry_types.py) parent undeclared, so a caller could not write it parent.slot required, parent.sid optional, other members refused

The edge is written on the child, because the child is the one side that holds both halves. session_create (dashboard/session_control.py) stamps three facts on the new slot at mint, before any turn: the creator's key (_created_by), the creator's ACP session id read off the live caller handle (_created_by_sid), and an in-memory witness that this gateway process did the stamping (_lineage_minted). At the child's first turn the chat runner (dashboard/chat_runner.py, _ledger_lineage) passes the two ids to the emitter's on_session_opened (crew_log/emit.py) as parent_slot / parent_sid only when the witness is set; nothing is looked up live. The sid and the witness are never written to the transcript: that file is editable by an agent's file tools, and the crew log is fenced from those tools precisely so nothing in it can be forged as gateway-authored, so created_by read back from transcript metadata after a restart still serves the ownership boundary but is never promoted to lineage (dashboard/chat_persistence.py). A child whose gateway restarted between mint and its first turn writes no parent. The creator can never write this edge itself: the child's ACP session id -- the log's unit id -- does not exist yet when session_create runs, which is the same blocker the emitter spec already records for subagent/*.

The sid is frozen at mint rather than read at the child's first turn because a creator slot can be closed and replaced in between; a live read would cite the replacement's ledger in an entry that is never rewritten. The id is backend-authored, so it is bounded where it is retained: MAX_ACP_SESSION_ID_LEN (kiro_crew/validation.py, a leaf both the ACP layer and application code may import without crossing the agent-SDK boundary) is the one constant for every store of a backend session id -- the native-child rosters in acp/runtime.py and acp/session_handle.py now name it instead of literals -- and an id past it is dropped at mint, never truncated; the sid is optional, so absent is a legal record.

flowchart LR
  subgraph before [Before]
    P0["creator ledger"]:::ctx
    C0["child ledger<br/>session/opened"]:::ctx
  end
  subgraph after [After]
    P1["creator ledger<br/>(sid)"]:::ctx
    C1["child ledger<br/>session/opened<br/>parent {slot, sid}"]:::added
    C1 - "slot, sid" --> P1
  end
  classDef added fill:#DCFCE7,stroke:#16A34A
  classDef changed fill:#FEF3C7,stroke:#D97706
  classDef removed fill:#FEE2E2,stroke:#DC2626,stroke-dasharray:4 3
  classDef ctx fill:#E0F2FE,stroke:#0284C7
  linkStyle 0 stroke:#16A34A,stroke-width:2px
Loading

Legend: green = added after this PR, blue = unchanged, shown for context.

The child's entry now points at the session that made it, with the id the creator had at mint; the creator's file is untouched.

sid is a citation, not the tree key. A slot outlives its ACP session, so the creator's id names the unit that was live when the child was made; a fold that builds the tree keys it by slot. sid is omitted rather than written empty when the creator had no live handle at mint, and the whole parent object is omitted when nobody created the session, so a reader can tell "no creator" from "creator unknown". The three specs (crew-log-core.md, crew-log-emitter.md, session-control.md) state the field, the side it is written from, and why.

No projection or UI is built here: the System page tree is the next PR, folded from this field.

Tests

  • test/test_crew_log_types.py: the canonical session/opened example carries parent, so the registry suite checks its nested shape; two refusal cases lock in parent without slot (data.parent.slot) and an undeclared member (data.parent.creator).
  • test/test_crew_log_emit.py: five tests -- a created session records {slot, sid}; a creator with no sid is recorded by slot alone; a session nobody created has no parent key; a sid with no slot names no creator; a re-attach (resumed=True) writes the creator again.
  • test/test_session_control.py: create_session freezes the caller's ACP session id on the child and sets the mint witness, and the birth metadata carries created_by but never the sid; the frozen value does not follow a replaced creator handle (the mutation guard for the live-read defect); an id past MAX_ACP_SESSION_ID_LEN is dropped at mint; a slot nobody minted in this process has no witness; and _ledger_lineage yields the creator only for a witnessed mint -- restored or hand-set attribution yields nothing, a witnessed mint without a handle yields the slot alone.
  • test/test_member_session_control.py: the recent-session restore path restores created_by but ignores a created_by_sid found in the metadata line and leaves the witness unset; a save -> rehydrate round trip through the real serializer writes created_by and never the sid or the witness.

Manual verification

N/A - unit coverage sufficient. The runtime change is one call site passing two slot attributes through; state.get_slot returns None for an absent creator and session_id_of returns "" for a missing handle, both of which the emitter tests cover as the no-sid and no-parent branches.

Related Issues

Part of #11484, which tracks the reader of this field: the session-tree projection and the System page Sessions tab. This PR closes nothing on merge.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@chenmingwei23
chenmingwei23 requested review from a team and dwu96 September 17, 2026 06:18
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Intent: Make the append-only session ledger carry the one lineage fact it can carry today: a session that another session created through session_create names its creator on its own session/opened entry (parent {slot, sid?}), so a tree of sessions can later be folded from the log instead of from in-memory state.
Not a goal: No tree projection, no System page change, no lineage for spawn_run subagents or forks, no crew-ledger writer. Each of those is a follow-up on top of this field.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 17, 2026
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of 8328ed98d7c5fa07bcc7553fb7fcfd104f67523f — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

A resumed-after-restart child appends a second session/opened without parent, and the spec's "reads one session/opened per crew log" doesn't say which one wins.

Watch

The re-attach path re-announces the header (test_the_creator_is_written_again_on_a_re_attach), but _lineage_minted dies with the process, so a child resumed after a gateway restart appends session/opened {resumed: true} with no parent — the same ledger then carries one entry with the edge and a later one without it. crew-log-core.md's fold contract ("keys it by slot and reads one session/opened per crew log") reads naturally as "the latest", which silently drops the edge for exactly the sessions that survive a restart — the durability the ledger exists to provide. State in the spec that an absent parent on a resumed entry means "unknown, not overwritten" and that the fold takes any entry carrying parent.
Clears when: crew-log-core.md (or the emitter spec) names which session/opened the fold reads when entries disagree on parent, or the #11484 projection lands with that rule pinned by a test.

[DESIGN-REVIEWED] 8328ed9

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 8328ed98d7c5fa07bcc7553fb7fcfd104f67523f — this comment is updated in place on each push.

Review details

Based on my validation, the discovery pass correctly found no grounded candidates. I independently verified the paths where a defect would live:

  • session_id_of (emit.py:695) always returns str (never None), so len(_creator_sid) at session_control.py:1297 cannot crash.
  • live_caller is guaranteed non-None — the re-gate at session_control.py:1192–1194 raises otherwise before the sid read.
  • Oversize sid is dropped (… if len ≤ MAX_ACP_SESSION_ID_LEN else ""), not truncated; _created_by_sid/_lineage_minted are in __slots__ and initialized in __init__, and _ledger_lineage uses getattr defaults.
  • Restore paths (_rehydrate_slot_from_history, _apply_recent_session) restore only _created_by, never the sid or _lineage_minted, so metadata cannot forge gateway-authored lineage; the emitter/_ledger_lineage gate on that witness.
  • The emitter builds parent only inside if parent_slot: and sid only inside if parent_sid:, matching the entry-type validation (slot required, sid optional, unknown keys rejected per test).
  • The 128 → MAX_ACP_SESSION_ID_LEN swaps in runtime.py/session_handle.py are value-preserving.

I could not ground any behavioural defect or rule violation, and I found nothing new to add in Step 2.

No findings.

[OPUS-REVIEWED] 8328ed9

Verdict parsed from the review's SHA-scoped output markers for commit 8328ed98d7c5fa07bcc7553fb7fcfd104f67523f.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 8328ed98d7c5fa07bcc7553fb7fcfd104f67523f: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 8328ed98d7c5fa07bcc7553fb7fcfd104f67523f — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

The parent shape freezes into an append-only log before its only reader (#11484) has consumed it once — verify the fold's design agrees before merge.

What this change ships

Inventory (8 items) — 8 justified

Intent: Record in each session's append-only crew log which session created it, so the session tree can be read from the logs alone after a restart — ADDITION.

  1. A session made by session_create now names its creator (parent {slot, sid?}) in its own session/opened ledger entry — justified
  2. The ledger registry accepts parent, slot required, sid optional, any other member refused — justified
  3. The creator's ACP session id is frozen onto the child at mint, never re-read live — justified
  4. Lineage is written only from a mint this gateway process witnessed; a restart before the child's first turn loses the link — justified
  5. The frozen sid and the witness are never written to the agent-editable transcript — justified
  6. A resumed session re-records its creator on the re-attach entry — justified
  7. New shared constant MAX_ACP_SESSION_ID_LEN (3 counted consumers: session_control.py, acp/runtime.py, acp/session_handle.py) replaces two literal 128 bounds; an oversize creator id is dropped at mint — justified
  8. Three system specs updated in the same commit, per the AGENTS.md invariant — justified

The field has zero readers today by declaration; the reader is tracked in linked issue #11484, and delaying the writer would leave a permanent, unbackfillable hole in every ledger written meanwhile — derived, not speculative. The transcript/_created_by store is not a duplicate: it is agent-editable, which is the named boundary this fenced record exists to escape. The unfixed subagent/* lineage sibling is documented as blocked in crew-log-emitter.md.

[FIRST-PRINCIPLES-REVIEWED] 8328ed9

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 17, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

CI note (not a finding on this diff): the two red backend shards, Backend Tests (3.12, 2) and Backend Tests (Windows) (3), fail on the same two tests, test/test_fargate_launch_engine.py::test_engine_satisfies_the_launch_engine_protocol and ::test_signin_handle_has_every_signin_handle_protocol_member (FargateLaunchEngine.begin_signin lacks the login_target keyword the LaunchEngine protocol grew). Both fail identically on main at the merge-base; this PR touches neither file. Coverage Gate fails closed on the shard failure. Fixes are open as #11422 / #11426 / #11432 / #11442; this branch will be rebased once one lands, which re-runs CI.

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 8328ed98d7c5fa07bcc7553fb7fcfd104f67523f and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 8328ed9

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 8328ed98d7c5fa07bcc7553fb7fcfd104f67523f: <one-sentence reason>

@chenmingwei23
chenmingwei23 force-pushed the feat/ledger-session-parent branch from 6d3707d to 545405e Compare September 17, 2026 07:19
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 17, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • Item 1 - zero consumers (span=ac6961f64e8c): accepted-and-deferred

The reader is the session-tree projection tracked in #11484 (label deferred-finding, assignee chenmingwei23, Due 2026-10-01): fold header + session/opened of each session ledger, keyed by slot, served on /api/sessions/memory for the System page.
Capture precedes the reader on purpose: an append-only log cannot backfill a lineage fact that was not recorded, so the field ships first and the projection is the next PR against it.
The shape being locked in (slot as tree key, sid as citation of the creator ledger) is the one the projection in #11484 consumes; the issue names it so the two cannot drift.

@chenmingwei23
chenmingwei23 force-pushed the feat/ledger-session-parent branch from 545405e to 3d71406 Compare September 17, 2026 07:53
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 17, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/ledger-session-parent branch from 3d71406 to 0d0bcdc Compare September 17, 2026 08:07
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: creator ACP session id frozen on the child slot at mint (_created_by_sid), persisted in birth metadata beside created_by

  • A replacement session is recorded as the creator (span=db37e66c9e96): fixed in 0d0bcdc

The creator sid is no longer read live at the child first turn. session_create stamps slot._created_by_sid from the live caller handle at mint (session_control.py), the value rides the birth metadata and is persisted/rehydrated beside created_by (session_control.py, chat_persistence.py), and chat_runner.py passes that frozen value as parent_sid.
Regression: test_session_control.py::test_the_creator_session_id_is_frozen_at_mint_not_read_live replaces the creator handle after mint and asserts the child still carries the mint-time id, on the slot and in its birth metadata; test_member_session_control.py covers the restore path.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 17, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/ledger-session-parent branch from 0d0bcdc to 354b402 Compare September 17, 2026 08:22
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 18, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Two more shards went red after the comment above, and both are also main-side.

Backend Tests (Windows) (1) -- #11635, main-side. All 10 tests in
test/test_acp_launch_goldens.py, each with
TypeError: _stub_common.<locals>.<lambda>() got an unexpected keyword argument 'forward_ssh_auth_sock'.
It reproduces on pristine origin/main at 0d6675c4ec as 10 failed, 19 passed. First bad merge is
727503fdfb (#9131): acp/client.py began passing the keyword, and the capture harness's stub lambda
in test/acp_launch_capture.py was never given it. Passes at that commit's parent.

Backend Tests (3.12, 5) -- flake, no issue.
test_pid_lifecycle.py::TestSyncKillProviderTree::test_reaped_leader_does_not_suppress_the_group_signal,
one test, assert <Signals.SIGKILL: 9> in [<Signals.SIGTERM: 15>]. The whole
TestSyncKillProviderTree class passes on pristine main here, and this family was fixed on main by
#11491, so a single occurrence is a flake rather than a return of it. Worth a re-run, not an issue.

That accounts for all five test reds: #11634 on two shards, #11635 on one, #10964 on one, and one
flake. None of them is this branch's, and none is reproducible only with this branch applied.

@chenmingwei23
chenmingwei23 force-pushed the feat/ledger-session-parent branch from e7784f3 to e6585e0 Compare September 18, 2026 01:38
@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • Agent-writable metadata can forge gateway lineage (span=db37e66c9e96): fixed

Real, and the fence's own rationale says why (security/paths.py: the crew log is fenced from agent file tools so nothing in it can be forged as gateway-authored; the transcript beside it is not fenced). Fix in e6585e0: lineage is written only from a mint THIS gateway process witnessed. session_create sets an in-memory _lineage_minted beside the frozen sid (state.py, session_control.py); the sid is no longer written to birth metadata or the transcript and no longer restored on either path (chat_persistence.py, four sites removed, MAX_ACP_SESSION_ID_LEN import dropped there); chat_runner.py reads the pair through a new pure seam _ledger_lineage(slot) that yields nothing without the witness, so created_by restored from metadata still serves the ownership boundary but is never promoted to session/opened.parent. Cost, stated in the specs and body: a child whose gateway restarted between mint and its first turn writes no parent.
Tests: _ledger_lineage pinned for a witnessed mint, a restored/hand-set slot (yields nothing) and a witnessed mint without a handle; the mint test asserts the metadata carries created_by but never the sid; both restore paths assert a persisted created_by_sid is ignored and the witness stays unset; the restore-clamp test is removed with the restore path it tested. 582 pass locally; black/flake8/mypy/docs-lint/boundary gate clean.
Retrospective update (rounds 0-4 verdicts, issuecomment-5721674342): the round-3 mechanism "re-clamp on both restore paths" is now SUBTRACTED -- the restore path is gone -- and the round-0 persistence half of "sid frozen at mint" with it; the bound remains at mint only. Made directly because the review delegate path is unavailable in this session.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 18, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • Watch - which session/opened carries parent once a restart drops the witness (span=57e1dd88753a): accepted-and-deferred

Correct observation: a slot's logs hold one session/opened per create and per re-attach, and a re-attach after a gateway restart carries no parent because the mint witness is process-local (the fix for GPT span db37e66c9e96 on the previous head). The extraction rule is now pinned where the reader will be built: #11484's deliverable list carries it verbatim -- the fold takes parent from ANY session/opened of the slot that carries one, across every crew log the slot wrote; entries in one slot cannot disagree (one creator, stamped once at mint) and an entry without parent never retracts it -- together with the test shape (create -> re-attach -> restart -> re-attach folds to the same parent). That is the second clearing condition the item names.
Not pushed into this PR's spec text now because the rule is a reader-side contract and this PR ships no reader; landing it with the reader keeps rule and test in one change, and avoids re-rolling every lane on a doc-only push.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

CI note (head e6585e0): Backend Tests (Windows) (2) is red on one test this PR does not touch, inherited from main.

test/test_backend_cards.py::test_every_capability_set_is_classified_by_the_card -- these capability sets are not classified in agent_sdk/backend_cards.py: ['ACP_BACKENDS_SELF_SERVED_ACP']. It fails the same way on a clean detached checkout of origin/main (0d6675c) with nothing from this branch applied: #11431 (capability cards) and #11428 (self-served harness launch record) landed on main without the classification. The fix is #11632 (fix(agent_sdk): classify ACP_BACKENDS_SELF_SERVED_ACP as off-card); this branch will be rebased once it lands.

The earlier six test_session_control / test_member_session_control reds are gone since the rebase onto #11593.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

CI note (head e6585e0): Backend Tests (Windows) (1) is red on test/test_acp_launch_goldens.py (10 node ids, all TypeError: _stub_common.<locals>.<lambda>() got an unexpected keyword argument 'forward_ssh_auth_sock'), inherited from main.

The same 10 fail on a clean detached checkout of origin/main (e054b09): #8104 added the forward_ssh_auth_sock launch argument and the goldens' stub lambda was not widened. The fix is #11649 (fix(test): derive the launch-capture stubs from what they stub). This PR touches neither file.

#11632 has landed, so the test_backend_cards red noted above clears on the next rebase; that rebase waits for the in-flight GPT lane on this head so any finding rides the same push.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 18, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/ledger-session-parent branch from e6585e0 to f3549e6 Compare September 18, 2026 02:44
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 18, 2026
A session another session made through session_create writes parent {slot, sid?} on its session/opened entry: the creator's key from the slot's _created_by and the creator's live ACP session id read at the child's first turn. Recorded on the child because that is the one side that knows both halves; absent on a person's own tab, a fork and a spawn_run subagent, so a fold can tell no creator from creator unknown. The field is declared in the entry-type registry in the same change (parent.slot required, parent.sid optional, undeclared members refused).
@chenmingwei23
chenmingwei23 force-pushed the feat/ledger-session-parent branch from f3549e6 to 8328ed9 Compare September 18, 2026 02:56
@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • Stale phrase in the bound's comment (span=ad587cbf686c): fixed

Correct: after the lineage fix the creator id never reaches birth metadata, so "and its birth metadata" in validation.py's comment described a store that no longer exists. Head 8328ed9 rewords it: the constant bounds the native-child rosters and the in-memory frozen creator id, which is the only path to parent.sid. Comment-only change.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • Item 1 - zero consumers of parent (span=1cff710dbd6d): accepted-and-deferred

Same item and clearing condition as spans ac6961f64e8c, 35b8ee63139a, fd4a24a07494 and a0da6cceff95 on earlier heads: the consumer is #11484 (label deferred-finding, assignee chenmingwei23, Due 2026-10-01), whose deliverable list names the fold keyed by parent.slot, the extraction rule across a slot's opened entries, and the test shape; the body's Related Issues carries Part of #11484. Producer-first is the only order available because the child's id does not exist when session_create runs.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • Item 2 - zero consumers of sid (span=8e90e2184f8d): accepted-and-deferred

The named reader exists in #11484's deliverable list: the projection resolves parent.sid to the creator's crew log path so a System page row links to the exact creator log, which the slot cannot do once its slot key has been recycled onto a later ACP session. It is deferred with the tree reader rather than subtracted because the sid cannot be added later: the creator handle may be replaced after mint (the GPT finding fixed on head 545405e), so the id is either captured at mint or lost. The retrospective after round 4 (issuecomment-5721674342) carries the Watch item that if #11484 drops the sid consumer, the sid half and its bound go together.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author
  • Watch - which session/opened the fold reads when entries disagree on parent (span=4faa9219c479): accepted-and-deferred

Same item as span 57e1dd88753a on head e6585e0, same answer: the rule is pinned in #11484's deliverable list, where the reader is built -- the fold takes parent from ANY session/opened of the slot that carries one, across every crew log the slot wrote; entries in one slot cannot disagree (one creator, stamped once at mint) and an entry without parent (a re-attach after a gateway restart, where the mint witness is gone) never retracts it. The issue also carries the test shape (create -> re-attach -> restart -> re-attach folds to the same parent), which is the item's second clearing condition.
Kept out of this PR's spec text because it is a reader-side contract and this PR ships no reader; if this branch needs another push for any other reason, the two sentences ride along.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 18, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved

@bolichen97
bolichen97 merged commit bc2f279 into main Sep 18, 2026
92 of 93 checks passed
@bolichen97
bolichen97 deleted the feat/ledger-session-parent branch September 18, 2026 04:03
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 18, 2026
chenmingwei23 added a commit that referenced this pull request Sep 19, 2026
… the System page

A session opened through session_create records its creator on its own
session/opened entry (#11472). This adds the reader. crew_log/tree.py folds
the first entry of every session log into slot -> parent edges: an orphan
and a cycle degrade to root, any opened entry carrying a parent wins and
one without never retracts it, the oldest log's word stands. A cached
scanner reads one bounded head per log and re-reads only a replaced or
removed segment. /api/sessions/memory carries `parent` per session row
(slot, sid, the creator's live key, whether the sid resolves to a log),
and the System page Sessions table nests a created session under its
running creator the way it nests a task, to any depth.

Closes #11484
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.

2 participants