Skip to content

workq: repair legacy system:unclaimed status rows#180

Merged
dgarson merged 1 commit intodgarson/forkfrom
codex/locate-system-unclaimed-in-workq-status
Feb 24, 2026
Merged

workq: repair legacy system:unclaimed status rows#180
dgarson merged 1 commit intodgarson/forkfrom
codex/locate-system-unclaimed-in-workq-status

Conversation

@dgarson
Copy link
Owner

@dgarson dgarson commented Feb 24, 2026

Motivation

  • Legacy/corrupted rows were observed with status = 'system:unclaimed', but system:unclaimed is an agent sentinel that must live in agent_id not status, and such rows are treated as non-available and break consumers that expect canonical statuses.

Description

  • Add a startup repair pass repairSystemUnclaimedStatusRows() invoked from WorkqDatabase.initialize() that updates any rows with status = 'system:unclaimed' to status = 'claimed', sets agent_id = 'system:unclaimed' when the row shows the symmetric corrupted shape, and refreshes updated_at.
  • Add a regression test to src/database.test.ts which simulates the legacy/corrupted row (status='system:unclaimed', agent_id='claimed') and verifies reopening the DB triggers the repair to status='claimed', agent_id='system:unclaimed'.
  • Modified files: extensions/workq/src/database.ts and extensions/workq/src/database.test.ts.

Testing

  • Executed package test runner: pnpm --filter @openclaw/workq test -- src/database.test.ts, which failed to run the suites due to a missing Vitest setup file (extensions/workq/test/setup.ts), preventing full automated validation in this environment.
  • The new regression test has been added to the workq test suite so it will exercise the repair logic once the repository's test setup is available and Vitest runs successfully.

Codex Task

@dgarson dgarson merged commit 75abcdd into dgarson/fork Feb 24, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant