mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #4686] [MERGED] feat(agents): per-chat image connection override + snapshot button for custom image agents #6470
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6470
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4686
Author: @kolacheee
Created: 8/6/2026
Status: ✅ Merged
Merged: 8/7/2026
Merged by: @kolacheee
Base:
staging← Head:feat/4682-custom-agent-image-qol📝 Commits (7)
a61d858feat(agents): per-chat image connection override + snapshot button for custom image agentsaa8defbMerge branch 'staging' into feat/4682-custom-agent-image-qol48f7596fix(agents): scope forced-image directive to single-agent retries765d919fix(agents): reject multi-agent forceImageGeneration requests at the route boundary4c7597efix(agents): attribute snapshot failures to the running agent + surface promptless successes2adefc5fix(agents): restrict forced snapshots to image-capable custom agents9e09166Merge branch 'staging' into feat/4682-custom-agent-image-qol📊 Changes
12 files changed (+390 additions, -7 deletions)
View changed files
📝
docs/agents/custom-agents.md(+7 -0)📝
packages/client/src/components/chat/ChatSettingsDrawer.tsx(+111 -0)📝
packages/client/src/hooks/use-generate.ts(+3 -0)📝
packages/client/src/localization/locales/en.json(+1 -0)📝
packages/server/src/routes/capability-packages.routes.ts(+1 -1)📝
packages/server/src/routes/generate/retry-agents-route.ts(+92 -5)📝
packages/server/src/services/agents/agent-executor.ts(+12 -0)📝
packages/server/src/services/generation/agent-resolution.ts(+2 -0)➕
packages/server/src/services/generation/custom-agent-image-settings.ts(+84 -0)📝
packages/server/src/services/storage/chat-presets.storage.ts(+6 -1)📝
packages/shared/src/types/chat.ts(+3 -0)📝
scripts/regressions/prompt.regression.ts(+68 -0)📄 Description
Linked issue
Closes #4682
Why this change
Custom agents that generate images can't be tuned per-chat the way the vanilla Illustrator can — the only workaround is duplicating the agent once per style/connection combo. #4682's investigation found per-chat prompt template and image style already apply to custom agents; this PR closes the two real gaps: a per-chat image connection override and an on-demand snapshot button (generate now, no activation keywords).
What changed
Per-chat image connection override
ChatMetadata.customAgentImageSettings?: Partial<Record<agentType, { imageConnectionId }>>(shared). The inner key deliberately ends inConnectionId: the existing dangling-connection sweeper prunes any such key at any depth (its module comment anticipates exactly this map shape), so deleted connections need zero new cleanup code.applyCustomAgentImageChatSettingshelper (mirrorsapplyKnowledgeAgentChatSettings; no-ops for built-in agent types), chained at both custom-agent settings-merge sites (agent-resolution.ts,retry-agents-route.ts) — bothimage_prompthandlers read resolved settings, so they're untouched and the override inherits the existing missing-connection warning + default-Images fallback.Snapshot button
retryAgents(chatId, [agentId], { forceImageGeneration: true }).<manual_image_request>directive into the agent prompt — mirroring the Illustrator's manual-request block — so the agent knows the user explicitly asked and shouldn't decline; (b) forcesshouldGenerateon that agent'simage_promptresult, scoped via!usesChatIllustratorSettingsso the vanilla Illustrator path is untouched; (c) bypasses review-before-send for forced snapshots (the camera press is the explicit request, and the review approval round-trip only supports the vanilla Illustrator); (d) emits anagent_errorif the forced agent still returns no prompt, so the button never silently no-ops.Docs: new "Per-chat controls for image agents" section in
docs/agents/custom-agents.md. A[docs-i18n]follow-up issue will be opened for the language packs.Pre-PR adversarial review: a multi-lens review of this diff found 3 real issues before submission — review-mode breaking/rerouting forced snapshots, the force being post-hoc only (silent no-op on declined prompts), and stale overrides after agent removal. All three are fixed in this PR and re-verified; the review also confirmed no third settings-resolution path bypasses the override.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated/scripted checks already performed (green):
pnpm check(lint + production build) — passes, run twice (after implementation and after review fixes)node dist, disposable test agent + dummy connection, cleaned up after):customAgentImageSettings: { "<agentType>": { imageConnectionId } }in chat metadata; Agent default reset deletes the entryPOST /generate/retry-agentswithagentTypes: ["<that agent>"]andforceImageGeneration: trueStill to verify manually in a real browser (please tick above once done):
Docs and release impact
docs/agents/custom-agents.mdupdated in this PR;[docs-i18n]follow-up to be filed for translated packs. No version bump.Summary by CodeRabbit
New Features
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.