Skip to content

Silent-overflow recovery fails completed submission by continuing from assistant #600

Description

@jgwesterlund

Describe the Bug

With @flue/runtime 2.0.3, a durable submission can settle as failed after it has already produced a complete assistant response and threshold compaction succeeds.

The durable submission error is:

Cannot continue from message role: assistant

Observed event order:

  1. Several model/tool cycles complete successfully.
  2. A final assistant message completes with stopReason: "stop".
  3. Threshold compaction emits a canonical compaction record parented to that assistant message.
  4. A resource snapshot is emitted.
  5. 57 ms later, the submission settles as failed with the error above.

There was no tool or model failure. The completed response used about 38.7k total model tokens. This happened twice in adjacent production submissions.

The agent declares useAgentStart and useResponseFinish, but no useAgentFinish, so no finish-hook continuation was expected.

Possible investigation points in v2.0.3:

I do not have the internal stack trace, so the exact continuation entry point remains unconfirmed.

Expected Behavior

After a successful assistant response and successful threshold compaction, the submission should settle as completed and retain the assistant response. No further model turn should start unless new user/signal/join input exists.

Steps to Reproduce

  1. Use @flue/runtime 2.0.3 with durable Postgres submissions and threshold compaction enabled.
  2. Run a multi-tool conversation until a successful assistant turn crosses the compaction threshold.
  3. Let threshold compaction complete after the assistant's stop response.
  4. Inspect the durable submission settlement.

Observed result: compaction completes, then the submission fails with Cannot continue from message role: assistant.

Environment:

  • @flue/runtime: 2.0.3
  • @flue/postgres: 2.0.3
  • @earendil-works/pi-agent-core: 0.83.0
  • Node.js: 24.x

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions