Skip to content

chore(core): Add comprehensive tests for historical logs in ConversationHistory#1957

Open
yuyutaotao wants to merge 9 commits intomainfrom
claude/test-conversation-history-FdKE2
Open

chore(core): Add comprehensive tests for historical logs in ConversationHistory#1957
yuyutaotao wants to merge 9 commits intomainfrom
claude/test-conversation-history-FdKE2

Conversation

@yuyutaotao
Copy link
Collaborator

Summary

This PR adds comprehensive unit tests for the historical logs functionality in the ConversationHistory class, ensuring that historical logs are properly managed across various operations and lifecycle events.

Key Changes

  • seed() behavior: Added test to verify that seed() clears historical logs while resetting conversation state
  • compressHistory() isolation: Added test confirming that message compression does not affect historical logs
  • clearMemories() isolation: Added test verifying that clearing memories preserves historical logs
  • Sub-goal operations: Added test ensuring historical logs persist through setSubGoals(), markSubGoalFinished(), and markAllSubGoalsFinished() operations
  • Formatting validation: Added test for correct formatting of historical logs output with single and multiple entries

Notable Details

  • Tests use toMatchInlineSnapshot() to validate the exact formatting of historical logs output
  • Tests verify that historical logs remain intact across multiple types of operations, ensuring proper separation of concerns
  • Coverage includes edge cases like single log entries and operations that might inadvertently clear logs

https://claude.ai/code/session_01MP3Z6qMfZC2Ry6PssDDBzo

claude and others added 9 commits February 5, 2026 15:40
Add a logs field to SubGoal that accumulates the Planning log entries
while a sub-goal is running. Logs are cleared whenever the sub-goal's
status or description changes. The subGoalsToText() output now includes
"Actions performed for current sub-goal" so the AI has context on what
has already been done for the active sub-goal.

https://claude.ai/code/session_01QiNtUTmr6VYZGRxnd5QyST
…l logs

Update the multi-turn conversation example to show the new "Actions
performed for current sub-goal" section in user messages. Also fix the
example to consistently show all 3 sub-goals from Turn 2 onwards.

https://claude.ai/code/session_01QiNtUTmr6VYZGRxnd5QyST
* fix(core): set default imagesIncludeCount to 1 for non-deepThink mode

Previously both deepThink and non-deepThink modes defaulted to 2 images
in snapshot. Now non-deepThink defaults to 1, deepThink defaults to 2,
and explicit values are respected.

https://claude.ai/code/session_01K75mH3NGX6zxN5oH4A3G2a

* fix(core): set imagesIncludeCount explicitly at call site, remove fallback

Set deepThink ? 2 : 1 in agent.ts so the default is clear at the source.
Remove ?? 2 fallback in llm-planning.ts to avoid hidden defaults.

https://claude.ai/code/session_01K75mH3NGX6zxN5oH4A3G2a

* fix(core): remove unnecessary undefined from imagesIncludeCount type

The value is always a number now (deepThink ? 2 : 1), so the union
type with undefined is no longer needed.

https://claude.ai/code/session_01K75mH3NGX6zxN5oH4A3G2a

---------

Co-authored-by: Claude <noreply@anthropic.com>
…#1953)

reset() only cleared messages but left memories and subGoals intact,
causing state to leak between separate .aiAct() calls on the same agent.

https://claude.ai/code/session_01LfiNcU6BXtsmRKJUGx54yj

Co-authored-by: Claude <noreply@anthropic.com>
In non-deepThink mode, accumulate planning logs across rounds and
present them to the model as "Here are the steps that have been
executed" so it has context about previously performed actions.

https://claude.ai/code/session_01JzXg46QwwCSq16L8DKR2nQ

Co-authored-by: Claude <noreply@anthropic.com>
…calLogs

Cover edge cases: seed() clearing logs, compressHistory preserving logs,
clearMemories not affecting logs, logs persisting through sub-goal
lifecycle, and single-entry formatting.

https://claude.ai/code/session_01MP3Z6qMfZC2Ry6PssDDBzo
Base automatically changed from claude/track-subgoal-logs-2O5eI to main February 6, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants