Repository navigation
fix(sessions): keep pins on root sessions only - #140748
Conversation
A pin was a bare pinnedAt stamp that the Gateway accepted for any session key, so a spawned child session could be pinned through the agent sessions tool, a Sessions page batch action, or a promoted child row, and the sidebar then rendered it as a top-level pinned card. Define pinnability once: a session is pinnable only when its key is not a subagent key and its entry carries no spawnedBy or parentSessionKey. sessions.patch rejects child pins with a clear error and drops a stale child pin on the next write; list projection, ordering, and maintenance preservation ignore child pins, so existing child pins simply disappear. The Control UI hides pin affordances by lineage instead of the sidebar's child-projection fact, and the agent tool describes the root-only rule.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 7, 2026, 12:39 AM ET / 04:39 UTC. ClawSweeper reviewWhat this changesRestricts session pins to root conversations across the Gateway, agent tool, and Control UI, and stops honoring existing child pins during listing and maintenance. Merge readiness⛔ Blocked before merge - 3 items remain This PR addresses behavior still present on current main. The updated RPC fixture is appropriate and no discrete correctness defect was found, but the previously identified persisted-retention compatibility gap remains unresolved. Priority: P2 Review scores
Verification
How this fits togetherSession pins organize conversations in the Control UI and protect session records from maintenance. The Gateway processes pin requests against stored session lineage, then projects those records for browsing and cleanup. flowchart TD
A[UI or agent pin request] --> B[Gateway session patch]
C[Stored session lineage] --> B
B --> D{Root session?}
D -->|Yes| E[Persist pin]
D -->|No| F[Reject pin request]
C --> G[Session listing and maintenance]
E --> G
G --> H[Sidebar ordering and retention]
Decision needed
Why: The maintainer-authored body establishes root-only pin intent, but withdrawing protection from existing stored sessions has consequences beyond correcting their sidebar placement. Before merge
Agent review detailsSecurityNone. PR surfaceSource +59, Tests +185, Docs +7. Total +251 across 34 files. View PR surface stats
Review metricsNone. Mantis proof suggestionWeb UI chat evidence could confirm that promoted children lack pin affordances while root pinning still works; storage recovery requires separate evidence. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Enforce root-only browsing pins with an explicitly accepted, demonstrated transition for legacy child retention, preserving existing protection until that transition is validated. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main accepts a pin on a spawned child, and the reported promoted-row path can expose that child as pinned. This review did not execute a runtime reproduction. Is this the best way to solve the issue? The Gateway eligibility check and matching UI affordances are a focused repair; the additional legacy-retention transition needs persisted compatibility evidence before the complete solution is accepted. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4394672f2573. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Update the existing session-store RPC integration sequence to pin and archive its Discord group root fixture. Child pins are intentionally rejected by PR #140748; dedicated patch tests cover that rejection.
|
Merged via squash.
|
* fix(sessions): keep pins on root sessions only A pin was a bare pinnedAt stamp that the Gateway accepted for any session key, so a spawned child session could be pinned through the agent sessions tool, a Sessions page batch action, or a promoted child row, and the sidebar then rendered it as a top-level pinned card. Define pinnability once: a session is pinnable only when its key is not a subagent key and its entry carries no spawnedBy or parentSessionKey. sessions.patch rejects child pins with a clear error and drops a stale child pin on the next write; list projection, ordering, and maintenance preservation ignore child pins, so existing child pins simply disappear. The Control UI hides pin affordances by lineage instead of the sidebar's child-projection fact, and the agent tool describes the root-only rule. * test(sessions): use root fixture for pin archive RPC coverage Update the existing session-store RPC integration sequence to pin and archive its Discord group root fixture. Child pins are intentionally rejected by PR openclaw#140748; dedicated patch tests cover that rejection.
The root-only pin policy from openclaw#140748 rejected any session with a non-empty parentSessionKey. Ordinary durable dashboard sessions auto-parent to the agent main root (agent:<id>:main) for flow-up notices and sidebar threads, so they were incorrectly treated as nested children and could not be pinned. Distinguish the auto-Home parent from genuine nested-child lineage: when parentSessionKey equals the session's own agent main root, the session is still top-level and remains pinnable. The spawnedBy check stays strict; subagent keys and truly nested children are still rejected. Fixes openclaw#142673
The root-only pin policy from openclaw#140748 rejected any session with a non-empty parentSessionKey. Ordinary durable dashboard sessions auto-parent to the agent main root (agent:<id>:main) for flow-up notices and sidebar threads, so they were incorrectly treated as nested children and could not be pinned. Distinguish the auto-Home parent from genuine nested-child lineage: when parentSessionKey equals the session's own agent main root, the session is still top-level and remains pinnable. The spawnedBy check stays strict; subagent keys and truly nested children are still rejected. Fixes openclaw#142673
* fix(sessions): allow pinning Home-parented dashboard sessions The root-only pin policy from #140748 rejected any session with a non-empty parentSessionKey. Ordinary durable dashboard sessions auto-parent to the agent main root (agent:<id>:main) for flow-up notices and sidebar threads, so they were incorrectly treated as nested children and could not be pinned. Distinguish the auto-Home parent from genuine nested-child lineage: when parentSessionKey equals the session's own agent main root, the session is still top-level and remains pinnable. The spawnedBy check stays strict; subagent keys and truly nested children are still rejected. Fixes #142673 * chore: retrigger CI (flaky checks-node-compact-large-12 timeout) * fix(sessions): allow pinning Home-parented dashboard sessions Resolve max-lines lint regression (702>700) in sessions-patch.ts: call isPinnableSessionEntry without the explicit cfg-aware mainKey and rely on its internal default fallback. The two paths are production-equivalent (applySessionDefaults normalizes mainKey to 'main'), as documented below. Closes #142673 * fix(sessions): unify Home pin policy and verify retention boundaries * chore(sessions): satisfy pin policy lint guards --------- Co-authored-by: Patrick Erichsen <[email protected]>
…aw#143250) * fix(sessions): allow pinning Home-parented dashboard sessions The root-only pin policy from openclaw#140748 rejected any session with a non-empty parentSessionKey. Ordinary durable dashboard sessions auto-parent to the agent main root (agent:<id>:main) for flow-up notices and sidebar threads, so they were incorrectly treated as nested children and could not be pinned. Distinguish the auto-Home parent from genuine nested-child lineage: when parentSessionKey equals the session's own agent main root, the session is still top-level and remains pinnable. The spawnedBy check stays strict; subagent keys and truly nested children are still rejected. Fixes openclaw#142673 * chore: retrigger CI (flaky checks-node-compact-large-12 timeout) * fix(sessions): allow pinning Home-parented dashboard sessions Resolve max-lines lint regression (702>700) in sessions-patch.ts: call isPinnableSessionEntry without the explicit cfg-aware mainKey and rely on its internal default fallback. The two paths are production-equivalent (applySessionDefaults normalizes mainKey to 'main'), as documented below. Closes openclaw#142673 * fix(sessions): unify Home pin policy and verify retention boundaries * chore(sessions): satisfy pin policy lint guards --------- Co-authored-by: Patrick Erichsen <[email protected]>
Problem
A session pin is a bare
pinnedAttimestamp on the session entry, and the Gateway stamped it on any key. Nothing enforced "pins are for root sessions": the agentsessionstool, the Sessions page menu (which lists raw Gateway rows), promoted child rows in the sidebar, and drag-to-pin all reachedsessions.patch { pinned: true }for child sessions. On a team deployment a spawned child dashboard session was pinned through a batchsessions.patch, and because the sidebar's pinned zone is built from any projected root row withpinned: true(the active session is always promoted to a root row), the child rendered as a top-level pinned card next to the navigation routes.Solution
subagent:*key, no non-emptyspawnedBy, no non-emptyparentSessionKey.sessions.patchrejectspinned: trueon such entries withcannot pin a child session; pin its parent session instead, and drops a stalepinnedAton any successful patch to an unpinnable entry.sessions.listand session events), list ordering, and store-maintenance preservation ignore child pins, so existing child pins disappear without a migration.pinnablefact (shared helper) instead of the sidebar's child-projection flag, with a localized disabled reason.Impact
Evidence
pnpm check:changed: all lanes green after fixing a test-fixture type error and trimming the pruning test under the file line cap (final lint on the touched file green).node scripts/run-vitest.mjs src/gateway/sessions-patch.test.ts src/gateway/session-utils.test.ts src/config/sessions/store.pruning.test.ts src/agents/tools/sessions-tool.batch.test.ts: 3 shards passed (366 + 60 + 12 tests).node scripts/run-vitest.mjs ui/src/components/app-sidebar.test.ts ui/src/pages/sessions/sessions-page.test.ts ui/src/pages/chat/chat-pane-session-menu.test.ts ui/src/components/app-sidebar-session-projection.test.ts ui/src/components/app-sidebar-session-narration.test.ts: 5 files, 435 tests passed.