#17131: feat(sessions): expose isProcessing flag in sessions.list
gateway
agents
stale
size: XS
Cluster:
Session Management Enhancements
## What
Adds an `isProcessing` boolean to the `sessions.list` response, derived from the gateway's in-memory `chatAbortControllers` map.
When a session has an active run tracked in `chatAbortControllers`, `isProcessing` is `true`; otherwise `false`. The field is optional and only populated when the caller goes through the gateway (direct `listSessionsFromStore` calls without the param get `undefined`, preserving backward compat).
## Why
I believe some users may require a flag to mark the current state of a session during multitasking operations, distinguishing whether the agent is currently processing a task or awaiting user input.
## Changes
- `session-utils.types.ts` — added `isProcessing` to `GatewaySessionRow`
- `session-utils.ts` — `listSessionsFromStore` accepts optional `activeSessionKeys` set, populates `isProcessing` per row
- `server-methods/sessions.ts` — `sessions.list` handler now reads `context.chatAbortControllers` and passes active keys
- `sessions-helpers.ts` — added `isProcessing` to `SessionListRow`
- `sessions-list-tool.ts` — passes `isProcessing` through to tool output
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds an `isProcessing` boolean field to the `sessions.list` response to indicate whether a session has an active chat run in progress. The flag is derived from the gateway's in-memory `chatAbortControllers` map.
**Key changes:**
- Added `isProcessing` field to type definitions (`GatewaySessionRow`, `SessionListRow`)
- Modified `sessions.list` handler to collect active session keys from `chatAbortControllers`
- Updated `listSessionsFromStore` to accept optional `activeSessionKeys` parameter and populate `isProcessing`
- Propagated the field through the sessions list tool output
**Issue found:**
- The implementation stores raw session keys in `chatAbortControllers` but compares against canonical store keys, which may cause the flag to be incorrect when key normalization occurs (case changes, agent prefix additions, etc.)
<h3>Confidence Score: 2/5</h3>
- This PR has a logical bug that will cause the isProcessing flag to be incorrect in some cases
- The implementation has a key normalization mismatch bug where raw session keys are stored in chatAbortControllers but compared against canonical store keys. This means isProcessing will be false even when a session is actively processing if the keys differ due to case normalization or agent prefix additions. The bug should be fixed before merging.
- Pay close attention to src/gateway/server-methods/sessions.ts where the session key collection logic needs to be fixed
<sub>Last reviewed commit: 014c7db</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#17132: fix: filter out invalid session entries with empty sessionFile
by Limitless2023 · 2026-02-15
70.0%
#21544: Gateway: include diagnostics state in sessions.list
by sey-agent · 2026-02-20
69.7%
#17530: refactor(sessions): centralize session status field extraction
by Facens · 2026-02-15
69.7%
#4154: fix(control-ui): preserve URL session parameter over localStorage d...
by joeyfrasier · 2026-01-29
69.4%
#10748: feat: Add sessions.spawn gateway method for direct subagent spawning
by fox-openclaw · 2026-02-06
69.1%
#16061: fix(sessions): tolerate invalid sessionFile metadata
by haoyifan · 2026-02-14
68.5%
#20336: fix(sessions): resolve transcriptPath using agentId when storePath ...
by Limitless2023 · 2026-02-18
68.1%
#6850: fix: support direct channel:account:peer format in session key extr...
by toboto · 2026-02-02
68.1%
#21693: feat(gateway): expose session entry id on chat history messages
by tlxue · 2026-02-20
68.0%
#16125: feat(gateway): add stuck session detection
by CyberSinister · 2026-02-14
68.0%