Skip to content

docs(agent-ops): define durable ledger contract (SPEC-008) - #107

Merged
JustAGhosT merged 2 commits into
mainfrom
docs/agent-ledger-spec
Aug 14, 2026
Merged

docs(agent-ops): define durable ledger contract (SPEC-008)#107
JustAGhosT merged 2 commits into
mainfrom
docs/agent-ledger-spec

Conversation

@JustAGhosT

@JustAGhosT JustAGhosT commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add SPEC-008 for fenced task leases, generic delivery evidence, acknowledgeable handoffs, and explainable closeout readiness
  • preserve existing task intent, run, activity, agent-message, and documentation-evidence contracts
  • keep enforcement observe-first and separate from authentic user acceptance
  • scope four UUID-backed Baton child tasks totaling 23 points

Review follow-ups addressed

  • optional lease-token transport on every task mutation with explicit legacy behavior
  • encrypted idempotent acquisition-response replay
  • same-task composite constraints for run, evidence, and handoff references
  • required idempotency keys on every write, including heartbeat
  • SPEC-008 identifier preserves SPEC-006 for the Sluice composer security contract

Verification

  • reconciled against current schema, migration, MCP, SPEC-001, SPEC-003, and SPEC-007
  • relative specification links verified
  • git diff --check

Tracking

Parent: 65506574-ebb3-4761-a723-fdebe2e20323
Children: 63fb0d8d, a4d95540, 77d2c49a, 1b794f25

Funding impact

No direct spend. This scopes 23 points of implementation and reduces collision, duplicate execution, and unverifiable-closeout risk.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@JustAGhosT, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c33d46a7-2224-4534-ad83-0aec4a7f6bf0

📥 Commits

Reviewing files that changed from the base of the PR and between 0352222 and 96f71c7.

📒 Files selected for processing (1)
  • docs/specs/SPEC-008-agent-ops-durable-ledger.md

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JustAGhosT

Copy link
Copy Markdown
Collaborator Author

@codex review

@JustAGhosT

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@JustAGhosT

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docs/specs/SPEC-006-agent-ops-durable-ledger.md Outdated
Comment thread docs/specs/SPEC-006-agent-ops-durable-ledger.md Outdated
Comment thread docs/specs/SPEC-008-agent-ops-durable-ledger.md
Comment thread docs/specs/SPEC-006-agent-ops-durable-ledger.md Outdated
Comment thread docs/specs/SPEC-006-agent-ops-durable-ledger.md Outdated
@JustAGhosT JustAGhosT changed the title docs(agent-ops): define durable ledger contract docs(agent-ops): define durable ledger contract (SPEC-008) Aug 14, 2026
@JustAGhosT

Copy link
Copy Markdown
Collaborator Author

@codex review

@JustAGhosT
JustAGhosT merged commit 53fb435 into main Aug 14, 2026
3 checks passed
@JustAGhosT
JustAGhosT deleted the docs/agent-ledger-spec branch August 14, 2026 02:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 })`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 })`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 })`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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