fix(cron): invert stateless gate to match UI label#1139
Open
codebit0 wants to merge 1 commit into
Open
Conversation
The cron job handler reset the session when stateless=false and skipped reset when stateless=true — the opposite of what every UI locale labels the field (en/ko/zh/vi all describe stateless as "each run starts fresh without loading previous messages"). The buggy gate caused stateless=true crons to silently accumulate session history across every execution, leading to context bloat and increasing the chance of LLMs short-circuiting tool calls in favor of replaying prior assistant turns. One affected daily ETL cron grew to 38 messages over 18 days before the regression was noticed. Fix: gate the Reset on `if job.Stateless` so the runtime matches the UI contract. No DB migration is required — existing values were set by users based on the UI label, so they already encode the intended behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stateless=falseand skipped reset whenstateless=true— the opposite of every UI locale's label (en/ko/zh/vi all say "each run starts fresh without loading previous messages").cmd/gateway_cron.go(if !job.Stateless→if job.Stateless) so runtime matches the UI contract. Comment block reworded for clarity.Impact
A daily ETL cron with
stateless=truewas observed accumulating 38 messages over 18 days, causing the LLM to short-circuit tool calls and replay prior assistant turns (silent ETL failure — cron reported `status=ok` while DB rows were never written).After the fix:
stateless=true→ session reset every run (matches UI label, intended for ETL/one-shot jobs)stateless=false→ session preserved across runs (multi-run dialog crons)Test plan