emrg: TUI status bar shows current context message count (rant 21:52:18) - #772
Merged
Conversation
The status bar '· N msgs ·' showed the locally-tracked total message count (including compacted history), not the actual messages sent to the LLM. Daemon now reports the authoritative current-context size on every done frame (system + history + user + tool results + assistant replies, rebuilt after auto-compact) via context_messages; TUI uses it instead of the +1 local approximation (falls back to +1 when absent). +1 e2e test asserting context_messages == 5 for a one-round tool flow (system+user+assistant-tool +tool-result+assistant).
argszero
commented
Aug 13, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle (1/3)
Verified head 32442e1 (3 files, +21/-1):
- daemon.py: both final done frames (Case 1 stop @2271, Case 3 max-tokens @2445) now carry
context_messages: len(messages)— authoritative current-LLM-context size (system + history + user + tool results + assistant replies), correctly re-derived after auto-compact rebuild (messages rebuilt @2170). - app.py done handler:
msg_count = int(context_messages)when present, +1 fallback otherwise; status-bar copy unchanged (· N msgs · path). - e2e test: one-round tool flow asserts context_messages == 5 (system + user + assistant-tool_calls + tool-result + final assistant) — matches the actual message flow (initial 2, +assistant_msg@2313, +tool result@2397, +final assistant@2435).
- pytest 801/801 local, CI test + test-windows PASS (run 31708272704).
argszero
commented
Aug 13, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle (2/3)
Re-verified head 32442e1 (unchanged since 1/3):
- Diff vs master 44b09d8 = 3 files +21/-1: daemon.py adds
context_messages: len(messages)to both final done frames (Case 1 stop, Case 3 max-tokens); app.py consumes it with +1 fallback; e2e asserts context_messages == 5 for the one-round tool flow. - No overlap with the #771 GUI merge (daemon/app/test files vs GUI files) — no rebase needed, MERGEABLE.
- CI test + test-windows PASS (run 31708272704).
argszero
commented
Aug 13, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle (2/3, head 32442e1)
Fresh independent verification this cycle:
- daemon.py: BOTH final done frames now carry
context_messages: len(messages)— Case 1 (loop exit @~2277) and Case 3 (max-tokens @~2455) — authoritative current LLM context (system + history + user + tool results + assistant replies), correctly re-derived after auto-compact rebuild. - app.py done handler:
int(context_messages)when present, +1 local fallback otherwise (backward compatible with older daemons); status-bar copy unchanged. - e2e test
test_streaming_task_with_tool_calls: assertscontext_messages == 5(system + user + assistant-tool_calls + tool-result + final assistant) — ran locally: 1 passed. - CI test + test-windows PASS (run 31708272704); branch = 3 files (+21/-1), based on master 44b09d8.
argszero
added a commit
that referenced
this pull request
Aug 13, 2026
GUI settings-title entries (#775)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes host rant
2026-08-13T21:52:18: the TUI status bar· N msgs ·displayed the locally-tracked total message count (including compacted history), which misleads — it should show the number of messages actually sent to the LLM in the current context.Daemon (
emrg/server/daemon.py): everydoneframe now carriescontext_messages: len(messages)— the authoritative current-context size (system + history + user + all tool results + assistant replies; re-derived after auto-compact rebuild). Added to both the Case-1 (stop) and Case-3 (max-tokens) final done frames.TUI (
emrg/client/app.py): the done handler setsmsg_count = context_messageswhen present (daemon-authoritative, reflects tool results and auto-compact), falling back to the local+1approximation otherwise. Status-bar copy unchanged.Test:
test_streaming_task_with_tool_callsextended to assertcontext_messages == 5for a one-round tool flow (system + user + assistant-tool_calls + tool-result + final assistant).Verified: pytest 801/801, import + CLI OK. GUI untouched.