Repository navigation
fix(subagents): subagent list building decodes unrelated saved prompts in large session stores - #139540
Conversation
…s in large session stores
|
🦞👀 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: needs maintainer review before merge. Reviewed September 6, 2026, 2:15 PM ET / 18:15 UTC. ClawSweeper reviewWhat this changesSubagent lists use the existing session metadata projection to avoid decoding unused saved prompts, with a regression test preserving model, status, and token output. Merge readiness✅ Ready for maintainer review This PR remains useful: fetched main and the latest release still perform full reads in the common subagent-list reader. The focused repair has credible production-path proof and no actionable correctness findings. Priority: P2 Review scores
Verification
How this fits togetherThe subagent-list builder combines controlled runs with saved session metadata. Its output feeds the subagents tool, native list command, and active-subagent prompt context. flowchart TD
A[Controlled subagent runs] --> D[Common list builder]
B[SQLite session records] --> C[Existing metadata projection]
C --> D
D --> E[Tool list results]
D --> F[Native list command]
D --> G[Active subagent context]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -1, Tests +75. Total +74 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the common list reader on the existing metadata projection while preserving output, full-read behavior, and canonical cache invalidation. Do we have a high-confidence way to reproduce the issue? Yes: current main defaults this reader to full records, and the supplied real-SQLite runs demonstrate unrelated prompt decoding. This review verified the source path without executing it. Is this the best way to solve the issue? Yes: selecting the existing projection at the shared reader is a narrow repair that preserves listing semantics and avoids a competing reader or cache. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cbd5419a5d6d. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Real behavior proof added for the review's outstanding items — the changed listing path is now demonstrated in a running production flow, with before/after seconds and RSS. What was run (no mocks, no vitest): a standalone Node process drives the production Results (25 production list calls):
Both runs return byte-identical list output (model/token metadata lines unchanged), so the projection selection changes only what is decoded, not what is listed. The PR body's Evidence section has been updated with the same numbers and the exact commands. What remains untested (noted honestly in the body): no full Gateway daemon/agent turn — the proof exercises the production tool path in-process against real SQLite files, which is the exact changed listing path; timing is from a local dev machine and indicative, not benchmark-grade. |
Keep the metadata allocation regression beside the existing real-SQLite list coverage, sharing its workspace and canonical session writer. Preserve visible model, token and status assertions before checking unrelated prompt decoding. The existing list projection repair avoids decoding unused saved prompts. Secretless hosted proof confirms the intended baseline failure, zero unrelated payload decodes after the fix, complete tool-output parity, and 37 passing tests. Co-authored-by: LiuwqGit <[email protected]>
|
Merged via squash.
|
* origin/main: (25 commits) docs(releases): keep the release-notes nav group to version routes (#140353) fix(ui): hide trust wrappers in imported chat history fix(subagents): subagent list building decodes unrelated saved prompts in large session stores (#139540) test(process): share relay startup fixtures (#140345) refactor(doctor): inline GitHub skill discovery inputs (#140343) refactor(ui): share channel status type definitions (#140331) refactor: simplify queue state and infrastructure dispatch (#140311) fix: require saved agent turns before update verification succeeds (#140274) fix(update): keep the service profile when switching to Git (#140263) fix(ui): prevent image avatars overlapping mobile chat (#140341) fix(test): accept release subpages in docs route shape (#140337) refactor(plugins): share uninstall mutation ownership (#140322) refactor(agents): use canonical tool execution arguments (#140280) perf(cli): keep inference metadata and domain help lazy (#140327) refactor(plugins): simplify self-hosted setup results (#140332) refactor(config): reuse parent lookup for unset operations (#140326) fix(plugins): preserve exact installed-index mutation receipts (#140328) test(agents): simplify MCP and LSP boundary fixtures (#140312) fix(ui): preserve literal source previews and copied whitespace (#140306) fix: OpenCode Go/Zen requests are missing the required x-opencode-session header (#137464) ...
…s in large session stores (openclaw#139540) * fix(subagents): subagent list building decodes unrelated saved prompts in large session stores * test(subagents): consolidate list metadata regression Keep the metadata allocation regression beside the existing real-SQLite list coverage, sharing its workspace and canonical session writer. Preserve visible model, token and status assertions before checking unrelated prompt decoding. The existing list projection repair avoids decoding unused saved prompts. Secretless hosted proof confirms the intended baseline failure, zero unrelated payload decodes after the fix, complete tool-output parity, and 37 passing tests. Co-authored-by: LiuwqGit <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: LiuwqGit <[email protected]>
What Problem This Solves
Building a subagent list reads complete session records even though the list only uses metadata. In a large store, every nonempty list repeatedly decodes unrelated saved skill prompts and system-prompt reports, adding CPU and allocation work to the tool, native
/subagentscommand, and active-subagent context.Why This Change Was Made
Select the existing
listprojection at the common list reader. The accessor already removes the two unused payload fields before JavaScript allocation and owns metadata caching. Model, token, status, child metadata, visibility, full reads, and cache invalidation keep their existing contracts.Production is +3/−4, net −1 line. The regression is consolidated into the existing real-SQLite list suite, reusing its fixture ownership and writer helper instead of adding another test module. It checks visible model/status/usage before asserting zero unrelated prompt decoding. Tests are +76/−1.
Evidence
subagentstool read a real SQLite store with 1,000 unrelated 8 KiB skill prompts and valid report metadata. First, warm-default, and post-write lists each decoded all 1,000 unrelated row strings; complete output, visibility, empty-list, full-read and metadata-update controls passed before the intended zero-decoding assertion failed.f174e9c80eacc7811c4d80622a4def50c4ac5b9e.Original contribution by @LiuwqGit, preserved in branch ancestry and human coauthor credit. This repairs the remaining common list reader; previously merged reconciliation/depth and sessions-tail changes are not included or counted again.