[PR #3879] [MERGED] feat: allow re-running a single custom agent from Chat Settings #6140

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3879
Author: @kh0p
Created: 7/20/2026
Status: ✅ Merged
Merged: 7/20/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/rerun-custom-agent


📝 Commits (2)

  • 9072211 feat: allow re-running a single custom agent from Chat Settings
  • 37773a4 Merge branch 'staging' into feat/rerun-custom-agent

📊 Changes

1 file changed (+22 additions, -0 deletions)

View changed files

📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+22 -0)

📄 Description

Linked issue

Closes #3878

Why this change

Custom agents attached to a chat had no way to be manually re-run on the last message. The retry-agents backend (POST /retry-agents, retry-agents-route.ts) and the client hook useGenerate().retryAgents(chatId, agentTypes, options) are both already fully generic — resolveActiveRetryAgentTypes permits retrying any agent type present in chatMeta.activeAgentIds, built-in or custom. But every existing UI call site hardcoded a specific agent type (["illustrator"] for the Illustrate button, ["lorebook-keeper"] for the Lorebook Keeper's "Backfill Unprocessed" button) or restricted to built-in tracker agents via isBuiltInTrackerAgentType (the per-tracker refresh buttons in the Roleplay HUD panels). Custom agents had no equivalent.

What changed

  • Added handleRerunCustomAgent(agentId) in ChatSettingsDrawer.tsx, calling the existing retryAgents(chat.id, [agentId]).
  • Added a re-run (refresh) icon button next to the existing "Remove from chat" button in the Custom Agents settings card (Chat Settings → Agents → Custom Agents), one per active custom agent. Disabled and spinning while agentProcessing is true, same convention as the Lorebook Keeper backfill button right above it in the same file.
  • No server-side change needed — the backend already supports this.

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

Applied the equivalent change to a local install running an earlier commit on this branch, rebuilt the client, restarted the server, and opened a real chat with 3 active custom agents (an image-prompt agent and two prose/continuity agents). Confirmed the Custom Agents card in Chat Settings renders one re-run button per agent with the correct name in its title/tooltip, and clicking one fires POST /retry-agents with just that agent's type and returns 200, without affecting the other agents or the main assistant message. Disabled/spinner state was verified against the pre-existing agentProcessing flag used identically by the neighboring Lorebook Keeper button in the same file. Because pnpm/Docker aren't set up in this working copy, I did not additionally run pnpm check or a container build against this exact diff — the change is a self-contained 22-line addition reusing only symbols (RefreshCw, cn, agentProcessing, retryAgents, useCallback) already imported and used identically elsewhere in the same file, so no new type or lint surface is introduced.

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)

Summary by CodeRabbit

  • New Features
    • Added a Re-run control for active custom agents in chat settings.
    • Re-run controls are disabled and show a loading indicator while an agent is processing.
    • Existing controls for removing custom agents remain available.

🔄 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/3879 **Author:** [@kh0p](https://github.com/kh0p) **Created:** 7/20/2026 **Status:** ✅ Merged **Merged:** 7/20/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/rerun-custom-agent` --- ### 📝 Commits (2) - [`9072211`](https://github.com/Pasta-Devs/Marinara-Engine/commit/90722118dd00f97be018b05826f1471be4029f5b) feat: allow re-running a single custom agent from Chat Settings - [`37773a4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/37773a469f2c10a15e93cf850ce1d47b37e3d794) Merge branch 'staging' into feat/rerun-custom-agent ### 📊 Changes **1 file changed** (+22 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+22 -0) </details> ### 📄 Description ## Linked issue Closes #3878 ## Why this change Custom agents attached to a chat had no way to be manually re-run on the last message. The retry-agents backend (`POST /retry-agents`, `retry-agents-route.ts`) and the client hook `useGenerate().retryAgents(chatId, agentTypes, options)` are both already fully generic — `resolveActiveRetryAgentTypes` permits retrying any agent type present in `chatMeta.activeAgentIds`, built-in or custom. But every existing UI call site hardcoded a specific agent type (`["illustrator"]` for the Illustrate button, `["lorebook-keeper"]` for the Lorebook Keeper's "Backfill Unprocessed" button) or restricted to built-in tracker agents via `isBuiltInTrackerAgentType` (the per-tracker refresh buttons in the Roleplay HUD panels). Custom agents had no equivalent. ## What changed - Added `handleRerunCustomAgent(agentId)` in `ChatSettingsDrawer.tsx`, calling the existing `retryAgents(chat.id, [agentId])`. - Added a re-run (refresh) icon button next to the existing "Remove from chat" button in the Custom Agents settings card (Chat Settings → Agents → Custom Agents), one per active custom agent. Disabled and spinning while `agentProcessing` is true, same convention as the Lorebook Keeper backfill button right above it in the same file. - No server-side change needed — the backend already supports this. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] 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` ### Manual verification notes Applied the equivalent change to a local install running an earlier commit on this branch, rebuilt the client, restarted the server, and opened a real chat with 3 active custom agents (an image-prompt agent and two prose/continuity agents). Confirmed the Custom Agents card in Chat Settings renders one re-run button per agent with the correct name in its title/tooltip, and clicking one fires `POST /retry-agents` with just that agent's type and returns 200, without affecting the other agents or the main assistant message. Disabled/spinner state was verified against the pre-existing `agentProcessing` flag used identically by the neighboring Lorebook Keeper button in the same file. Because `pnpm`/Docker aren't set up in this working copy, I did not additionally run `pnpm check` or a container build against this exact diff — the change is a self-contained 22-line addition reusing only symbols (`RefreshCw`, `cn`, `agentProcessing`, `retryAgents`, `useCallback`) already imported and used identically elsewhere in the same file, so no new type or lint surface is introduced. ## Docs and release impact - [x] 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) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a **Re-run** control for active custom agents in chat settings. * Re-run controls are disabled and show a loading indicator while an agent is processing. * Existing controls for removing custom agents remain available. <!-- 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:07:27 +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#6140
No description provided.