[PR #4271] [MERGED] fix: improve reasoning, streaming, and agent generation behavior #6313

Closed
opened 2026-10-23 04:09:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4271
Author: @SpicyMarinara
Created: 7/29/2026
Status: ✅ Merged
Merged: 7/29/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/reasoning-summary-smooth-streaming


📝 Commits (5)

  • e091c7a fix expression tracker tool batching
  • 90b6119 improve reasoning and streaming presentation
  • 1cf0adb fix regeneration summary and memory context
  • 2bf0123 fix stale roleplay regression expectation
  • d0234ec address regeneration and typewriter review findings

📊 Changes

15 files changed (+431 additions, -238 deletions)

View changed files

📝 package.json (+3 -1)
📝 packages/client/src/components/noodle/NoodleHome.tsx (+1 -1)
📝 packages/client/src/hooks/use-generate.ts (+26 -64)
📝 packages/client/src/lib/generation-stream-policy.ts (+44 -53)
📝 packages/server/src/routes/generate.routes.ts (+8 -1)
📝 packages/server/src/routes/generate/generate-route-utils.ts (+20 -2)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+5 -1)
📝 packages/server/src/services/generation/memory-recall-context.ts (+7 -1)
📝 packages/server/src/services/llm/providers/openai.provider.ts (+19 -10)
📝 packages/server/src/services/memory-recall.ts (+16 -3)
📝 packages/shared/src/types/agent.ts (+18 -4)
➕ scripts/regressions/expression-tool-retirement.regression.ts (+57 -0)
📝 scripts/regressions/provider-compat.regression.ts (+5 -10)
➕ scripts/regressions/regeneration-context.regression.ts (+159 -0)
📝 scripts/regressions/roleplay-streaming.regression.ts (+43 -87)

📄 Description

Why

