[PR #4895] [MERGED] fix(agents): align manual retry resolution #6530

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4895
Author: @Xelvanis
Created: 8/11/2026
Status: ✅ Merged
Merged: 8/11/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/manual-agent-retry-resolution


📝 Commits (5)

  • 8a5e073 fix(agents): align manual retry resolution
  • f923a9d fix(agents): address manual retry review feedback
  • 58adf32 fix(agents): disable Spotify tools for music-off retries
  • b47c3c2 Merge branch 'staging' into fix/manual-agent-retry-resolution
  • a0efa51 Merge branch 'staging' into fix/manual-agent-retry-resolution

📊 Changes

7 files changed (+1209 additions, -760 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 package.json (+2 -1)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+218 -637)
📝 packages/server/src/services/generation/agent-resolution.ts (+62 -67)
📝 packages/server/src/services/generation/spotify-agent-runtime.ts (+2 -0)
📝 packages/server/src/services/generation/tool-resolution-runtime.ts (+100 -55)
➕ scripts/regressions/manual-agent-retry-resolution.regression.ts (+824 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #4894

Why this change

Manual Agent retries used retry-specific copies of settings and tool-resolution policy. That let retries drift from the original generation: current defaults, stored overrides, retired tools, Music-source overlays, context size, custom tools, and permitted built-in tool composition could resolve differently.

What changed

  • Centralized effective Agent settings resolution for normal generation and manual retry.
  • Added an Agent-only entry point to the canonical tool runtime so retry gets the same permitted Agent definitions, context, allowlisting, custom-tool validation, and execution policy without enabling unrelated main-chat tools.
  • Kept retry phase histories, selected target-character/lorebook scope, approvals, Spotify observation/verification/fallback, SSE, persistence, and image behavior intact.
  • Added regression:manual-agent-retry, a provider-free regression covering settings parity, positive and denied tool paths, schema/collision rules, retry context identity, and exact Spotify playback ordering.

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

Agent-run focused checks on the published commit:

  • pnpm regression:manual-agent-retry
  • pnpm regression:agent-runtime
  • pnpm regression:expression-tools
  • pnpm --filter @marinara-engine/server exec tsx ../../scripts/regressions/open-issues.regression.ts
  • pnpm check
  • git diff --check origin/staging...HEAD

All completed successfully. Expected negative-fixture warnings and the repository's existing client circular-chunk/bundle-size warnings appeared.

Manual verification notes

An agent-assisted click-through used a disposable headed Edge session with isolated app data. It seeded a conversation chat with an active custom Agent and an exact-PID-owned loopback OpenAI-compatible connection, then opened Chat Settings → Agents and clicked Re-run Browser Retry Proof on the last message.

The browser sent POST /api/generate/retry-agents with x-marinara-csrf: 1 and received 200 text/event-stream. The fake provider received roll_dice in the Agent-only tool list; after requesting it, the second provider round contained Marinara's executed dice result. The server persisted a successful context_injection run containing Browser retry completed after roll_dice. Zero browser console errors and no failed non-static local requests were observed; two expected warnings identified the disposable default Agent connection.

This is custom-Agent end-to-end integration proof, not the built-in stale-default differential oracle. No external provider/network, live Spotify, container, mobile/theme, or browser error-state test was performed.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened
  • Version/release files updated (only if this PR includes a version bump)

CHANGELOG.md is updated. No user documentation, localization, dependency, or version change is required.

UI evidence (if applicable)

Not applicable: this is a server resolution/runtime change with provider-free regression evidence and no UI changes.

Risk and scope notes

  • The retry route deletes duplicated settings/tool attachment logic in favor of shared production owners; the dedicated regression protects retry-only context and Spotify invariants.
  • No Persona, connection scheduling/routing, prompt-content, provider-selection, image-retry, dependency, localization, or UI behavior is intentionally changed.

Summary by CodeRabbit

  • Bug Fixes

    • Manual Agent retries now consistently apply current generation settings, custom tools, permitted built-in tools, context rules, and character targeting.
    • Spotify retry playback verification and fallback behavior are more reliable, including repeat-state handling.
    • Lorebook permissions and phase-specific tool access are applied consistently during retries.
  • Tests

    • Added comprehensive regression coverage for manual Agent retries, tool access, lorebook behavior, custom tools, and Spotify playback.

🔄 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/4895 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 8/11/2026 **Status:** ✅ Merged **Merged:** 8/11/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/manual-agent-retry-resolution` --- ### 📝 Commits (5) - [`8a5e073`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8a5e073ce9ff878998bfbd964025c9f3bf1dcfb2) fix(agents): align manual retry resolution - [`f923a9d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f923a9d623ed7406a2d62c15543b439803e74aa2) fix(agents): address manual retry review feedback - [`58adf32`](https://github.com/Pasta-Devs/Marinara-Engine/commit/58adf323eebe57630d1f885bee0d0b198ca83b47) fix(agents): disable Spotify tools for music-off retries - [`b47c3c2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b47c3c22382df6972fe144bf542aeed2af37e195) Merge branch 'staging' into fix/manual-agent-retry-resolution - [`a0efa51`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a0efa5151b6ad3795138e4a8f3ce7f0166685843) Merge branch 'staging' into fix/manual-agent-retry-resolution ### 📊 Changes **7 files changed** (+1209 additions, -760 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `package.json` (+2 -1) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+218 -637) 📝 `packages/server/src/services/generation/agent-resolution.ts` (+62 -67) 📝 `packages/server/src/services/generation/spotify-agent-runtime.ts` (+2 -0) 📝 `packages/server/src/services/generation/tool-resolution-runtime.ts` (+100 -55) ➕ `scripts/regressions/manual-agent-retry-resolution.regression.ts` (+824 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #4894 ## Why this change Manual Agent retries used retry-specific copies of settings and tool-resolution policy. That let retries drift from the original generation: current defaults, stored overrides, retired tools, Music-source overlays, context size, custom tools, and permitted built-in tool composition could resolve differently. ## What changed - Centralized effective Agent settings resolution for normal generation and manual retry. - Added an Agent-only entry point to the canonical tool runtime so retry gets the same permitted Agent definitions, context, allowlisting, custom-tool validation, and execution policy without enabling unrelated main-chat tools. - Kept retry phase histories, selected target-character/lorebook scope, approvals, Spotify observation/verification/fallback, SSE, persistence, and image behavior intact. - Added `regression:manual-agent-retry`, a provider-free regression covering settings parity, positive and denied tool paths, schema/collision rules, retry context identity, and exact Spotify playback ordering. ## Validation - [x] `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) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` Agent-run focused checks on the published commit: - `pnpm regression:manual-agent-retry` - `pnpm regression:agent-runtime` - `pnpm regression:expression-tools` - `pnpm --filter @marinara-engine/server exec tsx ../../scripts/regressions/open-issues.regression.ts` - `pnpm check` - `git diff --check origin/staging...HEAD` All completed successfully. Expected negative-fixture warnings and the repository's existing client circular-chunk/bundle-size warnings appeared. ### Manual verification notes An agent-assisted click-through used a disposable headed Edge session with isolated app data. It seeded a conversation chat with an active custom Agent and an exact-PID-owned loopback OpenAI-compatible connection, then opened **Chat Settings → Agents** and clicked **Re-run Browser Retry Proof on the last message**. The browser sent `POST /api/generate/retry-agents` with `x-marinara-csrf: 1` and received `200 text/event-stream`. The fake provider received `roll_dice` in the Agent-only tool list; after requesting it, the second provider round contained Marinara's executed dice result. The server persisted a successful `context_injection` run containing `Browser retry completed after roll_dice.` Zero browser console errors and no failed non-static local requests were observed; two expected warnings identified the disposable default Agent connection. This is custom-Agent end-to-end integration proof, not the built-in stale-default differential oracle. No external provider/network, live Spotify, container, mobile/theme, or browser error-state test was performed. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) `CHANGELOG.md` is updated. No user documentation, localization, dependency, or version change is required. ## UI evidence (if applicable) Not applicable: this is a server resolution/runtime change with provider-free regression evidence and no UI changes. ## Risk and scope notes - The retry route deletes duplicated settings/tool attachment logic in favor of shared production owners; the dedicated regression protects retry-only context and Spotify invariants. - No Persona, connection scheduling/routing, prompt-content, provider-selection, image-retry, dependency, localization, or UI behavior is intentionally changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Manual Agent retries now consistently apply current generation settings, custom tools, permitted built-in tools, context rules, and character targeting. * Spotify retry playback verification and fallback behavior are more reliable, including repeat-state handling. * Lorebook permissions and phase-specific tool access are applied consistently during retries. * **Tests** * Added comprehensive regression coverage for manual Agent retries, tool access, lorebook behavior, custom tools, and Spotify playback. <!-- 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:11:17 +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#6530
No description provided.