Skip to content

fix(sessions): preserve transcript turn and child-session ownership - #116897

Merged
steipete merged 1 commit into
mainfrom
codex/qa200-session-transcript-ownership
Jul 31, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa200-session-transcript-ownership

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users coordinating repeated child-agent tasks could receive a previous task's answer when the new turn produced no reply, where simultaneously completed child tasks could change order between equivalent parent summaries, and where a controlled dashboard child was undiscoverable, misplaced, or duplicated because live Gateway filtering and sidebar lineage disagreed about its navigation owner.

Why This Change Was Made

Child completion now recognizes canonical user and projected inter-session turn boundaries, and equal-timestamp results use stable child-session identity. Gateway live-owner filtering plus full-list and single-row child indexes now preserve both the explicit navigation parent and the actual runtime controller while still rejecting stale spawnedBy metadata. One canonical sidebar parent resolver consistently prefers a trimmed, non-empty explicit navigation parent and falls back to the controller for blank or whitespace legacy metadata. This follows the existing session-visibility contract, which already authorizes parentSessionKey; no session-history cursor, persistent state, SQLite schema, authentication, authorization boundary, or public protocol contracts change.

User Impact

Parent agents no longer mistake an old answer for a newly failed or silent task, concurrent child findings remain stable, and unloaded controlled child sessions can be discovered and displayed exactly once beneath their actual dashboard conversation.

Evidence

  • Frozen baseline: e051a7bb4a6ba69b87391e990b00813114b1d482; exact candidate: 33ad986ebe503ccd3f9dc906cf02ff486e534302.
  • PATH="/Users/steipete/.local/opt/node-v24.18.0-darwin-arm64/bin:$PATH" /Users/steipete/.local/opt/node-v24.18.0-darwin-arm64/bin/node scripts/run-vitest.mjs src/agents/subagent-announce-output.test.ts — 27 passed.
  • From ui/, /Users/steipete/.local/opt/node-v24.18.0-darwin-arm64/bin/node ../node_modules/vitest/vitest.mjs run --config vitest.config.ts --project unit src/components/app-sidebar-session-navigation-logic.test.ts src/lib/sessions/session-key.test.ts --maxWorkers=1 — 16 passed, including whitespace/empty parent fallback and direct child ancestry.
  • /Users/steipete/.local/opt/node-v24.18.0-darwin-arm64/bin/node node_modules/vitest/vitest.mjs run --config test/vitest/vitest.gateway-core.config.ts src/gateway/session-utils.subagent.test.ts --maxWorkers=1 --testNamePattern 'discovers controlled children|keeps persisted navigation lineage|does not reattach moved children|does not return moved child sessions|returns dashboard child sessions' — 5 passed; exercises the real Gateway filtered list, current controller, explicit navigation owner, stale-controller rejection, and both full/single-row child indexes.
  • From ui/, /Users/steipete/.local/opt/node-v24.18.0-darwin-arm64/bin/node ../node_modules/vitest/vitest.mjs run --config vitest.config.ts --project unit src/components/app-sidebar.test.ts --maxWorkers=1 --testNamePattern 'renders a controlled child once under its explicit dashboard parent|keeps owner avatars off child rows' — 2 passed, including a genuinely unloaded child, owner-aware Gateway filter, and a real mounted sidebar.
  • Focused oxfmt --check, oxlint on all twelve changed files, and git diff --check passed.
  • Existing ownership boundary proof: src/plugin-sdk/session-visibility.ts:359 already treats explicit parentSessionKey as an authorized owner.
  • Direct Codex contract inspection: ../codex/codex-rs/app-server-protocol/src/protocol/thread_history.rs:474, ../codex/codex-rs/app-server-protocol/src/protocol/thread_history.rs:1208, and ../codex/codex-rs/app-server-protocol/src/protocol/thread_history_projection.rs:53.
  • Exact-commit structured Codex gpt-5.6-sol autoreview: clean, confidence 0.96, no accepted/actionable findings; shared TruffleHog secret scan: clean.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Jul 31, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 12:00 PM ET / 16:00 UTC.

