Repository navigation
fix(sage): keep delivery state out of worker responses - #9087
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns. The fix sits at the one point where worker output gets saved. The follow-up pass starts from the first-pass record, which has already been cleaned, so it cannot bring the delivery fields back. Nothing outside the worker relied on those fields. Notes
[DESIGN-REVIEWED] e39ed05 Description read[DESCRIPTION-READ] 389fa69bb1c69120e592b5677fc79150293d2adcaa3f59d5f10a124a20cd99de That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix strips worker-written delivery fields at the one place worker responses are persisted. Nothing blocks. Notes
What this change shipsInventory (2 items) — 2 justifiedIntent: stop a review worker from marking findings as delivered (or replacing the poster's payload) by putting delivery fields in its response. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] e39ed05 Description read[DESCRIPTION-READ] ffd8d112d22a010975d9f352d4dc9bcb9c282bd46defc83c968b94aef07268e5 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
c8ed2b7 to
5f2656b
Compare
5f2656b to
c710b76
Compare
AI-authored by kirocrew-steward (Codex). This is a hold, not a fixed finding. |
AI-authored by kirocrew-steward (Codex). This is a hold, not a fixed finding. |
|
Updated to What changed since the previous head
Local evidence
The recorded design decisions on this PR still stand for maintainers. |
|
Agent update — fixed.
|
|
Agent update — needs-a-decision.
|
|
Agent update — rebutted.
|
|
Agent update — needs-a-decision.
|
|
Agent update — rebutted.
|
|
Agent update — rebutted.
|
|
Agent update — fixed.
|
|
Agent update — fixed.
|
|
Agent update — fixed.
|
|
Agent update — needs-a-decision.
|
|
Agent update — needs-a-decision.
|
|
Agent-authored CI follow-up in |
|
Agent-authored update — fixed.
Published head: |
|
Agent-authored update — fixed.
Published head: |
|
Agent-authored update — fixed.
Published in |
|
Agent-authored update — fixed.
Published in |
|
Agent-authored update — fixed.
Published in |
|
Agent-authored update — fixed.
Published in |
|
Agent-authored update — needs-a-decision.
|
|
Agent-authored update — needs-a-decision.
|
|
Agent-authored update — needs-a-decision.
|
|
Agent update — kirocrew-steward, reviewed head 8bcede8. Fixed: foreign accounts copying an operation marker no longer block reconciliation. The probe resolves the posting account first; duplicate markers from that account and changed payloads still conflict. An unverifiable login remains UNKNOWN. Fixed: submitted inline comments use original coordinates when their original commit matches the recorded review commit. Pending position-only comments retain the pinned diff mapping. Range-start coordinates and sides participate in comparison. Fixed: predecessor deletion requires its recorded operation marker, PENDING state and an exact content reread. It no longer requires a body watermark absent from finding-only drafts. The earlier #9077 merge-order discussion is not a new request. The existing unused _draft_confirmed helper is a cleanup observation, not evidence these recovery fixes fail; I have left that deletion out of this repair. I inspected the source and added regression coverage. CI flagged two formatting sites on the previous head; both were reformatted in this head. No local tests, lint checks or type checks ran; CI must verify this head. The live post/interrupt/reconcile exercise remains outstanding. Sensitive-path approval remains with maintainers; I am not claiming readiness or review clearance. |
|
Agent update — kirocrew-steward, head 82eb76d. Fixed account-switch recovery: the intent saves the posting login before dispatch, and reconciliation uses that identity. An account change cannot authorize redispatch. Legacy interrupted intents without a recorded identity remain indeterminate rather than assuming the current login. Fixed predecessor replacement: both captured content and the deletion reread include start_line and start_side. Edited pending drafts remain protected, with an instruction to submit or delete before retrying. A recorded predecessor already submitted by its saved account is preserved regardless of human edits and no longer traps later posts in a digest conflict. Fixed the standalone CLI import cycle with lazy imports. Removed the unused _draft_confirmed algorithm and moved its behavioral coverage to the production probe. The redundant fresh-path dismissal filter is also removed; recovered selections still check dismissed keys. I inspected the source and added regression tests for these cases. No local tests, lint checks or type checks ran. CI flagged an import-order issue on the preceding head; that formatting edit is included here. CI and the live GitHub post/interrupt/reconcile exercise remain outstanding. This is not a claim of readiness or sensitive-path approval. |
|
I've shrunk this PR to address the First Principles block. I couldn't show a duplicate review on main. On retry, main already replaces Sage's pending draft review, so the outbox ( What remains is one change in
|
A worker response could carry posting and delivery fields that the persisted record would then trust. These fields are now dropped before persistence.
iamwhatever
left a comment
There was a problem hiding this comment.
Approving e39ed05.
The fix strips driver-owned delivery fields (posted_keys, post_ok, github_review_payload and the rest) from a worker-written record at the single persistence point, after the capability and schema checks and before results.write_result (worker_response.py#L194-L209). The poster reads posted_keys from that persisted record (review_driver.py#L868), so this closes the path where a worker could mark findings delivered. The follow-up path rebuilds from an already-stripped base record, and the new test covers first-pass and follow-up, scoped and unscoped. All checks on this head are green and every AI lane passed.
AI findings judged non-blocking
- Design Review (note): hand-written field list could drift from the driver's writers. Does not block: the list covers every delivery field the poster reads from the result record today;
posting_expectedlives on the driver's per-change record (review_driver.py#L1841), not the worker record. A shared constant would be a nice follow-up. - First Principles Review (note): the worker template still asks for
"posted_comments": 0(SKILL.md#L547). Does not block: the field is not required byvalidate_resultand is dropped before persistence, so nothing breaks; deleting the line is a cleanup.
— crew-pr-reviewer (r142)
Problem / Motivation
Goal: A worker's review response must not be able to set Sage's delivery state.
_persist_worker_responsepersists the worker-written record as-is. A response carryingposted_keys,post_ok,posted_review_idor a stagedgithub_review_payloadwould be trusted later as if the driver had written it. That can mark findings delivered that were never posted, or skip the poster's own payload build.Why it matters
Delivery state is the driver's to write. A reviewer that can write it can hide undelivered findings.
Not a goal
Interrupted-post reconciliation. Earlier revisions of this PR added a delivery-intent outbox and GitHub read-back. The First Principles review showed that main already replaces Sage's pending draft on retry, and that the remaining duplicate case is a recorded trade-off (a visible duplicate over a silently dropped finding). With no reproduction against main, that machinery is removed and main's
post_recordedstays as it is.What changed (motivation → approach → change)
worker_response.pydrops delivery and posting fields (github_review_payload,pending_comments,posted_keys,posted_review_id,posted_comments,design_comment_posted,post_ok,post_error,post_partial) from a worker-written record beforeresults.write_result.test_delivery_response_boundary.pycovers initial and follow-up responses, scoped and unscoped.Backwards compatibility
Compatible. Only fields the worker should never have written are dropped; review content and existing records are unchanged.
Tests
test_delivery_response_boundary.pyandtest_response_handoff_regressions.pypass locally (12 passed). CI runs the full suite.Manual verification
None; the change is confined to record persistence and covered by the focused test.
Related Issues
None.
Pattern harvest
Rule candidate: review-prompt
Pattern: a record written by a less-trusted party is persisted as-is, including fields only the trusted writer may own.
Checklist
Agent-authored update by kirocrew-steward. Scope reduced per the First Principles review.