Several generation paths were producing degraded or misleading behavior:

  • OpenAI Responses reasoning tokens were consumed without consistently requesting or surfacing a readable reasoning summary.
  • Provider-sized stream bursts made the visible response feel chunky instead of following the configured typewriter speed.
  • Legacy Expression Engine tool settings forced the JSON tracker into a separate tool-capable request.
  • Regeneration leaked the response being replaced back into the prompt through automatic summaries and recalled memory (#4270).
  • NoodleHome retained a stale hook dependency warning.

What changed

  • Always request an automatic OpenAI reasoning summary unless reasoning is explicitly disabled, and collect supported streaming summary events without duplicating text.
  • Drive the visible stream from one grapheme-aware, user-selected characters-per-second clock with a short initial buffer and reduced-motion support.
  • Retire set_expression for Expression Engine, including compatibility normalization for older installed package manifests and saved settings, so it can batch with compatible JSON tracker agents.
  • Exclude structured summary entries that cover a message being regenerated and recompile the prompt-time summary from the remaining entries.
  • Bound memory recall before the regenerated message timestamp so chunks containing the discarded response cannot re-enter the prompt.
  • Add focused regressions for legacy Expression settings, regeneration summary/memory isolation, reasoning summaries, streaming cadence, and tracker batching.
  • Add the missing localizeUi hook dependency and refresh a stale Roleplay source assertion.

The downloadable Expression Engine 1.0.2 package/catalog update is in Pasta-Devs/Marinara-Agents#127.

User impact

Reasoning summaries become available when the provider emits them, streamed text reveals smoothly at the configured rate, and Expression Engine no longer pays for a redundant tool round-trip. Regenerating a message no longer supplies its discarded response to the model as settled summary or memory context.

When one structured summary entry covers many messages including the regenerated one, that entire opaque entry is omitted for the regeneration request. This conservatively loses some summary context for one request rather than leaking the response being replaced; stored summary data is not mutated.

Validation

  • pnpm check
  • pnpm regression:providers
  • pnpm regression:expression-tools
  • pnpm regression:regeneration-context
  • pnpm regression:roleplay
  • git diff --check

Manual verification

  • Manually verify GPT-5.6 reasoning summary appears in the brain panel with streaming enabled.
  • Manually verify streaming speeds 1, 30, 99, and 100 produce the expected smooth/instant reveal behavior.
  • Restart Marinara Engine and manually verify legacy Expression Engine settings batch with World State.
  • Manually verify Music DJ remains a separate tool-capable request.
  • Manually reproduce #4270 and confirm the regenerated assistant message is absent from Chat Summary and Memories prompt blocks.

Closes #4270

Summary by CodeRabbit

  • New Features
    • Streaming text animations now use consistent pacing with reduced-motion support and grapheme-safe reveals.
    • Regeneration-aware context improves both memory recall and roleplay summaries by excluding regenerated content.
    • Retired built-in agent tools are automatically filtered from enabled/default tool settings.
  • Bug Fixes
    • Improved resilience for OpenAI streamed reasoning summaries.
    • Fixed notification “mark as read” reactivity to localization updates.
  • Tests
    • Added/updated regression coverage for streaming pacing, regeneration context handling, retired expression tools, and OpenAI provider compatibility.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4271 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/29/2026 **Status:** ✅ Merged **Merged:** 7/29/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/reasoning-summary-smooth-streaming` --- ### 📝 Commits (5) - [`e091c7a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e091c7ab1eed40a90901b9567fe1167c5f3aac3b) fix expression tracker tool batching - [`90b6119`](https://github.com/Pasta-Devs/Marinara-Engine/commit/90b61192228e90e9523b857659c8a27fc6d4d76e) improve reasoning and streaming presentation - [`1cf0adb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1cf0adb8e7a7786497a8a0961a8aa059a937e0ab) fix regeneration summary and memory context - [`2bf0123`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2bf0123e9c7a856951a086fb786f56e1dae7ae6f) fix stale roleplay regression expectation - [`d0234ec`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d0234ece4fe5d3af684236fe8bd86ce7f82d0a45) address regeneration and typewriter review findings ### 📊 Changes **15 files changed** (+431 additions, -238 deletions) <details> <summary>View changed files</summary> 📝 `package.json` (+3 -1) 📝 `packages/client/src/components/noodle/NoodleHome.tsx` (+1 -1) 📝 `packages/client/src/hooks/use-generate.ts` (+26 -64) 📝 `packages/client/src/lib/generation-stream-policy.ts` (+44 -53) 📝 `packages/server/src/routes/generate.routes.ts` (+8 -1) 📝 `packages/server/src/routes/generate/generate-route-utils.ts` (+20 -2) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+5 -1) 📝 `packages/server/src/services/generation/memory-recall-context.ts` (+7 -1) 📝 `packages/server/src/services/llm/providers/openai.provider.ts` (+19 -10) 📝 `packages/server/src/services/memory-recall.ts` (+16 -3) 📝 `packages/shared/src/types/agent.ts` (+18 -4) ➕ `scripts/regressions/expression-tool-retirement.regression.ts` (+57 -0) 📝 `scripts/regressions/provider-compat.regression.ts` (+5 -10) ➕ `scripts/regressions/regeneration-context.regression.ts` (+159 -0) 📝 `scripts/regressions/roleplay-streaming.regression.ts` (+43 -87) </details> ### 📄 Description ## Why Several generation paths were producing degraded or misleading behavior: - OpenAI Responses reasoning tokens were consumed without consistently requesting or surfacing a readable reasoning summary. - Provider-sized stream bursts made the visible response feel chunky instead of following the configured typewriter speed. - Legacy Expression Engine tool settings forced the JSON tracker into a separate tool-capable request. - Regeneration leaked the response being replaced back into the prompt through automatic summaries and recalled memory (#4270). - `NoodleHome` retained a stale hook dependency warning. ## What changed - Always request an automatic OpenAI reasoning summary unless reasoning is explicitly disabled, and collect supported streaming summary events without duplicating text. - Drive the visible stream from one grapheme-aware, user-selected characters-per-second clock with a short initial buffer and reduced-motion support. - Retire `set_expression` for Expression Engine, including compatibility normalization for older installed package manifests and saved settings, so it can batch with compatible JSON tracker agents. - Exclude structured summary entries that cover a message being regenerated and recompile the prompt-time summary from the remaining entries. - Bound memory recall before the regenerated message timestamp so chunks containing the discarded response cannot re-enter the prompt. - Add focused regressions for legacy Expression settings, regeneration summary/memory isolation, reasoning summaries, streaming cadence, and tracker batching. - Add the missing `localizeUi` hook dependency and refresh a stale Roleplay source assertion. The downloadable Expression Engine `1.0.2` package/catalog update is in Pasta-Devs/Marinara-Agents#127. ## User impact Reasoning summaries become available when the provider emits them, streamed text reveals smoothly at the configured rate, and Expression Engine no longer pays for a redundant tool round-trip. Regenerating a message no longer supplies its discarded response to the model as settled summary or memory context. When one structured summary entry covers many messages including the regenerated one, that entire opaque entry is omitted for the regeneration request. This conservatively loses some summary context for one request rather than leaking the response being replaced; stored summary data is not mutated. ## Validation - `pnpm check` - `pnpm regression:providers` - `pnpm regression:expression-tools` - `pnpm regression:regeneration-context` - `pnpm regression:roleplay` - `git diff --check` ## Manual verification - [ ] Manually verify GPT-5.6 reasoning summary appears in the brain panel with streaming enabled. - [ ] Manually verify streaming speeds 1, 30, 99, and 100 produce the expected smooth/instant reveal behavior. - [ ] Restart Marinara Engine and manually verify legacy Expression Engine settings batch with World State. - [ ] Manually verify Music DJ remains a separate tool-capable request. - [ ] Manually reproduce #4270 and confirm the regenerated assistant message is absent from Chat Summary and Memories prompt blocks. Closes #4270 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Streaming text animations now use consistent pacing with reduced-motion support and grapheme-safe reveals. * Regeneration-aware context improves both memory recall and roleplay summaries by excluding regenerated content. * Retired built-in agent tools are automatically filtered from enabled/default tool settings. * **Bug Fixes** * Improved resilience for OpenAI streamed reasoning summaries. * Fixed notification “mark as read” reactivity to localization updates. * **Tests** * Added/updated regression coverage for streaming pacing, regeneration context handling, retired expression tools, and OpenAI provider compatibility. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:09:13 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6313
No description provided.