ClawSweeper review

What this changes

This PR resets child-agent completion summaries at new transcript turns, makes equal-time child findings deterministic, and reconciles Gateway child-session discovery with the Control UI sidebar’s navigation-parent lineage.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 7 items remain

Keep this PR open for human review. The supplied context shows a focused repair with extensive test claims, but the review environment could not perform even read-only repository inspection (bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted), so current-main behavior, the full target policy, history, and the complete current-head diff could not be independently verified. The existing maintainer label also requires explicit maintainer handling rather than automated cleanup.

Priority: P1
Reviewed head: 5ffadff56ca26c41660ccedbb4e1c20ee333bdce
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has focused test coverage in the supplied PR body, but current-head real behavior proof and independent source review are still missing.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports focused unit, Gateway-harness, and mounted-sidebar tests, but the supplied context contains no independently inspectable after-fix live output, terminal transcript, recording, screenshot, or redacted runtime log for the current head. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports focused unit, Gateway-harness, and mounted-sidebar tests, but the supplied context contains no independently inspectable after-fix live output, terminal transcript, recording, screenshot, or redacted runtime log for the current head. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 3 items Read-only inspection blocked: The first repository-read command failed before reading any file: bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted. Therefore this review cannot independently confirm current source, scoped policy, git history, test content, or provenance.
Provided PR evidence: The PR body reports focused transcript, Gateway, and mounted-sidebar tests plus formatting and lint checks, but no independently inspectable after-fix runtime artifact is included in the supplied context.
Protected maintainer routing: The provided GitHub context includes the maintainer label, which prevents automated close or cleanup and requires explicit maintainer handling.
Findings None None.
Security Needs attention Verify the expanded child-owner visibility rule: isCurrentSessionChildOwner treats explicit parentSessionKey as sufficient for Gateway child discovery even when the live controller differs. Confirm this matches the established session-visibility authorization contract and every projection path before merge.

How this fits together

The agent runtime reads a child session’s transcript to report completion back to its parent. Separately, the Gateway exposes child-session relationships to the Control UI, which renders them under dashboard conversations; the patch changes how those two paths distinguish a runtime controller from a navigation parent.

flowchart LR
  A[Child-agent transcript] --> B[Completion summary]
  B --> C[Parent-agent findings]
  D[Session store] --> E[Gateway session filter]
  F[Active child controller] --> E
  E --> G[Sidebar parent resolver]
  G --> H[Dashboard session tree]
Loading

Decision needed

Question Recommendation
Should this PR’s rule that either the active runtime controller or explicit parentSessionKey may own a child session be accepted as the repository-wide Gateway visibility invariant? Accept the dual-owner invariant: Confirm that explicit navigation lineage remains an authorized discovery owner even when live runtime control has moved, then require current-head proof before merge.

Why: That rule affects session discovery and authorization-adjacent visibility semantics across Gateway and Control UI paths; the protected maintainer label and blocked source inspection prevent safely resolving the intended permanent contract automatically.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports focused unit, Gateway-harness, and mounted-sidebar tests, but the supplied context contains no independently inspectable after-fix live output, terminal transcript, recording, screenshot, or redacted runtime log for the current head. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve security concern: Verify the expanded child-owner visibility rule - isCurrentSessionChildOwner treats explicit parentSessionKey as sufficient for Gateway child discovery even when the live controller differs. Confirm this matches the established session-visibility authorization contract and every projection path before merge.
  • Resolve merge risk (P1) - The Gateway change alters child-session visibility decisions by accepting either the active controller or parentSessionKey as an owner; the existing authorization and stale-lineage invariants need source-level verification before merge.
  • Resolve merge risk (P1) - No independently inspectable current-head runtime proof is available in the supplied context; focused tests and CI are supplemental rather than real behavior proof.
  • Resolve merge risk (P1) - The branch is reported as behind main, so a review refresh against the current merge result is needed after CI completes.
  • Complete next step (P2) - A protected maintainer-labeled PR changes authorization-adjacent session visibility semantics and needs contract confirmation plus current-head real behavior proof, not an automated repair lane.

