Repository navigation
feat(mirror): agent forge_mirror_messages tool with real-session attribution (RIG-5174) - #2319
Conversation
|
Compass engineering docs preview: https://compass-comms-rig-5174-mirro.compass-eng-docs.pages.dev Deployed from Changed pages: |
|
Review status at head 8bd607f: the head-check round found one medium (a concurrent same-key duplicate can be driven instead of returning the stored result) plus two low test gaps. A fix is in progress, so this PR stays draft. |
|
Head 782d8ca fixes the same-key loser being driven: claims now report a resolution, and only Inserted or Remirrored is driven. A review round at 782d8ca found two mediums: a request-key row inserted after the early lookup resolves as Conflict instead of Reserved, and the handler's conflict branch is untested. Fixes are in progress, so the PR stays draft. |
|
Review loop is all-clear at head
Base |
…ibution (RIG-5174) Adds the mirror_messages forge arm and the forge_mirror_messages agent tool. An agent mirrors one visible topic or 1-50 selected messages to an auto-mode issue or PR as one comment; a retry with the same client_request_id returns the first result and never posts twice. - Every agent mirror post stamps the real session: the direct call's session, or for queued ask mirrors the relay-verified posting session (RIG-5431). An agent row with no session is refused, never posted as `mirror`. - forge_mirrors gains session_id and source_payload; a redrive after restart rebuilds the body from the payload and re-checks visibility (RIG-5439). - The source channel is a channel name resolved for the caller (RIG-5430). Co-authored-by: Matt Wilkinson <matt@rigel.build>
- A same-key retry returns the stored result before policy and visibility checks, refuses a different target, and classifies from the stored target. - forge_mirror_requests records each re-mirror key, so retrying it never bumps or edits again. - forge_mirrors.last_error_code keeps a failure's code for retries. - Restore the forge tool repo-validation tests and tighten the redrive tests. Co-authored-by: Matt Wilkinson <matt@rigel.build>
…mirror (RIG-5174) An agent claim now reserves its client_request_id in forge_mirror_requests in the same transaction as the row, so a claim and a re-mirror racing on one key resolve to one row. ForgeMirrorByRequest reads only the reservation. Adds the table to the RLS floor test and real whitespace-repo checks per forge schema. Co-authored-by: Matt Wilkinson <matt@rigel.build>
…G-5174) A claim that loses the request-key race returns the reserved row; the handler now reads the reservation, not the row's own key, so the racing call gets the stored result. Adds deterministic coverage for both reservation-race branches. Co-authored-by: Matt Wilkinson <matt@rigel.build>
A concurrent same-key duplicate that loses the key reservation now gets the stored result instead of leasing and re-posting the row. Refs: RIG-5174 Co-authored-by: Matt Wilkinson <matt@rigel.build>
A request key that names a row after the claim's lookup missed now returns that row's stored outcome instead of a source conflict. Refs: RIG-5174 Co-authored-by: Matt Wilkinson <matt@rigel.build>
Refs: RIG-5174 Co-authored-by: Matt Wilkinson <matt@rigel.build>
Refs: RIG-5174 Co-authored-by: Matt Wilkinson <matt@rigel.build>
478bc1a to
78d5c27
Compare
|
Matt's ruling, given in the Compass owner session on 2026-10-16: PRs may still edit |
This PR is part of a stack containing 4 PRs:
mainSummary
forge_mirror_messagesand the forge armmirror_messages = 16. An agent mirrors one visible topic, or 1 to 50 selected messages, to an auto-mode issue or PR as one comment. Mirroring the same source again edits that comment.client_request_id. A retry returns the stored result (done, pending or failed, with its code) before any policy or visibility check. A retry with a different target is refused. Each re-mirror key is reserved once inforge_mirror_requests, so a retry never edits twice.mirrorsession is gone. The direct call uses the caller's session. Queued ask mirrors use the posting session thatRelayCommsCallverified, carried to the store in the request context. An agent row with no session fails rather than posting unattributed.forge_mirrors.source_payloadholds the resolved channel, the topic or message IDs, and the note. A redrive after restart rebuilds the body from it and re-checks visibility.channelis a channel name. When omitted it is derived from the source. A mismatched, invisible or unknown name all returnnot_found.Verification
golangci-lint run0 issues (default andpgtesttags); nilaway clean;gofmtclean;go build; unit tests.server,internal/store,internal/mirror,internal/runnerhubandinternal/comms. The round-3 fixes reran the targeted mirror/store set.compass-agentbun tests 868/868. The native tool count assertion moves from 27 to 28.compass-proto:drift, typecheck, andrumdlon the spec.Risks
0001_init.sqlis edited in place, so dev databases need a reset; no database is deployed.mirror. The only agent post path is the relay.Compatibility
forge_mirrorsgains columns, and there is a new tableforge_mirror_requests, covered by RLS.mirror.Poster.PostMirrorsignature gainssession; this is an internal interface.Documentation
docs/specs/product/compass.md: the agent mirror requirement and its scenarios.docs/concepts/tools.md: the new tool.Open reading on RIG-5439: the payload stores the resolved channel ID, not the caller's name, because a channel can be renamed. Matt left this sub-question open.
Refs RIG-5174, RIG-5431, RIG-5439, RIG-5430