← Back to PRs

#17131: feat(sessions): expose isProcessing flag in sessions.list

by oxtiger open 2026-02-15 12:57 View on GitHub →
gateway agents stale size: XS
## 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