[PR #1759] [MERGED] Fix reasoning icon for provider metadata #5265

Closed
opened 2026-10-22 04:14:43 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1759
Author: @cha1latte
Created: 5/31/2026
Status: ✅ Merged
Merged: 5/31/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-1708-reasoning-icon


📝 Commits (1)

  • f4be021 Fix reasoning icon for provider metadata

📊 Changes

5 files changed (+57 additions, -3 deletions)

View changed files

📝 src/features/modes/conversation/components/ConversationMessage.tsx (+6 -2)
📝 src/features/modes/shared/chat-ui/components/ChatMessage.tsx (+2 -1)
📝 src/features/modes/shared/chat-ui/index.ts (+1 -0)
➕ src/features/modes/shared/chat-ui/lib/message-thinking.test.ts (+32 -0)
➕ src/features/modes/shared/chat-ui/lib/message-thinking.ts (+16 -0)

📄 Description

Linked issue

Closes #1708

Why this change

  • Provider reasoning can already be stored on messages as extra.thinking, extra.reasoning_content, or extra.reasoning, but the message action UI only checked extra.thinking. Messages with provider-shaped reasoning metadata could therefore hide the View thoughts action even though the reasoning content was present.

What changed

  • Added a shared readStoredThinking helper that resolves stored reasoning in the existing priority order: app-normalized thinking, provider reasoning_content, then provider reasoning.
  • Updated shared chat/roleplay and conversation message renderers to use the helper for the brain/View thoughts action and modal.
  • Added focused Vitest coverage for app-normalized reasoning, provider reasoning aliases, blank fallback behavior, and non-string negative control.

Refactor impact

Primary owner:

  • shared mode UI

Impact areas reviewed:

  • Shared chat message actions
  • Conversation message actions
  • Existing message extra reasoning fields and active-swipe metadata aliases

Boundary notes:

  • Feature/UI-only change. No engine imports from features, no storage writes, no provider transport changes, no dependency/schema/version changes.
  • The conversation renderer imports the helper through the shared chat-ui public barrel to satisfy package boundaries.

Pressure points touched:

  • Shared mode UI message action rendering.
  • Conversation message action rendering.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • pnpm check passes locally before PR push/handoff, including the unused-code check
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Browser screenshot/recording evidence added when UI/browser state is the claim
  • Remote runtime smoke checked when relevant

Codex-run verification:

  • pnpm test src/features/modes/shared/chat-ui/lib/message-thinking.test.ts
  • pnpm typecheck
  • pnpm check:architecture
  • pnpm check
  • node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json
  • Bunny pass before push: focused diff, clean refactor branch, proof gate passed, pnpm check passed.

Manual verification notes

  • Android/Termux Ollama/Gemma was not available in this environment, so the reporter's exact provider/runtime path was not manually exercised.
  • Browser screenshot evidence was not captured; the core UI condition is covered by the focused metadata reader test and both renderers now consume that helper.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

No browser screenshot attached. The changed path is the message action's stored-reasoning condition, verified by focused unit coverage plus pnpm check.

Summary by CodeRabbit

  • Refactor

    • Improved thinking/reasoning content extraction by centralizing logic into a shared helper that checks multiple field names in priority order, making "View thoughts" and "Model Thoughts" features more robust across different model response formats.
  • Tests

    • Added comprehensive test coverage for the thinking content extraction logic.

🔄 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/1759 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/31/2026 **Status:** ✅ Merged **Merged:** 5/31/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-1708-reasoning-icon` --- ### 📝 Commits (1) - [`f4be021`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f4be021fbc2172038bcd6389de6f3fc60f2db983) Fix reasoning icon for provider metadata ### 📊 Changes **5 files changed** (+57 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/features/modes/conversation/components/ConversationMessage.tsx` (+6 -2) 📝 `src/features/modes/shared/chat-ui/components/ChatMessage.tsx` (+2 -1) 📝 `src/features/modes/shared/chat-ui/index.ts` (+1 -0) ➕ `src/features/modes/shared/chat-ui/lib/message-thinking.test.ts` (+32 -0) ➕ `src/features/modes/shared/chat-ui/lib/message-thinking.ts` (+16 -0) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #1708 ## Why this change - Provider reasoning can already be stored on messages as `extra.thinking`, `extra.reasoning_content`, or `extra.reasoning`, but the message action UI only checked `extra.thinking`. Messages with provider-shaped reasoning metadata could therefore hide the View thoughts action even though the reasoning content was present. ## What changed - Added a shared `readStoredThinking` helper that resolves stored reasoning in the existing priority order: app-normalized `thinking`, provider `reasoning_content`, then provider `reasoning`. - Updated shared chat/roleplay and conversation message renderers to use the helper for the brain/View thoughts action and modal. - Added focused Vitest coverage for app-normalized reasoning, provider reasoning aliases, blank fallback behavior, and non-string negative control. ## Refactor impact Primary owner: - shared mode UI Impact areas reviewed: - Shared chat message actions - Conversation message actions - Existing message extra reasoning fields and active-swipe metadata aliases Boundary notes: - Feature/UI-only change. No engine imports from features, no storage writes, no provider transport changes, no dependency/schema/version changes. - The conversation renderer imports the helper through the shared chat-ui public barrel to satisfy package boundaries. Pressure points touched: - Shared mode UI message action rendering. - Conversation message action rendering. ## Validation - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] `pnpm check` passes locally before PR push/handoff, including the unused-code check - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Browser screenshot/recording evidence added when UI/browser state is the claim - [ ] Remote runtime smoke checked when relevant Codex-run verification: - `pnpm test src/features/modes/shared/chat-ui/lib/message-thinking.test.ts` - `pnpm typecheck` - `pnpm check:architecture` - `pnpm check` - `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` - Bunny pass before push: focused diff, clean refactor branch, proof gate passed, `pnpm check` passed. ### Manual verification notes - Android/Termux Ollama/Gemma was not available in this environment, so the reporter's exact provider/runtime path was not manually exercised. - Browser screenshot evidence was not captured; the core UI condition is covered by the focused metadata reader test and both renderers now consume that helper. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence No browser screenshot attached. The changed path is the message action's stored-reasoning condition, verified by focused unit coverage plus `pnpm check`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Improved thinking/reasoning content extraction by centralizing logic into a shared helper that checks multiple field names in priority order, making "View thoughts" and "Model Thoughts" features more robust across different model response formats. * **Tests** * Added comprehensive test coverage for the thinking content extraction logic. <!-- 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-22 04:14:43 +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#5265
No description provided.