Skip to content

docs(agent): design topic stale-post check for managers (RIG-1714) - #2136

Closed
rigel-mintaka wants to merge 2 commits into
mainfrom
compass-comms/rig-1714-topic-locks-design
Closed

rigel-mintaka wants to merge 2 commits into
mainfrom
compass-comms/rig-1714-topic-locks-design

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Design record for RIG-1714: stop Manager agents from double-answering in a topic. Instead of the per-topic write lock the issue proposed, the record designs an optimistic stale-post check. An agent post carries the newest message the agent has seen in the topic (last_seen_message_id) and a capped set of messages seen out of order (seen_message_ids). The server refuses the post when another author posted a message the agent has not seen. The refusal returns those messages so the model can decide whether to post again. There is no lock state, so nothing can wedge, and human posts are never checked.

Record: docs/designs/agent/compass-topic-write-locks/design.md

Decisions (all pending Matt)

Row Decision
DL-472 PostMessageRequest.last_seen_message_id = 10, seen_message_ids = 11; refuse when an unseen message from another author exists. No lock, TTL or waiter queue.
DL-473 The check is per topic. Each insert takes a FOR NO KEY UPDATE lock on the topic row, so seq order matches commit order. AnswerAsk locks the topic before the message.
DL-474 The agent's mark moves only on observations contiguous from it. Steers and delivers go into a per-topic seen set. The tracker persists in the session.
DL-475 A refusal is PostMessageResponse.stale_post = 3, the same shape as #2120's cost_estimate. The idempotent retry is checked first. Tools never retry on their own.
DL-476 Every agent account is checked. Human clients never set the fields.

Open questions for Matt (RIG-5137)

OQ1 to OQ6 are load-bearing: feature shape, seen set, whether human authors count, refusal shape, order against the #2120 hold, and whether the public RPC honours the fields. Recommendation: A, A, A, B, A, A. The Plan builds the recommendations, and each OQ lists the Plan change for the other options. This PR must not merge until the OQs are ruled.

Cross-record numbering

Review

Checks

  • rumdl is clean on the record and the 5 rows.
  • design-ledger gate: OK, 419 decision files, 197 records.

Spec-impact: none
Ledger-impact: adds DL-472 to DL-476 (docs/designs/decisions/agent/)

Refs RIG-1714

Co-authored-by: Matt Wilkinson matt@rigel.build

Optimistic per-topic check: agent posts carry the newest message seen and
a capped seen set; the server refuses a post when an unseen message from
another author landed after it. Rows DL-472..476, pending Matt on OQ1-6.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@trunk-io

trunk-io Bot commented Oct 11, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@linear-code

linear-code Bot commented Oct 11, 2026

Copy link
Copy Markdown

RIG-1714

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

NULL-safe seen-set predicate, head-page mark rule, refused-id dedup, seen-set
eviction floor, session reset; split hold pre-check and confirm restamp into
T3/T4 behind the cost gate; complete OQ plan deltas; forced deadlock test.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Review at head de50d3f8: high 0, medium 0, low 5, nit 0. Scope: the full record and DL-472 to 476. Lenses: correctness against store, delivery and compass-agent code; consistency; OQ deltas; field numbers vs #2120 and #2078; tests; anchors; hygiene. The first round had 2 high, 7 medium and 11 low; 18 are fixed, 1 is partly fixed (the deadlock-test wait predicate is unscoped, now low N1), and 1 was declined (the README status convention; the gate accepts the string). The 5 remaining lows are test-precision notes, folded at implementation. rumdl and the design-ledger gate are clean. Six load-bearing OQs are for Matt in RIG-5137.

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Moved to RigelBuild/docs#24 under Matt's directive that design records live in the docs repo, not code repos. Review continues there.

@rigel-mintaka
rigel-mintaka deleted the compass-comms/rig-1714-topic-locks-design branch October 15, 2026 16:47
rigel-mintaka added a commit to RigelBuild/docs that referenced this pull request Oct 18, 2026
Moved from RigelBuild/compass#2136 under the design-records-to-docs-repo directive.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
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