[codex] fix(gateway): bound sessions list responses#77123
Conversation
a2b4710 to
a6081ac
Compare
|
Codex review: found issues before merge. Summary Reproducibility: yes. for the review finding: source inspection shows Next step before merge Security Review findings
Review detailsBest possible solution: Keep the bounded RPC behavior, but scope the default cap to actual list surfaces while preserving exact session resolution and adding a regression test for an older Do we have a high-confidence way to reproduce the issue? Yes for the review finding: source inspection shows Is this the best way to solve the issue? No: bounding bare Gateway Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 8f75a4ebdf2a. |
a6081ac to
7389a23
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7389a23c1d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| store, | ||
| opts, | ||
| now, | ||
| rowContext: hasSpawnedByFilter ? getRowContext() : undefined, | ||
| defaultLimit: SESSIONS_LIST_DEFAULT_LIMIT, |
There was a problem hiding this comment.
Scope the default sessions limit to RPC entrypoints only
Applying SESSIONS_LIST_DEFAULT_LIMIT inside listSessionsFromStore changes behavior for all internal callers, not just sessions.list. sessions.resolve relies on this helper in isResolvedSessionKeyVisible (with spawnedBy and no explicit limit) to confirm whether an exact key is visible; once there are more than 100 matching sessions, older valid keys are truncated out and incorrectly return No session found. This turns a performance guard into a correctness regression for large long-lived subagent trees.
Useful? React with 👍 / 👎.
7389a23 to
9213fbd
Compare
|
Landed via squash merge.
|
Summary
This bounds the default Gateway
sessions.listresponse so callers that omitlimitno longer force the Gateway to build every matching session row in one request.Changes:
listSessionsFromStore/listSessionsFromStoreAsynctotalCount,limitApplied, andhasMoremetadata so clients can show when more rows existFixes #77062.
Why
#77062 reports Slack-heavy, long-lived installs where
sessions.list/ dashboard loading could take tens of seconds and saturate the shared Gateway process. Recent main already made row construction lighter, but the bare RPC path still treated an omittedlimitas unbounded.That left any caller using plain
sessions.listable to enumerate and enrich every selected row, which is the failure class behind the Slack Socket Mode degradation: expensive dashboard/session work can monopolize the same event loop that channel transports depend on.Behavior Change
Callers that need a larger window can still pass an explicit positive
limit. Default calls now receive the newest 100 matching rows plus metadata indicating whether more rows exist:count: number of rows returnedtotalCount: number of matching rows before the caplimitApplied: effective row limithasMore: whether the response was truncatedThis intentionally does not add pagination yet; it establishes the safety bound and response shape needed for follow-up UI/API pagination work.
Verification
pnpm test src/gateway/session-utils.test.ts src/gateway/server.sessions.list-changed.test.tspnpm exec oxfmt --check --threads=1 src/shared/session-types.ts src/gateway/session-utils.ts src/gateway/session-utils.test.ts src/gateway/protocol/schema/sessions.ts src/tui/tui-backend.ts docs/cli/sessions.md CHANGELOG.mdpnpm exec oxlint --deny-warnings src/shared/session-types.ts src/gateway/session-utils.ts src/gateway/session-utils.test.ts src/gateway/protocol/schema/sessions.ts src/tui/tui-backend.tsgit diff --checkpnpm check:changedontbx_01kqrq3nn2v7qb4bwrsmw37g5h, run https://github.com/openclaw/openclaw/actions/runs/25302557993origin/main; rebase sanity:git status,git diff --check, and unchanged diff statCurrent PR head:
9213fbd3105372dc1e3275b1e760606e1cd1c918.