docs(agent-ops): define durable ledger contract (SPEC-008) - #107
Conversation
|
Warning Review limit reached
Next review available in: 82 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@codex review |
|
@coderabbitai review |
|
|
@coderabbitai review |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6ed0ee600
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96f71c7a1f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| ### 4.2 MCP | ||
|
|
||
| - `acquire_task_lease({ taskId, durationSeconds?, idempotencyKey })` |
There was a problem hiding this comment.
Define an authenticated MCP holder identity
The current MCP transport authenticates every caller with the same MCP_SECRET (backend/src/mcp/server.ts:92-101) and explicitly has no request-scoped user (backend/src/mcp/server.ts:32-40), while this acquisition schema supplies no holder identity and line 223 forbids trusting one from the request body. Consequently, all MCP agents would acquire leases as the same principal, making holder attribution, actor-scoped idempotent replay, and takeover authorization unreliable; define a server-validated per-agent credential or authenticated session identity before using leases through MCP.
Useful? React with 👍 / 👎.
|
|
||
| REST transports an optional lease token in the `Baton-Lease-Token` header on every task mutation and the idempotency key in `Idempotency-Key` on every write. MCP adds an optional `leaseToken` field to every task-mutating tool, including existing tools such as `update_task`, `move_task`, checklist mutations, evidence/handoff mutations, and `task_done`. A central policy wrapper—not individual handlers—classifies mutations as lease-protected and performs fencing before the transaction. | ||
|
|
||
| Legacy calls remain valid while a project is `off` or `observe`. In `observe`, a missing or conflicting token appends one `lease.conflict_observed` event and allows the mutation. In `enforce`, a protected mutation without a current matching token returns `409 lease_required`; a legacy client does not silently bypass fencing. An authenticated human with explicit takeover authority uses the lease takeover contract with a reason before mutating rather than a hidden bypass. Append-only comments and read operations are not lease-protected, but still use normal authorization. |
There was a problem hiding this comment.
Log observe conflicts only when a live lease exists
Because new and existing projects default to observe, the stated rule logs lease.conflict_observed for every legacy protected mutation with no token, even when nobody holds a lease. Normal update_task, checklist, and task_done traffic would therefore immediately populate the canonical activity stream with false collision records; condition this event on a current conflicting lease rather than token absence alone.
Useful? React with 👍 / 👎.
|
|
||
| REST transports an optional lease token in the `Baton-Lease-Token` header on every task mutation and the idempotency key in `Idempotency-Key` on every write. MCP adds an optional `leaseToken` field to every task-mutating tool, including existing tools such as `update_task`, `move_task`, checklist mutations, evidence/handoff mutations, and `task_done`. A central policy wrapper—not individual handlers—classifies mutations as lease-protected and performs fencing before the transaction. | ||
|
|
||
| Legacy calls remain valid while a project is `off` or `observe`. In `observe`, a missing or conflicting token appends one `lease.conflict_observed` event and allows the mutation. In `enforce`, a protected mutation without a current matching token returns `409 lease_required`; a legacy client does not silently bypass fencing. An authenticated human with explicit takeover authority uses the lease takeover contract with a reason before mutating rather than a hidden bypass. Append-only comments and read operations are not lease-protected, but still use normal authorization. |
There was a problem hiding this comment.
Specify the referenced lease takeover contract
When an authorized human must override an active lease, the REST list only defines acquire, heartbeat, and release, while the MCP list likewise has no takeover operation or force/reason input; ordinary acquisition is specified to return 409 until expiry. The takeover action promised here and in the task-detail UI therefore cannot be implemented from this contract, so add its route/tool, authorization, fencing-token increment, reason, and response semantics.
Useful? React with 👍 / 👎.
| - `record_task_evidence({ taskId, kind, uri, label, runId?, digestSha256?, leaseToken?, idempotencyKey })` | ||
| - `verify_task_evidence({ taskId, evidenceId, verification, reason?, leaseToken?, idempotencyKey })` | ||
| - `create_task_handoff({ taskId, toActorType, toActorId, summary, nextAction, blocker?, evidenceIds?, leaseToken?, idempotencyKey })` | ||
| - `acknowledge_task_handoff({ taskId, handoffId, status, leaseToken?, idempotencyKey })` |
There was a problem hiding this comment.
Restrict acknowledgement to the handoff recipient
For a handoff addressed to a particular to_actor_id, the only stated authorization is general task access, and this mutation has no contract requiring the authenticated actor to match that recipient or belong to the target team. Another task writer could therefore mark the handoff acknowledged or declined and create false evidence that the recipient accepted ownership; define recipient/team-membership checks and any explicit privileged override.
Useful? React with 👍 / 👎.
| - `acquire_task_lease({ taskId, durationSeconds?, idempotencyKey })` | ||
| - `heartbeat_task_lease({ taskId, leaseId, leaseToken, idempotencyKey })` | ||
| - `release_task_lease({ taskId, leaseId, leaseToken, reason?, idempotencyKey })` | ||
| - `record_task_evidence({ taskId, kind, uri, label, runId?, digestSha256?, leaseToken?, idempotencyKey })` |
There was a problem hiding this comment.
Transport the revision required for relative evidence URIs
When an MCP caller records a repository-relative URI, the reused documentation-evidence validator requires an immutable evidenceRevision before it can canonicalize the path (SPEC-001-documentation-requirements.md:53-54), but this tool has no such input. MCP therefore cannot submit one of the evidence forms this specification declares valid or maintain the promised REST/MCP parity; add the revision field or limit this tool to complete HTTPS URIs.
Useful? React with 👍 / 👎.
Summary
Review follow-ups addressed
Verification
git diff --checkTracking
Parent:
65506574-ebb3-4761-a723-fdebe2e20323Children:
63fb0d8d,a4d95540,77d2c49a,1b794f25Funding impact
No direct spend. This scopes 23 points of implementation and reduces collision, duplicate execution, and unverifiable-closeout risk.