Repository navigation
π fix(status): route every hive:status write through one serialised writer - #16319
Conversation
β¦riter Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: pushed tests for src/pkg/prstatus to lift it above the 90% coverage floor (was 86.3%). CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Logic looks correct to me; CI is red for one test-only reason that is this PR's to fix. Read
Why CI fails β job 125573065789 ( The new call is One low note, not a blocker: |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Read the new writer against both adapters and the code it replaces; this looks correct to me.
What I verified
prstatus.Write(src/pkg/prstatus/writer.go) is now the onlyhive:statuswriter: noprstatus.Upsert/prstatus.Markercall sites remain outsidepkg/prstatusand the two forge adapters, andTestNoStatusWriterOutsideWriteguards that.- Edits are not a new bypass. The replaced
UpsertIssueMarkerCommentalready calledIssues.EditCommentdirectly and tallied vianoteCommentEdited()(src/pkg/github/gfi_forge.go:41-44);clientStatusForge.EditCommentdoes the same (src/pkg/github/pr_status_comment.go:57-62). Creates still go throughCreateIssueComment, so the canary gate / effects journal / created tally are preserved. Mergerewriting the oldest comment throughRenderis behaviour-preserving:Upsertalready didParseβRender(src/pkg/prstatus/prstatus.go:89-109), so prose outside sections was dropped on every edit before this PR too.- Return semantics of
UpsertPRStatusSectionare unchanged (no comment + empty text β(false, nil); unchanged body β no edit), and the engine's quiet-modepostStageNotestill returns 1 only on create. editCompareAndRetryrecomputes on the fresh body and bounds atMaxWriteAttempts; the per-item lock table drops entries at refcount 0, so it cannot grow unbounded.
One low-severity note (not a blocker)
Own is wider than the doc comment says. Comment.Own is documented as "the hive authored the comment" (writer.go:17-19), but both adapters compute it as "not a person": hiveAuthoredLogin returns true for any [bot] login (src/pkg/github/pr_reporter_trust.go:152-160), and the engine uses !isPersonLogin(user) (automerge_stage_labels.go:1514), which is false for any type == "Bot" or *[bot] login (src/pkg/github/pr_approve_command.go:28-37). So reconciliation will delete a sibling hive's (or any other bot's) status comment, not only this installation's. The sections are merged into the oldest first, so nothing is lost β and DeleteComment is a new write primitive for the hive, so it is worth a maintainer knowing the deletion scope is "any bot's status comment". If the intent is really "this hive only", compare the login to AppBotLogin() instead; if "any bot" is intended, I'd just tighten the Own doc comment.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
β¦fake forge TestSleepRatchet counts time.Sleep( calls in *_test.go under pkg/ and the new fakeForge pause pushed the count above its baseline. The pause only needs to hold the fake call open long enough to observe overlap, so a timer channel does the same job without touching the ratchet. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Adds tests for Reconcile, every Write error branch (list, create, edit, delete, vanished comment, conflict) and the Parse/Get/Upsert/Merge/ItemKey edge cases. This lifts the package above its 90% coverage floor. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read src/pkg/prstatus/writer.go in full plus both adapters against the v5 tree. The design holds and I found no defect; one low note below.
What I verified
editCompareAndRetry(writer.go:152-177) re-reads the comment immediately before every edit and recomputes on the fresh body when it moved;next == baseafter a refresh returns(false, nil)rather than re-editing, so a concurrent writer that already landed the same section is not clobbered.MaxWriteAttemptsbounds the loop toErrStatusConflict.lockItem(writer.go:245-264) refcounts so the map does not grow with every PR ever written; the unlock order (releasel.mubefore takingitemLocks.mu) is deadlock-free.- The Client adapter's edit path (
pr_status_comment.go:57-63) is behaviourally identical to whatUpsertIssueMarkerCommentdid before (gfi_forge.go:41-45: directIssues.EditComment+noteCommentEdited), and creates still go throughCreateIssueCommentso the canary gate / tally are preserved. The engine'spostStageNotestill returns 1 only onres.Created, so quiet-mode notification counting is unchanged. - The two adapters agree on
Own:hiveAuthoredLogin(pr_reporter_trust.go:154-160) and!isPersonLogin(automerge/pr_approve_command.go:22-28) both mean "not a person", so reconciliation deletes the same set of duplicates from either path.
Low / informational
Writeeditsstatus[0]β the oldest status-marker comment β without checkingOwn(writer.go:100). TheComment.Owndoc says a person-pasted marker is "merged from but left in place"; that is true for deletion, but if the person's comment happens to be the oldest it becomes the one the hive edits in place from then on. Probably acceptable (a human pastingprstatus.Markeris unlikely), but worth a one-line doc tweak or anOwn-preferring pick so the comment and the code say the same thing. Not blocking.
Body and diff agree. Looks correct to me.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
β¦rect-write ratchet Merging v5 (#16319, #16321) moved the hive status comment's edit/create/ delete into prstatus.Forge adapters in automerge_stage_labels.go and pr_status_comment.go without updating the write-back ratchet, so TestDirectWriteRatchet failed on every PR's merge commit. Mark the forge adapter calls writeback:gated β they are plumbing under prstatus.Write and the write-back decision lives at the ratcheted entry points β and lower the automerge_stage_labels.go baseline now that the old in-place edit is gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
β¦rect-write ratchet Merging v5 (#16319, #16321) moved the hive status comment's edit/create/ delete into prstatus.Forge adapters in automerge_stage_labels.go and pr_status_comment.go without updating the write-back ratchet, so TestDirectWriteRatchet failed on every PR's merge commit. Mark the forge adapter calls writeback:gated β they are plumbing under prstatus.Write and the write-back decision lives at the ratcheted entry points β and lower the automerge_stage_labels.go baseline now that the old in-place edit is gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
β¦us-comment forge create TestNotificationWriteSitesInventory (v5, #16321) flags two untagged notification-capable writes on this branch's merge commit: attentionDelivery.Post, this PR's condition-episode page (attention), and clientStatusForge.CreateComment from #16319's status writer (status, passthrough to its caller). Tag both and mirror the rows in src/docs/notifications.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
v5 went red after #16319 and #16321 landed together: the prstatus forge adapters added raw/wrapper comment writes in pr_status_comment.go and automerge_stage_labels.go that TestDirectWriteRatchet had no baseline for, and clientStatusForge.CreateComment is a new CreateIssueComment call site TestNotificationWriteSitesInventory requires a class tag for. Record the moved status-comment writes in the ratchet baseline, and inventory clientStatusForge.CreateComment as a status passthrough (attributed to the UpsertPRStatusSection / PostNoteOrFold caller), with the matching row in docs/notifications.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
β¦16310) * π fix(agent): add hysteresis to the transcript scan overrun warning Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * fix(agent): marginal scan passes break the slow streak without re-arming Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π docs(agent): document transcript_scan_slow debounce; hoist took in refreshTranscriptActivity Address review findings on #16310: the fleet-report class table now describes the once-per-episode / 3-consecutive / 80% re-arm behavior so operators can interpret the β₯5-in-10-min threshold. Compute took once so the judged and logged durations match, and rename the pace parameter to match its type and the tests. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π§ͺ test(ci): reconcile write ratchets with the prstatus status writer v5 went red after #16319 and #16321 landed together: the prstatus forge adapters added raw/wrapper comment writes in pr_status_comment.go and automerge_stage_labels.go that TestDirectWriteRatchet had no baseline for, and clientStatusForge.CreateComment is a new CreateIssueComment call site TestNotificationWriteSitesInventory requires a class tag for. Record the moved status-comment writes in the ratchet baseline, and inventory clientStatusForge.CreateComment as a status passthrough (attributed to the UpsertPRStatusSection / PostNoteOrFold caller), with the matching row in docs/notifications.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --------- Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* β¨ feature: persist single-admitter condition episodes Add opt-in per-repo attention ownership, durable producer-independent episodes, quiet baseline recovery, and exact-attempt reconciliation before uncertain POST retries. Keep existing writers, reviews, commands and holds unchanged for the separate pilot. Hive-Run: #16267 Hive-Plan: RFC-16075/phase-3-condition-episodes Hive-Spec: RFC-16075#2 Signed-off-by: mendezr <mendezr@users.noreply.github.com> * π fix: align attention rollout with CI contracts Signed-off-by: mendezr <mendezr@users.noreply.github.com> * π§ͺ test: cover attention recovery and fail-closed transitions Signed-off-by: mendezr <mendezr@users.noreply.github.com> * π fix: page never-delivered conditions on first report, prune resolved episodes Address review findings on #16291: - Baseline only conditions whose key appears in trusted attention delivery history. A never-paged condition on a never-seen item now notifies on its first report instead of being permanently swallowed; History remains the replay guard after ledger loss. Drop the empty-inventory baseline contract from the adapter/doc comments and docs. - Only hive:attention markers with an attempt ID count as delivery history. Status-card hive:condition markers (emitted for non-admitter and never-paged episodes) no longer seed baselines that would suppress a first page. - Prune resolved, reconciled episodes once the flap window has passed so the 4096-episode cap bounds live inventory instead of becoming a dead stop. Uncertain episodes and history-seeded baselines are retained. Tests cover first-report paging, condition-marker-only history, and pruning. Signed-off-by: Andrew Anderson <andy@clubanderson.com> * π docs: link attention episodes page, separate top-level decls Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π fix: reconcile uncertain resolved episodes, page first reopen, prune items Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π± chore(writeback): annotate status-comment forge plumbing for the direct-write ratchet Merging v5 (#16319, #16321) moved the hive status comment's edit/create/ delete into prstatus.Forge adapters in automerge_stage_labels.go and pr_status_comment.go without updating the write-back ratchet, so TestDirectWriteRatchet failed on every PR's merge commit. Mark the forge adapter calls writeback:gated β they are plumbing under prstatus.Write and the write-back decision lives at the ratcheted entry points β and lower the automerge_stage_labels.go baseline now that the old in-place edit is gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π± chore(notifications): inventory attentionDelivery.Post and the status-comment forge create TestNotificationWriteSitesInventory (v5, #16321) flags two untagged notification-capable writes on this branch's merge commit: attentionDelivery.Post, this PR's condition-episode page (attention), and clientStatusForge.CreateComment from #16319's status writer (status, passthrough to its caller). Tag both and mirror the rows in src/docs/notifications.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * fix(attention): mark acknowledged reopen quiet Hive-Fix-Attempt: 3/6 Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π fix: expire stale history baselines and report status-comment writes as ungated Hive-Fix-Attempt: 4/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π docs: list attention-episodes.md in the documentation map and docs README Closes #16330 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π± chore(settingsparity): collect pkg/attention so github.attention leaves are enumerated Closes #16331 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π± chore: retrigger CI after transient npm registry outage build/docker jobs failed in the Dockerfile cline install step with "No matching version found for @ai-sdk/openai@4.0.108"; the version is present on the registry, so this was a transient fetch failure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --------- Signed-off-by: mendezr <mendezr@users.noreply.github.com> Signed-off-by: Andrew Anderson <andy@clubanderson.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: mendezr <mendezr@users.noreply.github.com> Co-authored-by: Andrew Anderson <andy@clubanderson.com> Co-authored-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
β¦ier (#16300) * β¨ feat(config): stage bounded human-merge pin-only policy and classifier Implement the shared foundation from #16262 for #16242 without loosening any merge admission gate. Carry complete patch evidence, reject unsupported or mixed diffs, and make the remaining trust, review and exact-head obligations explicit. Hive-Run: #16242 Hive-Plan: ordered-children/16262-config-and-classifier Hive-Spec: issue-16242#required-behavior Co-authored-by: hanthor <5840441+hanthor@users.noreply.github.com> Signed-off-by: mendezr <mendezr@users.noreply.github.com> * π fix(intent): explicitly project changed files into alignment summaries Signed-off-by: mendezr <mendezr@users.noreply.github.com> * π± test(dashboard): allowlist human_merge_pin_only leaves in settings parity The settings parity test treats every new hive.yaml leaf as a Settings UI gap unless it is allowlisted; the pin-only policy is yaml-only. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π docs(merge): drop stale 'planned/proposed' wording for landed pin-only schema Reword operator-reference and hive-merge.md so they no longer describe the human_merge_pin_only schema as planned/proposed now that it has landed, and link hive-merge.md to the operator-reference section instead of duplicating the YAML example, field contract and reload instructions. Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π± chore(writeback): annotate status-comment forge plumbing for the direct-write ratchet Merging v5 (#16319, #16321) moved the hive status comment's edit/create/ delete into prstatus.Forge adapters in automerge_stage_labels.go and pr_status_comment.go without updating the write-back ratchet, so TestDirectWriteRatchet failed on every PR's merge commit. Mark the forge adapter calls writeback:gated β they are plumbing under prstatus.Write and the write-back decision lives at the ratcheted entry points β and lower the automerge_stage_labels.go baseline now that the old in-place edit is gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π± chore(github): inventory clientStatusForge.CreateComment as a status passthrough TestNotificationWriteSitesInventory fails on this branch because the prstatus.Forge adapter's CreateComment calls CreateIssueComment without a class tag. Register it as a status passthrough wrapper (attribution falls through to the UpsertPRStatusSection caller, all of which are already inventoried) and add the matching row to docs/notifications.md. Hive-Fix-Attempt: 3/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π fix(intent): accept blank context lines in pin-only patches GitHub's compare API renders empty context lines as "" rather than " ", so classifyPinPatch failed closed on most workflow/Containerfile pin bumps that had a blank line inside the hunk. Treat an empty line after a hunk header as a context line; a blank line before any hunk is still rejected. Also drop the duplicate clientStatusForge.CreateComment row left in docs/notifications.md by the v5 merge. Hive-Fix-Attempt: 5/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π± chore(writeback): drop unjustified writeback:gated annotations and baseline cut Revert the status-comment forge annotations in automerge_stage_labels.go and pr_status_comment.go, and the direct-writes-baseline.txt reduction (automerge_stage_labels.go 5->2), to their v5 state. The annotated EditComment/CreateComment/DeleteComment calls are not actually routed through writeback.Gate.Allowed (prstatus.Write and writeStatusSection never consult it, and only one of four postStageNote callers checks writebackAllowed), so marking them gated would let un-gated writes leave the ratchet permanently. v5 already baselines these files at their current counts, so the change was unnecessary for CI and unrelated to the pin-only policy work in this PR. Hive-Fix-Attempt: 6/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --------- Signed-off-by: mendezr <mendezr@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: mendezr <mendezr@users.noreply.github.com> Co-authored-by: hanthor <5840441+hanthor@users.noreply.github.com> Co-authored-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Why
hive:statusis the quiet-mode delivery path and #16075 will reuse it for issues, but it had three races:UpsertPRStatusSectionread the body, computedprstatus.Upsert, thenUpsertIssueMarkerCommentre-listed and edited without comparing against the first read, so a section another writer added in between was overwritten.editStatusSectionedited the same comment from its own read and created it from a separate call site, with no shared lock.What
prstatus.Write(newsrc/pkg/prstatus/writer.go) is the single authoritative writer, driven through a smallForgeinterface (list/edit/create/delete):(repo, number)within the process;MaxWriteAttempts, thenErrStatusConflict);Client.UpsertPRStatusSection(and soPostNoteOrFold/PostClaimNoteand every caller) and the automerge engine's quiet-modepostStageNoteboth adapt their transport toprstatus.Forgeand callWrite.editStatusSectionand its separate create site are gone.CreateIssueComment(created), edits are tallied as edited, suppressed is still counted byPostNoteOrFold. No change to which notes fold, normal mode, or any hold/merge/review behaviour. No new dependency.Tests
ErrStatusConflictwith no edit;pkg/prstatusnames the marker or callsprstatus.Upsert/Render/Merge.Closes #16263
Part of #16075
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@hanthor