Skip to content

Commit 1e0e88d

Browse files
committed
Guard ask_user options against a non-sequence value
A malformed string :options was split by append into character integers that rendered as a list of random numbers; treat non-sequence options as empty.
1 parent 42322cc commit 1e0e88d

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Bugfix: guard `chat/askQuestion` against a non-sequence `:options` (e.g. a malformed string from a misbehaving server). `append` was splitting such a string into character integers that rendered as a list of random numbers; non-sequence options are now treated as empty.
56
- Add a context-usage bar in the chat mode-line, left of the token usage, showing how full the model context window is, colored by category (system prompt, rules, skills, AGENTS.md, tool definitions, tool calls, conversation, free space), each a distinct color. In graphical frames it renders pixel-width thin segments for high granularity (small percentages stay visible); terminals fall back to block characters. Same footprint either way (`eca-chat-context-bar-width`). Colors come from the server (canonical `color`/`freeColor`) so they are consistent; hover the bar for a legend that maps each category to its server emoji swatch (`emoji`/`freeEmoji`, matching the `/context` command output), or click to run the new `/context` command. Configurable via `eca-chat-context-bar-width` and the `:context-bar` module in `eca-chat-mode-line-format`. Needs an eca server that sends `contextBreakdown` in `usage` content.
67
- Auto-dismiss a pending `ask_user` question when another client (e.g. an SSE/web client in remote mode, see eca 0.139.0) answers it first. The server resolves the `ask_user` tool out from under us and sends a `toolCalled`/`toolCallRejected` for that tool-call id but no longer expects our answer (it cancels our request); we now correlate that id with `eca-chat--pending-question` and clear the stale answer-mode prompt state instead of staying stuck waiting for input.
78
- Paginate long chats instead of replaying the full history on open. With `eca-chat-history-page-size` non-nil (default 50), `eca-chat-resume` opens a chat with only the newest page and shows a clickable "Load older messages" control at the top to page through earlier history on demand via the new `chat/history` request (also bound to `C-c C-S-o`). Older pages are prepended above the existing content, reusing the streaming renderer (subagent nesting included) and kept read-only like the rest of the history. Set `eca-chat-history-page-size` to nil to keep the previous full-replay behavior.

eca-chat.el

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4190,7 +4190,12 @@ to answer mode. Returns :async — the response is sent later when
41904190
the user answers or cancels."
41914191
(let* ((chat-id (plist-get params :chatId))
41924192
(question (plist-get params :question))
4193-
(options (append (plist-get params :options) nil))
4193+
;; Guard against a non-sequence `:options` (e.g. a malformed
4194+
;; string from a misbehaving server): `append' on a string would
4195+
;; split it into character integers that render as random numbers.
4196+
(options (let ((raw (plist-get params :options)))
4197+
(when (or (listp raw) (vectorp raw))
4198+
(append raw nil))))
41944199
(tool-call-id (plist-get params :toolCallId))
41954200
(allow-freeform (plist-get params :allowFreeform))
41964201
(chat-buffer (eca-chat--get-chat-buffer session chat-id)))

0 commit comments

Comments
 (0)