[PR #1681] [MERGED] Restore generation contract parity #5209

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

📋 Pull Request Information

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

Base: refactor ← Head: codex/refactor-generation-parity


📝 Commits (1)

  • b9a4189 Restore generation contract parity

📊 Changes

8 files changed (+138 additions, -1 deletions)

View changed files

➕ src/engine/contracts/schemas/chat.schema.test.ts (+18 -0)
📝 src/engine/contracts/schemas/chat.schema.ts (+7 -1)
📝 src/engine/contracts/types/chat.ts (+2 -0)
📝 src/engine/generation/main-tool-loop.test.ts (+23 -0)
📝 src/engine/generation/start-generation.test.ts (+25 -0)
📝 src/engine/generation/start-generation.ts (+24 -0)
📝 src/features/runtime/generation/hooks/use-generate.test.ts (+19 -0)
📝 src/features/runtime/generation/hooks/use-generate.ts (+20 -0)

📄 Description



Linked issue

N/A - refactor readiness blocker found during contract/generation parity review.

Why this change

The refactor branch needs to preserve legacy generation contracts where parity is claimed. The review found contract drift around legacy visual_novel chat mode ingress, missing userTimeZone, sequential group generation targeting, and stream tool event handling.

What changed

  • Migrate legacy visual_novel chat mode values to roleplay at schema ingress.
  • Preserve userTimeZone in chat schema/type contracts.
  • Restore sequential individual roleplay group targeting for the next active character while preserving upstream group targeting behavior.
  • Treat stream tool_call and tool_result events as phase/status updates without appending visible chat text.
  • Add focused contract/generation/runtime tests for these parity claims.

Refactor impact

Primary owner:

Engine generation and runtime generation wrapper.

Impact areas reviewed:

  • Chat schema ingress and TypeScript contract.
  • Generation start payload construction.
  • Runtime stream event handling in the shared generation hook.
  • Custom tool/script event test coverage.

Boundary notes:

  • Product behavior remains in src/engine.
  • React hook change is limited to consuming stream event phases and does not own prompt or generation policy.
  • No raw Tauri/HTTP boundary change is included in this lane.

Pressure points touched:

  • src/engine/contracts/schemas/chat.schema.ts
  • src/engine/generation/start-generation.ts
  • src/features/runtime/generation/hooks/use-generate.ts

Validation

  • pnpm check passes locally
  • 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
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Codex-run proof:

  • pnpm check passed in scratch/refactor-lane-worktrees/generation.
  • pnpm exec vitest run src/engine/contracts/schemas/chat.schema.test.ts src/engine/generation/start-generation.test.ts src/features/runtime/generation/hooks/use-generate.test.ts src/engine/generation/main-tool-loop.test.ts passed: 96 tests.
  • pnpm typecheck passed.
  • git diff --check upstream/refactor...HEAD passed.
  • Bunny pre-PR review pass: no blocking findings; remaining risk is manual end-to-end generation parity for smart/manual group orchestration beyond the sequential individual path.

Manual verification notes

  • No live model/provider generation run was performed.
  • Smart/manual group orchestration parity remains outside this focused lane.

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

No docs changes included.

UI evidence

N/A - generation contract/runtime behavior only; no visible UI changes.

Summary by CodeRabbit

Release Notes

  • New Features

    • Auto-character selection for sequential roleplay group conversations
    • Tool execution feedback during message generation
    • Optional timezone field for API requests
  • Improvements

    • Legacy chat mode values now properly migrate to roleplay mode

Review Change Stack


🔄 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/1681 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/30/2026 **Status:** ✅ Merged **Merged:** 5/30/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `codex/refactor-generation-parity` --- ### 📝 Commits (1) - [`b9a4189`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b9a4189993f8dcf18cbd825f59725d4f14c2cd9f) Restore generation contract parity ### 📊 Changes **8 files changed** (+138 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `src/engine/contracts/schemas/chat.schema.test.ts` (+18 -0) 📝 `src/engine/contracts/schemas/chat.schema.ts` (+7 -1) 📝 `src/engine/contracts/types/chat.ts` (+2 -0) 📝 `src/engine/generation/main-tool-loop.test.ts` (+23 -0) 📝 `src/engine/generation/start-generation.test.ts` (+25 -0) 📝 `src/engine/generation/start-generation.ts` (+24 -0) 📝 `src/features/runtime/generation/hooks/use-generate.test.ts` (+19 -0) 📝 `src/features/runtime/generation/hooks/use-generate.ts` (+20 -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 N/A - refactor readiness blocker found during contract/generation parity review. ## Why this change The refactor branch needs to preserve legacy generation contracts where parity is claimed. The review found contract drift around legacy `visual_novel` chat mode ingress, missing `userTimeZone`, sequential group generation targeting, and stream tool event handling. ## What changed - Migrate legacy `visual_novel` chat mode values to `roleplay` at schema ingress. - Preserve `userTimeZone` in chat schema/type contracts. - Restore sequential individual roleplay group targeting for the next active character while preserving upstream group targeting behavior. - Treat stream `tool_call` and `tool_result` events as phase/status updates without appending visible chat text. - Add focused contract/generation/runtime tests for these parity claims. ## Refactor impact Primary owner: Engine generation and runtime generation wrapper. Impact areas reviewed: - Chat schema ingress and TypeScript contract. - Generation start payload construction. - Runtime stream event handling in the shared generation hook. - Custom tool/script event test coverage. Boundary notes: - Product behavior remains in `src/engine`. - React hook change is limited to consuming stream event phases and does not own prompt or generation policy. - No raw Tauri/HTTP boundary change is included in this lane. Pressure points touched: - `src/engine/contracts/schemas/chat.schema.ts` - `src/engine/generation/start-generation.ts` - `src/features/runtime/generation/hooks/use-generate.ts` ## Validation - [ ] `pnpm check` passes locally - [ ] `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 - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant Codex-run proof: - `pnpm check` passed in `scratch/refactor-lane-worktrees/generation`. - `pnpm exec vitest run src/engine/contracts/schemas/chat.schema.test.ts src/engine/generation/start-generation.test.ts src/features/runtime/generation/hooks/use-generate.test.ts src/engine/generation/main-tool-loop.test.ts` passed: 96 tests. - `pnpm typecheck` passed. - `git diff --check upstream/refactor...HEAD` passed. - Bunny pre-PR review pass: no blocking findings; remaining risk is manual end-to-end generation parity for smart/manual group orchestration beyond the sequential individual path. ### Manual verification notes - No live model/provider generation run was performed. - Smart/manual group orchestration parity remains outside this focused lane. ## 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 No docs changes included. ## UI evidence N/A - generation contract/runtime behavior only; no visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Auto-character selection for sequential roleplay group conversations * Tool execution feedback during message generation * Optional timezone field for API requests * **Improvements** * Legacy chat mode values now properly migrate to roleplay mode <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1681?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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:15 +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#5209
No description provided.