Skip to content

[P6.6.1] Add busy_timeout + WAL to core workspace SQLite connections #648

Description

@frankbria

Problem

The core workspace SQLite connections set no busy_timeout and no WAL journaling. Under parallel batch execution, multiple subprocesses write to the same workspace DB concurrently, and server background agent threads add more concurrent writers. With no busy_timeout, a concurrent writer gets an immediate database is locked OperationalError instead of waiting.

The platform_store Database already sets WAL + busy_timeout=5000, so core is inconsistent with the rest of the codebase.

Evidence

  • codeframe/core/workspace.py:839 (get_db_connection) and the other direct sqlite3.connect() calls use bare defaults
  • codeframe/core/conductor.py:2087+ (_execute_task_subprocess) — parallel writers
  • codeframe/ui/routers/tasks_v2.py:716 — server-triggered concurrent agent threads
  • codeframe/platform_store/database.py:78-84 — sets WAL + busy_timeout=5000 (the pattern core should match)

Fix

  • In get_db_connection (and the other direct connects), set PRAGMA busy_timeout and PRAGMA journal_mode=WAL, matching platform_store/database.py.

Acceptance criteria

  • Core workspace connections set busy_timeout and WAL.
  • A concurrency test (parallel writers) no longer raises immediate database is locked.

Source: release-readiness audit 2026-06-13 (backend agent). Top backend fix before parallel batch execution is relied upon in production.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-high-betaHigh priority - should fix before beta for best experiencebugSomething isn't workingphase-6.6Phase 6.6: Backend robustness (post-beta-tag)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions