Repository navigation
Conversation
…inkFlowLab#502) When the final Conversations.update(finish=...) fails, produce_one() now ends the turn with a localized "reply could not be saved" error (kept beside any earlier runtime error), marks the turn interrupted so run_chain() does not dispatch a queued message behind it, and carries that error through the CancelledError path. Timing ledger writes and agent session release run in separate try blocks so a ledger failure cannot leave the project lease behind. chain.last is reset per turn. Tests: fault-injected finish OSError, lock/authorization failures, runtime + finish failure, queued turn, ledger/release failures, Stop, stream detach and English locale; a TS SSE test and a browser check in assistant_sessions.mjs prove end.error leaves the running state and shows the error with the partial reply. Fixes ThinkFlowLab#502
|
Hi @FayeSpica, could you please rerun the failed browser (isolated) job for #512 when convenient? Our linked GitHub integration receives HTTP 403 when attempting a rerun. The failure is in The Agent-related checks, including browser (assistant) and Python, passed. No unrelated canvas changes or CI-bypass commits have been added to #512. Thanks! |
…al backend fault)
Summary
Fixes #502.
After #381 refactored the assistant into
produce_one()/run_chain(), an unsuccessful final conversation write could still produce an SSEendwitherror: nullandconversation: null. The assistant reply remainedstreamingon disk, while the client saw no persistence error. Because the in-memory Turn status stayedcomplete, the chain could also start the next queued message.This PR fixes the silent false-success terminal state, not the older no-
endbehavior (which was superseded by #381).Changes
Conversations.update(..., finish=...), report a localized reply could not be saved error in the terminal SSE event; preserve a preceding runtime error alongside it.completeTurn asinterruptedso an unsaved reply cannot authorize the next queued Turn.Evidence
The isolated tests use real FastAPI
TestClientand real conversation persistence with a simulated Agent runtime; no paid providers or generation Jobs are invoked.end.error, combined errors, queued execution after an unsaved finish, and lease cleanup; 2/12 existing-behavior checks passed.npm test998 passed.lint-imports(4 contracts),tsc, build, i18n, browser manifest and locale checks passed.assistant_sessions.mjswith the added mocked-SSE regression passed twice.69075066; after584e62c4, the focused race regression passed 20/20 repeated runs and thestop_duringgroup passed 15 repeated runs. The focused regression suite reports 66 passing tests; the broader-m cpurun had two failures also observed on clean main.Boundaries and known limitations
asyncio.to_threadfinish write is fixed in584e62c4. When Stop races the finish write, the code waits for the underlying write's actual outcome without cancelling or retrying the side effect, then finalizes the stop result. A previously recorded runtime error is preserved, and timing/renewal cleanup failures cannot suppress lease release. The regression tests synchronize on cancellation and release the write deterministically.Accept-Languageis carried into its plan.Related work
No real provider calls or project data changes were involved in verification.