Skip to content

feat(core,mcp): TTL, retract, claim, receipts, coalesce for task messages#64

Merged
NagyVikt merged 1 commit intomainfrom
agent/claude/msg-system-ttl-retract-receipts-blocking-2026-04-25-13-16
Apr 25, 2026
Merged

feat(core,mcp): TTL, retract, claim, receipts, coalesce for task messages#64
NagyVikt merged 1 commit intomainfrom
agent/claude/msg-system-ttl-retract-receipts-blocking-2026-04-25-13-16

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Automated by gx branch finish (PR flow).

…ages

Eight-part overhaul that turns the directed-agent `task_message` system
into a real coordination channel instead of a one-shot inbox.

`@colony/core`:
- `MessageMetadata` gains `expires_at`, `retracted_at`, `retract_reason`,
  `claimed_by_session_id` / `claimed_by_agent` / `claimed_at`. New
  `expired` and `retracted` terminal statuses. `parseMessage` backfills
  the new fields to `null` so legacy rows still pass strict-null
  predicates without a migration.
- `TaskThread.postMessage` accepts `expires_in_ms`, auto-claims a still-
  unclaimed `to_agent='any'` broadcast on reply, and keeps reply-chain
  depth authoritative at 1-deep — only the immediate parent flips to
  `replied`.
- New `TaskThread.retractMessage` (sender-only, refuses already-replied)
  and `TaskThread.claimBroadcastMessage` (idempotent for existing
  claimer, rejects directed messages with `NOT_BROADCAST`).
- `markMessageRead` writes a sibling `message_read` observation so the
  original sender's preface can render read receipts; past-TTL reads
  flip status to `expired` and throw `MESSAGE_EXPIRED`.
- Inbox queries filter retracted, expired, and other-agents'-claimed
  broadcasts. `MessageSummary` surfaces `expires_at`,
  `is_claimable_broadcast`, and the claim state.
- `buildAttentionInbox` adds `summary.blocked`, `coalesced_messages`,
  and `read_receipts` (drops once recipient replies). New
  `read_receipt_window_ms` / `read_receipt_limit` options.

`@colony/mcp-server`:
- `task_message` accepts `expires_in_minutes` (max 7 days).
- New `task_message_retract` and `task_message_claim` tools.
- `task_messages` shape now includes `expires_at`,
  `is_claimable_broadcast`, `claimed_by_session_id`, `claimed_by_agent`.
- Tool descriptions document the 1-deep reply contract, retract
  semantics, TTL behavior, and broadcast-claim flow.

Tests: 71 in `@colony/core` + 33 in `@colony/mcp-server` (8 new),
covering TTL expiry/lazy-flip, retract guards, broadcast claiming,
auto-claim on reply, read-receipt drop on reply, blocked summary, and
legacy-row backward compatibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NagyVikt NagyVikt merged commit cfb6338 into main Apr 25, 2026
@NagyVikt NagyVikt deleted the agent/claude/msg-system-ttl-retract-receipts-blocking-2026-04-25-13-16 branch April 25, 2026 11:45
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.

1 participant