Skip to content

refactor(core): rename the execution claim column - #46945

Open
kitlangton wants to merge 1 commit into
v2from
claim-column
Open

refactor(core): rename the execution claim column#46945
kitlangton wants to merge 1 commit into
v2from
claim-column

Conversation

@kitlangton

@kitlangton kitlangton commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Why

session_v2.time_suspended holds the write-ahead execution claim, including while a Session is actively running. The suspension name misrepresents the recovery marker and makes claim queries harder to read.

What Changes

Rename the column to execution_claimed_at and its partial index to session_v2_execution_claimed_at_idx. Claim acquisition, release, and restart selection keep their existing behavior.

Before migration After migration
Claimed root: time_suspended = 1234, resume_attempts = 2 execution_claimed_at = 1234, resume_attempts = 2
Claimed child: time_suspended = 5678, resume_attempts = 1 execution_claimed_at = 5678, resume_attempts = 1
Unclaimed Session: time_suspended = NULL execution_claimed_at = NULL
Fresh database Nullable execution_claimed_at; resume_attempts still defaults to zero

The new migration uses SQLite's column rename, not a table rebuild. It preserves activity timestamps and dependent history, and recreates the partial index under the new name. The repository's migration generator updates the registry, current-schema bootstrap, and Drizzle snapshot; historical migrations are unchanged. The previous-V2 importer still reads the legacy source column and writes the renamed destination.

Scope

Storage naming and regression coverage only; no public Protocol/API changes. Subagent recovery refactoring and event-based child-claim release remain separate work.

Verification

Run with Bun 1.4.0:

cd packages/core
bun run migration --name execution_claimed_at
# Selected time_suspended -> execution_claimed_at in Drizzle's rename prompt.
bun run migration --check
bun run test test/execution-claim-migration.test.ts test/database-migration.test.ts test/v1-migration.test.ts test/session-create.test.ts test/session-projector.test.ts test/session-execution.test.ts
bun run test
bun typecheck
cd ../..
bunx prettier --check $(git diff --name-only c992716523...HEAD)
git diff --check c992716523...HEAD
git push -u origin claim-column
  • Focused tests: 136 passed, 0 failed. Coverage includes fresh bootstrap, registry-driven upgrade/reapplication, preserved claims and retry counts, dependent history/foreign keys, and previous-V2 import.
  • Full core suite: 4,019 passed, 39 skipped, 0 failed across 228 files (89.21 seconds).
  • Core typecheck, migration freshness check, formatting, and whitespace checks passed.
  • Push ran the unmodified pre-push hook: 33 typecheck tasks successful, including 27 cache hits.
  • Dependencies installed with bun install --frozen-lockfile; no lockfile change.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant