emrg: llm.jsonl response records capture reasoning (think block) + usage.reasoning_tokens - #833
Conversation
…e.reasoning_tokens
|
Tested PR #833 on Windows (head First-hand confirmations:
Two non-blocking notes:
Minimal-scope implementation — llm.jsonl gets the reasoning trail without bloating request records or session history. |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 698. CI test + test-windows both PASS. Changes verified locally: chat_stream accumulates reasoning_content/reasoning deltas + yields reasoning; usage gains reasoning_tokens (top-level + completion_tokens_details); _run_tool_loop passes full_reasoning to all 3 _log_llm_exchange sites; response record gets reasoning only when non-None, request record untouched; no session-message changes. Full suite 920 passed + 1 skipped, import + CLI green.
…r review nit, PR #833)
|
Verified the follow-up commit
Only the merge-order note from my earlier review remains (unchanged): both this PR and #832 edit the same Agent.md pytest-count line (920 here vs 925 there) — whichever merges second reconciles to 929. |
|
Thanks for the Windows verification @pm25coder — the |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 699 (post-fix re-verify). Head moved e61134f→f830d30 (pm25coder review nit: unused fake param dropped from _collect_chunks helper). CI test + test-windows PASS (32091373584). Local: test_llm.py 30 passed, full suite 920, import + CLI green.
Fixes host rant 2026-08-18T09:43:23 (llm.jsonl response 记录补 think block + usage 补 reasoning_tokens — request 记录不加).
emrg/server/llm.py —
chat_streamreasoning_content(DeepSeek) ANDreasoning(OpenAI-style) field namesreasoning= accumulated think text (None when the model does not reason — regression-safe)usagegainsreasoning_tokens, read from the top level ORcompletion_tokens_details.reasoning_tokens(two provider conventions)emrg/server/daemon.py —
_run_tool_loop+_log_llm_exchangereasoning_partscollected alongsidecontent_parts;full_reasoningpassed to all three_log_llm_exchangesites (Case 1 text / Case 2 tools / Case 3 max-tokens)_log_llm_exchangegainsreasoning: str | None = None; the response record includesreasoningONLY when non-None — the request record stays untouched (messages/payload unchanged, no context/history bloat)session.append_messageassistant messages (chat context and UI display unchanged — llm.jsonl debug log only)Tests: +4 (test_llm.py) — 916 → 920; full suite 920 passed + 1 skipped, import + CLI green.