Skip to content

fix: improve error messages in claimWork and heartbeat#4

Merged
phuryn merged 1 commit intophuryn:mainfrom
gregario:fix/improve-error-messages
Mar 14, 2026
Merged

fix: improve error messages in claimWork and heartbeat#4
phuryn merged 1 commit intophuryn:mainfrom
gregario:fix/improve-error-messages

Conversation

@gregario
Copy link
Collaborator

Summary

From the suggested first contributions:

Improve error messages in query functions

  • claimWork — when an intent is already claimed, the error now includes who claimed it ("already claimed by pawel") instead of the generic "not open (current: claimed)". Helps an agent decide whether to wait, coordinate, or pick different work.
  • heartbeat — now distinguishes between a non-existent claim ("not found") and a non-active claim ("not active (current: completed)"). Previously both cases returned "Active claim X not found".

No changes to happy paths. Extra queries only run on error paths.

Note: Also tightened two existing completeClaim test assertions from 'not active' to 'completed'/'abandoned' for specificity — the completeClaim code itself was not changed. Renamed two test cases to reflect the new assertions.

Test plan

  • npm test — 68/68 passing against real PostgreSQL
  • No mocks, integration tests only
  • Follows existing patterns in queries.ts and edge-cases.test.ts

🤖 Generated with Claude Code

claimWork now includes who claimed the intent when rejecting a
second claim ("already claimed by pawel" instead of "not open").
heartbeat now distinguishes non-existent claims from non-active
ones, surfacing the actual status.

Also tightened two existing completeClaim test assertions to
match on specific status (completed/abandoned) rather than the
generic "not active" — no code change to completeClaim itself.

All 68 tests pass against real PostgreSQL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@phuryn phuryn merged commit 21e9903 into phuryn:main Mar 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants