Skip to content

fix: preserve reasoning in short-term memory replay - #30

Open
MackDing wants to merge 2 commits into
cosmicstack-labs:mainfrom
MackDing:fix/issue-24-reasoning-memory
Open

fix: preserve reasoning in short-term memory replay#30
MackDing wants to merge 2 commits into
cosmicstack-labs:mainfrom
MackDing:fix/issue-24-reasoning-memory

Conversation

@MackDing

@MackDing MackDing commented May 1, 2026

Copy link
Copy Markdown

Summary

  • replay assistant short-term memory with reasoning parts when available
  • keep plain assistant text replay unchanged when no reasoning exists
  • test the actual replay helper rather than a duplicated test-only implementation

Why

Issue #24 reports provider failure: The reasoning_content in the thinking mode must be passed back to the API. The agent already stores result.reasoning, but replaying short-term memory previously sent only assistant text back to the model. Providers that require prior thinking content can reject the next turn when that context is dropped.

Relationship to #29

#29 enables thinking for DeepSeek models routed through OpenAI-compatible providers. This PR is complementary: it replays captured reasoning on later turns. The two PRs cover different stages and are not duplicates.

Validation

  • npm run typecheck
  • npm test (69 tests passed)
  • npm run build

Closes #24

@MackDing

Copy link
Copy Markdown
Author

Quick follow-up: this PR appears mergeable from my side, and I do not see a failing required check. Happy to make any maintainer-preferred tweak if needed.

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.

All LLM providers failed. Last error: The reasoning_content in the thinking mode must be passed back to the API.

1 participant