[PR #3021] [MERGED] [codex] Fix export reasoning and tool guardrails #5787

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

📋 Pull Request Information

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

Base: staging ← Head: codex/include-reasoning-export-toggle


📝 Commits (1)

  • 62830e9 Fix export reasoning and tool guardrails

📊 Changes

12 files changed (+195 additions, -69 deletions)

View changed files

📝 .env.example (+2 -0)
📝 CHANGELOG.md (+4 -0)
📝 docs/CONFIGURATION.md (+1 -1)
📝 packages/client/src/components/agents/ToolEditor.tsx (+3 -3)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+8 -0)
📝 packages/client/src/hooks/use-chats.ts (+9 -2)
📝 packages/client/src/stores/ui.store.ts (+13 -1)
📝 packages/server/src/routes/chats.routes.ts (+64 -17)
📝 packages/server/src/routes/custom-tools.routes.ts (+1 -1)
📝 packages/server/src/routes/generate.routes.ts (+70 -24)
📝 packages/server/src/services/generation/tool-resolution-runtime.ts (+2 -1)
📝 packages/server/src/services/tools/tool-executor.ts (+18 -19)

📄 Description

Linked issue

Closes #3019
Closes #3020

Why this change

  • Users need exported chats to omit hidden reasoning by default, while preserving an explicit opt-in for debugging/archival exports.
  • Roleplay smart group continuation should not leave empty chats or fail when selector output is empty.
  • Script custom tools must not receive host-realm intrinsics that can expose server globals.
  • Spotify tools stripped from provider prompts when Spotify is unavailable should also be denied by the runtime allow-list.

What changed

  • Added an Advanced > Message Tools setting for including reasoning in exports, defaulting off, and wired JSON/JSONL export paths through it.
  • Hardened custom script tool execution with JSON handoff into an in-process VM realm and clarified trusted-script wording in docs/UI/env examples.
  • Made Roleplay smart group response selection fall back to a valid character and clean up incomplete auto-created DM chats.
  • Recomputed chat tool allow-lists after unavailable Spotify tools are removed from the provider tool set.
  • Updated CHANGELOG.md for v2.0.7.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • pnpm check passed locally on this branch.
  • Targeted runtime probe confirmed unavailable Spotify strips spotify_play from both provider tool definitions and chatResolvedToolNames.
  • Targeted script-tool exploit probe confirmed String.constructor("return this.process")() and ({}).constructor.constructor("return this.process")() do not expose process.
  • Manual browser verification not performed in this pass.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

  • Not applicable; server/export/settings wiring changes, no screenshot captured.

Summary by CodeRabbit

  • New Features

    • Added an export setting to include hidden reasoning in chat exports.
    • Exported chat files can now optionally include reasoning content.
  • Bug Fixes

    • Improved chat export handling to avoid duplicated hidden reasoning and stale data.
    • Group chat responses now fall back more reliably when selection fails.
    • Empty roleplay DM chats are cleaned up automatically.
    • Custom script tool messaging was clarified for trusted use only.

🔄 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/3021 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 6/29/2026 **Status:** ✅ Merged **Merged:** 6/29/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/include-reasoning-export-toggle` --- ### 📝 Commits (1) - [`62830e9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/62830e9e08735a283a07027c90539206e0ee4db3) Fix export reasoning and tool guardrails ### 📊 Changes **12 files changed** (+195 additions, -69 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+2 -0) 📝 `CHANGELOG.md` (+4 -0) 📝 `docs/CONFIGURATION.md` (+1 -1) 📝 `packages/client/src/components/agents/ToolEditor.tsx` (+3 -3) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+8 -0) 📝 `packages/client/src/hooks/use-chats.ts` (+9 -2) 📝 `packages/client/src/stores/ui.store.ts` (+13 -1) 📝 `packages/server/src/routes/chats.routes.ts` (+64 -17) 📝 `packages/server/src/routes/custom-tools.routes.ts` (+1 -1) 📝 `packages/server/src/routes/generate.routes.ts` (+70 -24) 📝 `packages/server/src/services/generation/tool-resolution-runtime.ts` (+2 -1) 📝 `packages/server/src/services/tools/tool-executor.ts` (+18 -19) </details> ### 📄 Description ## Linked issue Closes #3019 Closes #3020 ## Why this change - Users need exported chats to omit hidden reasoning by default, while preserving an explicit opt-in for debugging/archival exports. - Roleplay smart group continuation should not leave empty chats or fail when selector output is empty. - Script custom tools must not receive host-realm intrinsics that can expose server globals. - Spotify tools stripped from provider prompts when Spotify is unavailable should also be denied by the runtime allow-list. ## What changed - Added an Advanced > Message Tools setting for including reasoning in exports, defaulting off, and wired JSON/JSONL export paths through it. - Hardened custom script tool execution with JSON handoff into an in-process VM realm and clarified trusted-script wording in docs/UI/env examples. - Made Roleplay smart group response selection fall back to a valid character and clean up incomplete auto-created DM chats. - Recomputed chat tool allow-lists after unavailable Spotify tools are removed from the provider tool set. - Updated CHANGELOG.md for v2.0.7. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `pnpm check` passed locally on this branch. - Targeted runtime probe confirmed unavailable Spotify strips `spotify_play` from both provider tool definitions and `chatResolvedToolNames`. - Targeted script-tool exploit probe confirmed `String.constructor("return this.process")()` and `({}).constructor.constructor("return this.process")()` do not expose `process`. - Manual browser verification not performed in this pass. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) - Not applicable; server/export/settings wiring changes, no screenshot captured. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added an export setting to include hidden reasoning in chat exports. * Exported chat files can now optionally include reasoning content. * **Bug Fixes** * Improved chat export handling to avoid duplicated hidden reasoning and stale data. * Group chat responses now fall back more reliably when selection fails. * Empty roleplay DM chats are cleaned up automatically. * Custom script tool messaging was clarified for trusted use only. <!-- 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:19:31 +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#5787
No description provided.