Findings

  • [medium] Verify the expanded child-owner visibility rule — src/gateway/session-utils-core.ts:427
Agent review details

Security

Needs attention: The patch changes authorization-adjacent Gateway child-session visibility, but blocked repository reads prevented verification of the existing access contract and all affected callers.

PR surface

Source +140, Tests +324. Total +464 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 8 152 12 +140
Tests 5 325 1 +324
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 477 13 +464

Review metrics

Metric Value Why it matters
Ownership interpretations changed 1 Gateway ownership predicate added and reused in 3 list/index paths A shared predicate now affects filtered listing plus full and single-row child indexes, so an incorrect visibility rule can propagate across session projections.

Stored data model

Persistent data-model change detected: persistent cache schema: src/gateway/session-utils.single-row-cache.test.ts, serialized state: src/gateway/session-utils-core.ts, serialized state: src/gateway/session-utils-list.ts, serialized state: src/gateway/session-utils.single-row-cache.test.ts, serialized state: src/gateway/session-utils.subagent.test.ts, serialized state: ui/src/lib/sessions/session-key.test.ts, and 5 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Prove the dual-owner contract before merge (recommended)
    Add current-head proof covering stale spawnedBy, explicit navigation ownership, controller movement, and duplicate-free sidebar projection before accepting the Gateway visibility change.
  2. Pause for owner-contract direction
    Pause the PR if maintainers do not intend explicit navigation lineage to authorize Gateway child discovery independently of the active controller.

Technical review

Best possible solution:

Rebase or refresh the PR against current main, verify the ownership rule against the existing session-visibility contract and sibling Gateway projections, then add redacted after-fix Gateway or mounted-sidebar runtime evidence showing a controlled child is returned and rendered once under its explicit navigation parent.

Do we have a high-confidence way to reproduce the issue?

No: the supplied PR body describes focused tests, but the review environment could not inspect or run the current checkout, and it includes no independently viewable current-head runtime artifact.

Is this the best way to solve the issue?

Unclear: the proposed shared dual-owner predicate may be the right bounded repair, but source-level comparison with the existing visibility contract, callers, and sibling projections is required before calling it the best solution.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against f66fff57f339.

Labels

Label justifications:

  • P1: The PR targets active child-agent completion and dashboard session-discovery behavior that can affect real parent-agent workflows.
  • merge-risk: 🚨 compatibility: Existing spawnedBy and parentSessionKey metadata receive a changed ownership interpretation.
  • merge-risk: 🚨 session-state: The patch changes transcript-turn reset behavior and child-session relationship projection.
  • merge-risk: 🚨 security-boundary: Gateway session filtering is authorization-adjacent and the added dual-owner predicate must preserve existing visibility constraints.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused unit, Gateway-harness, and mounted-sidebar tests, but the supplied context contains no independently inspectable after-fix live output, terminal transcript, recording, screenshot, or redacted runtime log for the current head. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Verify the expanded child-owner visibility rule — src/gateway/session-utils-core.ts:427
    isCurrentSessionChildOwner treats explicit parentSessionKey as sufficient for Gateway child discovery even when the live controller differs. Confirm this matches the established session-visibility authorization contract and every projection path before merge.
    Confidence: 0.62

What I checked:

  • Read-only inspection blocked: The first repository-read command failed before reading any file: bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted. Therefore this review cannot independently confirm current source, scoped policy, git history, test content, or provenance.
  • Provided PR evidence: The PR body reports focused transcript, Gateway, and mounted-sidebar tests plus formatting and lint checks, but no independently inspectable after-fix runtime artifact is included in the supplied context. (src/gateway/session-utils-core.ts:418, 5ffadff56ca2)
  • Protected maintainer routing: The provided GitHub context includes the maintainer label, which prevents automated close or cleanup and requires explicit maintainer handling.

