Skip to content

SQLite sub-session persistence can fail on an existing child session row #4881

Closed

Description

@aheritier

Problem

In a prior run on Docker Agent dev build bbe70f53 (source checked at 80bcd769), 62 sub-session database rows were observed with zero items and $0 recorded cost/usage. Logs reported Failed to persist sub-session with a SQLite UNIQUE constraint error. This is an observation, not a reproduced minimal case, and the full $80 estimated session cost was not independently measured; do not treat that figure as measured loss.

At source revision 80bcd769, SQLiteSessionStore.AddSubSession calls addSessionTx to insert the child row. A plausible diagnosis is that this attempts to insert a session row that already exists, causing the uniqueness failure and transaction rollback. This needs reproduction and confirmation by maintainers.

Related but distinct: #1738 and #2053 concern sub-agent streaming/session-history corruption, not this reported failure to persist child transcript and usage.

Reproduction to investigate

  1. Run a multi-agent setup that invokes transfer_task with persistent SQLite sessions.
  2. Exercise a child session that already has a persisted row before the parent attempts to add/link it (or otherwise reproduce the duplicate insert path).
  3. Inspect the resulting child session and persistence error.

Observed exact error class: SQLite UNIQUE constraint while logging Failed to persist sub-session; the specific constraint and a minimal reproducible sequence have not been independently verified. No transcript content, local paths, credentials, or raw logs are included.

Expected

Sub-session persistence should retain the child transcript and cost/usage and associate the child with its parent, without losing data on an insert/link failure.

Actual observation

The observed rows had no persisted items or usage, alongside the logged uniqueness failure.

Environment / limitations

  • Docker Agent dev build: bbe70f53
  • Source inspected: 80bcd769
  • macOS arm64
  • Based on one prior-session observation; exact SQLite constraint and minimal reproduction remain unverified.

Please add a focused store/runtime regression test for an existing child row and verify atomic linking and transcript/usage persistence.

Activity

  1. added
    area/sessions
    area/runtime
    on Nov 9, 2026
  2. added theissue type on Nov 9, 2026
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

    area/runtimearea/sessions

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions