Repository navigation
π writeback: a 2xx with no prior refusal no longer moves the backfill cut-off - #18846
Merged
hivecommons-hive[bot] merged 1 commit intoNov 17, 2026
Conversation
β¦ cut-off NoteWriteOutcome stamped writable_at on the first 2xx it was told about, whether or not a 403/404 came first. Only a few writers report outcomes (code scanning, the dependency-bot rebase, the sentinel sweep, the shared-CI tracker edit, workflow auto-approval), so on a repo the hive had labelled for days the first one to succeed moved the cut-off to that moment and the guard froze every older item's stage labels. Stamp writable_at only on a 2xx after a 403/404, as the docs and the field comment already say. At load, clear a writable_at with no last_forbidden (stamped by the old rule) and the items it refused. RepoStatus.Writable now reads true for a repo that never refused a write. Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Contributor
|
[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 |
Contributor
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The write-back backfill guard froze the stage labels of every older PR and issue on a repository the hive had always been able to write to.
NoteWriteOutcomeset the repository'swritable_aton the first successful write it heard about, even when no 403/404 had ever come before it. Only a few writers report outcomes, so that first success could come days after the hive started labelling the repository. The backfill cut-off then jumped to that moment, and every item created before it counted as "pre-existing", including items carrying a stage label the hive itself had written.With this change,
writable_atis set only by a 2xx that follows a 403/404, as the docs and the field comment already say. Awritable_atset the old way is cleared at startup.What happened
On projectbluefin (Eastern times):
stage/100-merge-queueat 12:18 AM, three hours before the cut-off. On 11-17 it loggedwithheld by write-back gate β¦ reason backfill-offfor that PR, which is in no queue.[shared-ci]tracker was filed. The tracker's body edit is one of the few writes that reports its outcome. This is inferred, because the edit isn't logged.Cause
NoteWriteOutcome(src/pkg/writeback/gate.go, the 2xx case) stampedWritableAtwhenever it was empty, without checkingLastForbidden.backfillCutofftakes the later offirst_seenandwritable_at.backfillBlockedLockedrefuses unsolicited writes on anything created before that, stage labels included.Client.noteWritebackOutcome: code scanning, the dependency-bot rebase, the sentinel sweep, the shared-CI tracker edit and workflow auto-approval. Stage labels, comments and reviews don't.writable_atis the first 2xx after 403/404s. The only test covered 403 then 2xx.What changed
NoteWriteOutcome: a 2xx setsWritableAtonly when it is empty and a 403/404 has been recorded. A repository that never refused a write keepswritable_atempty, sofirst_seenalone is the cut-off. Once set,WritableAtstill never moves.repairBackfillCutoffs):writable_atset and nolast_forbiddenwas stamped by the old rule.writable_atand itspre_existingset are cleared, with one log line per repository:writeback: cleared writable_at <t> on <repo> (no 403/404 before it); backfill cut-off is first_seen <t>. The repaired file is saved.first_seenare refused and counted again the next time a write reaches them./api/statuswriteback.repos[].writableis now true for a repository that never refused a write. It is false only while a 403/404 has had no 2xx after it. Previously it was false until one of the rare reporting writers succeeded.docs/operator-reference/sweeps-and-operations.mdgains a sentence on this. There is also a changelog fragment.Not in this PR
writable_atis left as it is. Only the last refusal is stored, so a real gain of write followed by a later refusal can't be told apart from an old-rule stamp followed by a refusal. If such a repository is still frozen, an operator can checklast_forbiddenin/data/metrics/writeback.jsonand see which writer got the 403/404. It may be a different permission than label write.backfill: falsefor items that really predatefirst_seen.writeback.unsolicited.backfill(writebackBackfill, accepted byPUT /api/config/governor/features) has no admin-MCP write.governor.feature_settingsdoesn't list it inboolFeatureFields, andwriteback.kind_policyaccepts onlykinds.Tests
src/pkg/writeback/writeback_test.go:TestBackfillCutoffMovesOnlyAfterARefusal:first_seen, the item is allowed,writableis true andwritable_atis empty;backfill-off.TestBackfillCutoffRepairOnLoad:first_seenis allowed,pre_existingand the banner are gone, and the repair is logged once and persisted (a second load logs nothing);writable_atkeeps its cut-off.TestBackfillGuardAndPersistence(403, then 201, then 200) and the legacy-state-file tests are unchanged and still describe the behavior.Only
gofmt -lwas run locally (AGENTS.md bans localgo test/go build/go vet); this PR's CI is the test run.π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1