mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #1206] [MERGED] Fix dangling connection deletes #4980
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#4980
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/1206
Author: @cha1latte
Created: 5/25/2026
Status: ✅ Merged
Merged: 5/25/2026
Merged by: @cha1latte
Base:
staging← Head:fix/issue-1129-dangling-connections📝 Commits (2)
003963bFix dangling connection deletesd252c28Address connection delete review feedback📊 Changes
5 files changed (+201 additions, -51 deletions)
View changed files
📝
packages/server/src/routes/connections.routes.ts(+26 -2)📝
packages/server/src/routes/generate.routes.ts(+57 -32)📝
packages/server/src/routes/generate/agent-connection-guards.ts(+15 -1)📝
packages/server/src/routes/generate/retry-agents-route.ts(+30 -16)➕
packages/server/src/services/storage/connection-references.storage.ts(+73 -0)📄 Description
Linked issue
Closes #1129
Why this change
Deleting a connection that is still referenced by agents or chats left dead
connectionIdvalues behind. During generation/retry, those dead agent references could silently fall through to the chat connection, which could route agent calls to a provider the user thought they had moved away from.This is the staging-port equivalent of the behavior already merged to the
refactorbranch in #1130.What changed
agent_configs.connection_idandchats.connection_id.DELETE /api/connections/:idto return409 connection_in_usewith referencing agents/chats unless?force=trueis supplied.connectionIdvalues before deleting the connection.dangling_agent_connectionwarning and skip path in normal generation, smart Response Orchestrator resolution, and retry-agent resolution so missing agent connections no longer silently use the chat connection.Validation
pnpm checkpasses locallyCONTRIBUTING.mdCodex-run proof:
packages\server\node_modules\.bin\tsx.cmd scratch\issue-1129-repro.tsreproduced the bug: delete returned204, connection lookup returned404, and the agent/chat still stored the deleted ID.packages\server\node_modules\.bin\tsx.cmd scratch\issue-1129-repro.ts --expect-fixedpassed: referenced delete returns409 connection_in_use, lists the agent/chat references, and leaves the connection intact.packages\server\node_modules\.bin\tsx.cmd scratch\issue-1129-repro.ts --expect-forcepassed:?force=trueclears the agent/chat references and deletes the connection.packages\server\node_modules\.bin\tsx.cmd scratch\issue-1129-repro.ts --expect-no-refspassed: unreferenced delete still returns204and removes the connection.packages\server\node_modules\.bin\tsx.cmd scratch\issue-1129-runtime-warning.tspassed: retry-agent resolution emitsdangling_agent_connectionand skips the missing-connection agent without emitting anagent_result.pnpm checkpassed locally.pnpm --filter @marinara-engine/server testpassed locally: 51 tests.node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.jsonpassed.Manual verification notes
Docs and release impact
No docs, schema, dependency, version, or release metadata changes.
UI evidence (if applicable)
N/A - backend API/storage/runtime fix with command proof above.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.