mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2999] [Issue]: listCustomRunsForChat truncates to a fixed 200-row window of ALL agent runs before filtering out built-ins, hiding custom outputs #1573
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#1573
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?
Originally created by @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2999
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
listCustomRunsForChatfetches the 200 most-recent successful runs (built-in AND custom), THEN filters out built-ins, THEN slices to the requested limit. In a chat where built-in agents run every turn, the 200-row window can be entirely consumed by built-in runs, pushing older custom-agent runs outside the window. Those custom runs are then never returned even though the requested limit (default 50) was not reached. Since this endpoint backs the UI for viewing/editing custom-agent outputs, the user loses access to editable custom outputs that still exist in the DB.How to reproduce (try it yourself)
You'll see: older custom-agent runs that fall outside the most-recent-200 mixed window are omitted from the response despite being well under the limit of 50.
Expected: up to
limitcustom runs are returned regardless of how many built-in runs precede them.Where it is
packages/server/src/services/storage/agents.storage.ts:367-382(listCustomRunsForChat).What's happening
The 200-row LIMIT is applied to the unfiltered mixed result set; the built-in filter and final slice happen in JS afterward, so a burst of built-in runs evicts custom runs before they are ever considered.
Suggested fix
Keep the JS-side built-in filter (it works on both storage backends) but remove the premature SQL row cap so the cap is applied AFTER filtering, with an early break once enough custom rows are collected:
Regression avoided: do NOT exclude built-ins via SQL
NOT IN/notInArray(the primary suggested fix) — the project's DEFAULT storage backend is a custom file-native query emulator whose WHERE evaluator does not implementnot in, so the clause would silently fail to filter and the "custom" list would leak built-in runs (which the PATCH /runs/:runId endpoint then 403-rejects). The JS-filter-after-cap approach is backend-agnostic, and the unbounded per-chat scan it introduces already exists as an accepted pattern in the same file (getEchoMessages), bounded by the early break.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in merged staging PR #3004.