fix: improve error messages in claimWork and heartbeat#4
Merged
phuryn merged 1 commit intophuryn:mainfrom Mar 14, 2026
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
From the suggested first contributions:
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
completeClaimtest assertions from'not active'to'completed'/'abandoned'for specificity — thecompleteClaimcode itself was not changed. Renamed two test cases to reflect the new assertions.Test plan
npm test— 68/68 passing against real PostgreSQLqueries.tsandedge-cases.test.ts🤖 Generated with Claude Code