fix(runner): a terminal process result always persists as valid content - #66
Merged
Conversation
A process can exit with any value the runtime hands back — a raw error, userdata, a coroutine. Persisting such a value as node.result content binds SQL NULL, which poisons the whole completion batch and strands the run as runtime_owner_lost. Anything that is not plain data now persists as its string form.
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.
A node process that dies with a non-plain-data value (a raw error object, userdata, a coroutine) had that value queued verbatim as node.result content. The persist layer binds it as SQL NULL, dataflow_data.content is NOT NULL, and the violation fails the entire completion batch — which is then retained and retried forever, ending in runtime_owner_lost with the run stranded and its error routing never executed.
handle_process_exit now normalizes: strings/numbers/booleans/tables persist as-is, anything else as tostring(), nil falls back to Completed/Failed. Failures therefore persist, error targets route, and downstream retry surfaces see a real failure instead of a stuck run.
Observed in production: an OpenAI 400 (non-retryable) killed an agent process with a raw error value; the run hung indefinitely.
Tests: 963 sqlite suite green (two new cases: non-encodable terminal result, poison table).