Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions eca-chat.el
Original file line number Diff line number Diff line change
Expand Up @@ -3249,6 +3249,20 @@ CHILD, NAME, DOCSTRING and BODY are passed down."
(setq-local eca-chat--history '())
(setq-local eca-chat--history-index -1)

;; Mutable defaults would otherwise be shared until locally assigned.
(setq-local eca-chat-expandable--id->ov
(make-hash-table :test 'equal))
(setq-local eca-chat--tool-call-prepare-counters
(make-hash-table :test 'equal))
(setq-local eca-chat--tool-call-prepare-content-cache
(make-hash-table :test 'equal))
(setq-local eca-chat--tool-call-elapsed-times
(make-hash-table :test 'equal))
(setq-local eca-chat--subagent-chat-id->tool-call-id
(make-hash-table :test 'equal))
(setq-local eca-chat--subagent-usage
(make-hash-table :test 'equal))

;; Show diff blocks in markdown-mode with colors.
(setq-local markdown-fontify-code-blocks-natively t)
;; Enable gfm-view-mode-like rendering without read-only.
Expand Down
26 changes: 26 additions & 0 deletions test/eca-chat-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -1370,4 +1370,30 @@ does not treat the first line as metadata. Returns FN's value."
(delete-window win)))
(kill-buffer buf))))))

(describe "eca-chat subagent elapsed time"
(it "keeps elapsed tracking isolated when another chat finishes"
(spy-on 'eca-chat--force-tab-line-update)
(let ((session (make-eca--session))
chat-a chat-b)
(unwind-protect
(progn
(eca-chat-opened session '(:chatId "chat-A" :title "A"))
(eca-chat-opened session '(:chatId "chat-B" :title "B"))
(setq chat-a (eca-get (eca--session-chats session) "chat-A")
chat-b (eca-get (eca--session-chats session) "chat-B"))
(with-current-buffer chat-a
(puthash "subagent-tool-call" (current-time)
eca-chat--tool-call-elapsed-times))
(with-current-buffer chat-b
(eca-chat--tool-call-elapsed-stop-all))
(with-current-buffer chat-a
(expect (gethash "subagent-tool-call"
eca-chat--tool-call-elapsed-times)
:to-be-truthy)))
(dolist (buffer (list chat-a chat-b))
(when (buffer-live-p buffer)
(with-current-buffer buffer
(setq-local eca-chat--closed t))
(kill-buffer buffer)))))))

;;; eca-chat-test.el ends here
Loading