Repository navigation
fix(gateway): avoid repeated session root scans in configured lists - #124384
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 12:40 AM ET / 04:40 UTC. ClawSweeper reviewWhat this changesThe PR makes configured-only Gateway session lists use prepared configured, registered, and open session-store targets instead of request-time root discovery, while preserving parent-linked child sessions. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessThe PR remains necessary: current main still loads configured-only lists without forwarding that scope, then resolves sharing from an empty discovery cache. The proposed prepared-target path is a coherent owner-boundary repair, and the follow-up startup-registry test addresses the prior upgrade-visibility blocker; exact-head CI and normal maintainer review remain before merge. Priority: P1 Review scores
Verification
How this fits togetherControl UI session refreshes call the Gateway’s session-list RPC, which combines durable and incognito agent stores before resolving sharing visibility. Configured-only lists must hide unrelated stores while retaining children linked to configured parents. flowchart LR
A[Control UI refresh] --> B[Gateway session list]
B --> C{Configured-only request}
C --> D[Prepared configured and registered stores]
D --> E[Combined session rows]
E --> F[Parent and spawned-child filter]
F --> G[Sharing resolution]
G --> H[Visible session list]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +17, Tests +165. Total +182 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one prepared-target flow shared by configured-list loading and sharing resolution, retain the startup registry-recovery regression, and merge after exact-head Gateway validation is green. Do we have a high-confidence way to reproduce the issue? Yes—source shows current main loads the unscoped combined store before filtering, and the focused Gateway handler tests construct configured, child, and unrelated stores while observing directory discovery. Is this the best way to solve the issue? Yes—the repair moves configured-only selection to the combined-store owner and supplies those exact targets to sharing resolution; filtering only at the consumer would retain the discovery path and a direct-config-only shortcut would lose parent-linked children. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7563682c3fc3. 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
History |
|
Land-ready evidence for exact head The configured-only Local proof on this patch:
Exact-head CI is completed success: https://github.com/openclaw/openclaw/actions/runs/31926923650 The current-head ClawSweeper review reports no findings. Its prior upgrade concern is addressed by the real startup recovery test: it deletes only a durable child's registry row, preserves the database, runs the existing startup discovery/open owner, verifies the exact registry row is restored before runtime reads, then confirms the configured-parent child remains visible with zero directory discovery while an unrelated row stays excluded. Its only optional rank-up move was exact-head CI, now complete. Production LOC: +133/-116 (net +17). Tests: +263/-98 (net +165). The production growth is the prepared-target owner boundary and store-lookup extraction; the change also removes the duplicate late configured filter and duplicate fixed/template merge policy. There is no config, protocol, SQLite schema/version, or migration-format change. Known proof gap: the live multi-client soak remains intentionally post-merge because the live environment is currently degraded. No live-soak success is claimed. |
|
Merged via squash.
|
…penclaw#124384) * fix(gateway): stop configured session rediscovery * fix(gateway): reuse prepared child store targets * refactor(gateway): own prepared session targets * test(gateway): prove session registry recovery
…penclaw#124384) * fix(gateway): stop configured session rediscovery * fix(gateway): reuse prepared child store targets * refactor(gateway): own prepared session targets * test(gateway): prove session registry recovery
What Problem This Solves
Fixes an issue where Control UI clients requesting configured-only all-agent session lists repeatedly enumerated configured, retired, and manual session roots. The repeated discovery happened on a request-time hot path after
88d6a2c8d63stopped forwarding the configured-only scope into combined-store loading.A simple switch to configured targets would be incorrect: it would regress the configured-parent child visibility shipped in
8483d0337530, where an unconfigured child remains visible when itsspawnedByorparentSessionKeybelongs to a configured agent.Why This Change Was Made
The combined Gateway store now builds configured-only candidates from configured direct targets, the startup/runtime-seeded durable database registry, and currently open incognito databases. It deduplicates physical targets with the existing ownership rules, canonicalizes and merges rows before applying the lineage-aware configured filter, and returns authoritative prepared durable targets for sharing resolution.
Sharing enrichment seeds every logical result agent from those prepared targets. This includes a child whose logical agent differs from the configured physical database owner, preventing a fallback to request-time filesystem discovery while preserving configured-parent lineage. The prepared discovery-cache constructor lives in the existing store-lookup owner because the CI max-lines rule correctly rejects further growth in
sessions-read.ts. Broad non-configured all-agent lists retain their existing directory discovery behavior. No configuration, schema, protocol, compatibility fallback, or process cache was added.Production LOC: +133/-116 (net +17). Tests: +263/-98 (net +165). The positive production growth is the explicit prepared-target owner boundary plus the extracted cache constructor required to preserve all child-lineage cases without request-time discovery while keeping
sessions-read.tsbelow its hard line limit.User Impact
Operators with multiple configured agents and connected Control UI clients avoid repeated session-root scans during configured-only refreshes. Configured main and ACP sessions, configured-parent durable and incognito children, parent-owned physical-store children, and existing ownership/collision behavior remain visible as before. Retired or manual stores unrelated to configured lineage stay hidden from configured-only results and remain available in broad lists.
Evidence
New exact-head CI, a fresh current-head ClawSweeper review, and the post-landing live multi-client soak are pending.