Skip to content

Compaction: Concurrency/locking robustness and retries #53

@riatzukiza

Description

@riatzukiza

Epic: #46

Summary

Harden compaction concurrency/locking and retry behavior to avoid race conditions and partial writes.

Problem

  • Concurrent compactions or aborts can cause partial state or confusing outcomes.

Proposal

  • Validate locking coverage: session lock acquired for all compactions without external signal.
  • Handle abort race gracefully; ensure summary text part is either complete or clearly aborted with usable content.
  • Retry backoff already exists; verify edge cases and add tests.

Code Refs

  • packages/opencode/src/session/compaction.ts:90-93 (SessionLock usage)
  • packages/opencode/src/session/compaction.ts:262-313 (retry loop)

Tasks

  • Add tests simulating concurrent compactions and aborts
  • Ensure final message/parts are consistent after abort
  • Improve error metadata/logs for aborted retries

Acceptance Criteria

  • No data corruption or confusing partial state under concurrent/aborted compactions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions