[PR #2815] [CLOSED] Stabilize Professor Mari JSON command runtime #5747

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2815
Author: @ghost
Created: 6/23/2026
Status: ❌ Closed

Base: main ← Head: codex/professor-mari-json-protocol-repair


📝 Commits (2)

  • 204717b Repair Professor Mari JSON command protocol history
  • 61f9e66 Merge branch 'main' into codex/professor-mari-json-protocol-repair

📊 Changes

1 file changed (+147 additions, -71 deletions)

View changed files

📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+147 -71)

📄 Description

Summary

Stabilizes Professor Mari workspace command mode so it stays provider-agnostic, JSON-only, and resilient across multi-round workspace tasks.

What changed

  • Removes model-facing native tool/function-call protocol from Professor Mari workspace behavior.
  • Uses a strict JSON-only assistant schema:
    {"say":"...","commands":[],"stop":true}                                                                                                                                
    
                                                                                                                                                                           
- Keeps user-visible text inside say; no prose, markdown, XML, or code fences outside JSON.                                                                                
- Adds stop handling so stop:false continues workspace loops and stop:true finalizes.                                                                                      
- Parses/removes multiple JSON action frames safely.                                                                                                                       
- Ignores prose outside valid JSON frames as protocol leakage.                                                                                                             
- Keeps tolerant internal parsing for older aliases/formats without teaching those formats in the prompt.                                                                  
- Repairs non-JSON/no-command replies instead of immediately stopping Professor Mari.                                                                                      
- Preserves hidden assistant history as normalized JSON so later model turns do not learn from plain prose assistant examples.                                             
- Wraps stored Professor Mari assistant messages as JSON when replaying them into model context.                                                                           
- Keeps Professor Mari’s voice/personality and concise app-data command guidance.                                                                                          
                                                                                                                                                                           
Why                                                                                                                                                                        
                                                                                                                                                                           
Professor Mari could drift into plain prose during longer workspace tasks, especially after command results. Since the runtime previously replayed only visible say text   
into assistant history, later model turns saw plain-prose assistant examples and became more likely to stop emitting JSON. This caused long jobs like bulk lorebook        
creation to stop early.                                                                                                                                                    
                                                                                                                                                                           
This change keeps the protocol consistent across turns and avoids relying on provider-native tool/function calling.                                                        
                                                                                                                                                                           
Validation                                                                                                                                                                 
                                                                                                                                                                           
- pnpm --filter @marinara-engine/server lint                                                                                                                               
- pnpm check                                                                                                                                                               
                                                                                                                                                                           
Note: validation emitted the existing Node engine warning for Node v22 vs required >=24 <26.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Bug Fixes**
 * Enhanced reliability of workspace command parsing and protocol validation.
 * Improved error recovery when unexpected response formats are encountered.
 * Better preservation and reconstruction of conversation history across turns.

<!-- 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>
## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2815 **Author:** [@ghost](https://github.com/ghost) **Created:** 6/23/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/professor-mari-json-protocol-repair` --- ### 📝 Commits (2) - [`204717b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/204717b41ea03c8827f1ba54a8f4f8a6442c65d5) Repair Professor Mari JSON command protocol history - [`61f9e66`](https://github.com/Pasta-Devs/Marinara-Engine/commit/61f9e668e6f43aed7bc999dc2321156a1649cbf4) Merge branch 'main' into codex/professor-mari-json-protocol-repair ### 📊 Changes **1 file changed** (+147 additions, -71 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+147 -71) </details> ### 📄 Description # Summary Stabilizes Professor Mari workspace command mode so it stays provider-agnostic, JSON-only, and resilient across multi-round workspace tasks. ## What changed - Removes model-facing native tool/function-call protocol from Professor Mari workspace behavior. - Uses a strict JSON-only assistant schema: ```json {"say":"...","commands":[],"stop":true} ``` - Keeps user-visible text inside say; no prose, markdown, XML, or code fences outside JSON. - Adds stop handling so stop:false continues workspace loops and stop:true finalizes. - Parses/removes multiple JSON action frames safely. - Ignores prose outside valid JSON frames as protocol leakage. - Keeps tolerant internal parsing for older aliases/formats without teaching those formats in the prompt. - Repairs non-JSON/no-command replies instead of immediately stopping Professor Mari. - Preserves hidden assistant history as normalized JSON so later model turns do not learn from plain prose assistant examples. - Wraps stored Professor Mari assistant messages as JSON when replaying them into model context. - Keeps Professor Mari’s voice/personality and concise app-data command guidance. Why Professor Mari could drift into plain prose during longer workspace tasks, especially after command results. Since the runtime previously replayed only visible say text into assistant history, later model turns saw plain-prose assistant examples and became more likely to stop emitting JSON. This caused long jobs like bulk lorebook creation to stop early. This change keeps the protocol consistent across turns and avoids relying on provider-native tool/function calling. Validation - pnpm --filter @marinara-engine/server lint - pnpm check Note: validation emitted the existing Node engine warning for Node v22 vs required >=24 <26. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Enhanced reliability of workspace command parsing and protocol validation. * Improved error recovery when unexpected response formats are encountered. * Better preservation and reconstruction of conversation history across turns. <!-- 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:09 +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#5747
No description provided.