Likely related people:

  • steipete: The supplied PR context attributes the current repair and its focused evidence to steipete; current-main feature-history ownership could not be independently traced because repository reads were blocked. (role: proposed repair author and recent session-area contributor; confidence: low; commits: 5ffadff56ca2; files: src/agents/subagent-announce-output.ts, src/gateway/session-utils-core.ts, ui/src/components/app-sidebar-session-tree.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted current-head Gateway or terminal transcript demonstrating that a controlled child is listed for its navigation parent and not duplicated.
  • Add a redacted mounted-sidebar recording or screenshot sequence demonstrating that the unloaded child appears once under the explicit dashboard parent.
  • Refresh the review after the branch is reconciled with current main and CI completes.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-07-31T15:06:06.845Z sha 33ad986ebe503ccd3f9dc906cf02ff486e534302 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T15:44:26.627Z sha 057baa1c01b911523cc391c5113f2528eeeb9aff :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the codex/qa200-session-transcript-ownership branch from 33ad986 to 057baa1 Compare July 31, 2026 15:39
@steipete
steipete force-pushed the codex/qa200-session-transcript-ownership branch from 057baa1 to 5ffadff Compare July 31, 2026 15:56
@steipete
steipete merged commit a0ad31f into main Jul 31, 2026
123 checks passed
@steipete
steipete deleted the codex/qa200-session-transcript-ownership branch July 31, 2026 16:16
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 31, 2026
* origin/main: (42 commits)
  fix(auto-reply): avoid false overload attribution on stalled replies (#116959)
  fix(auth-profiles): scope model_not_found cooldown to the failing model (#116768)
  fix(agents): expose embedded preparation latency (#116936)
  fix(macos): preserve localized setup fallback
  fix: repair canonical session keys with doctor (#116703)
  fix(gateway): preserve plugin-only session change events (#116948)
  fix(media): recognize AIFF attachments across audio workflows (#116907)
  fix(openai): recover missing terminal response output (#116910)
  fix(telegram): preserve outbound media metadata and rejected photos (#116886)
  fix(agents): preserve bounded truthful subagent outcomes (#116932)
  improve(setup): clarify local provider actions
  fix(cron): preserve scheduler truth across edits and delivery (#116923)
  fix(openai): finalize Chat tool calls from authoritative terminals (#116922)
  fix(ui): recover session observers across reconnects (#116887)
  fix(qa): verify requested scenarios and reject silent character runs (#116912)
  fix: agent turns survive unavailable optional web credentials (#112522)
  fix(sessions): preserve transcript and child ownership (#116897)
  fix(ui): preserve chat stream ownership and accessible rendering (#116929)
  fix(media): preserve display metadata and attachment formats (#116928)
  fix(together): preserve immediate video outcomes and image references (#116913)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* origin/main: (42 commits)
  fix(auto-reply): avoid false overload attribution on stalled replies (openclaw#116959)
  fix(auth-profiles): scope model_not_found cooldown to the failing model (openclaw#116768)
  fix(agents): expose embedded preparation latency (openclaw#116936)
  fix(macos): preserve localized setup fallback
  fix: repair canonical session keys with doctor (openclaw#116703)
  fix(gateway): preserve plugin-only session change events (openclaw#116948)
  fix(media): recognize AIFF attachments across audio workflows (openclaw#116907)
  fix(openai): recover missing terminal response output (openclaw#116910)
  fix(telegram): preserve outbound media metadata and rejected photos (openclaw#116886)
  fix(agents): preserve bounded truthful subagent outcomes (openclaw#116932)
  improve(setup): clarify local provider actions
  fix(cron): preserve scheduler truth across edits and delivery (openclaw#116923)
  fix(openai): finalize Chat tool calls from authoritative terminals (openclaw#116922)
  fix(ui): recover session observers across reconnects (openclaw#116887)
  fix(qa): verify requested scenarios and reject silent character runs (openclaw#116912)
  fix: agent turns survive unavailable optional web credentials (openclaw#112522)
  fix(sessions): preserve transcript and child ownership (openclaw#116897)
  fix(ui): preserve chat stream ownership and accessible rendering (openclaw#116929)
  fix(media): preserve display metadata and attachment formats (openclaw#116928)
  fix(together): preserve immediate video outcomes and image references (openclaw#116913)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant