Repository navigation
🐛 fix: proxy policy callback errors, panics and timeouts deny - #19005
Conversation
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending - sweep will merge when green. 🐝 Hive Agent: Review findings from Verdict: changes_requested (correctness). The core fail-closed wiring is sound. I read the head at c83634d. Panics and timeouts deny in the pause, scope, REST and GraphQL auto-merge, and write_surface paths. The In-scope gap: the write_surface.enforce failure path still returns the normal "under write_surface.enforce... Do NOT retry" directive, which contradicts the PR body's claim that every failure reason names the failed check rather than an operator decision. See the inline comment. Please make the write_surface failure path produce a distinct reason, and have the test assert it. Findings not on a changed line
Review findings from I read the diff and found no defect. This is routed only because it touches proxy policy rules, which I do not approve. What I checked:
Open questions (not defects):
|
Mutation testinggremlins found 2 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.
1 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
Verdict: |
| return reason, refused | ||
| } | ||
|
|
||
| // autoMergeRefusal is RepoAutoMergeRefusal against the current predicate. A |
There was a problem hiding this comment.
Advisory: the failed-flag + guardRepoPredicate + policyCallbackFailedReason sequence is repeated in three gates here, and agentRepoScopeRefusal hand-rolls its own closure. A small shared helper would reduce drift risk for future gates. Not blocking.
|
Needs a decision, not a merge:
Head: verdict requires_human @e36ab63, 74/74 checks green, DCO yes, soak 0s of 10m0s. What to do: approve this head ( How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to Updated 2026-11-18 18:34 UTC. |
|
/hive decision Accept the fail-closed policy with the 2s predicate timeout. Apply the adjudicator's requested change: make the write_surface.enforce failure path use a failure flag like the other gates and return policyCallbackFailedReason("write_surface.enforce") at both call sites (the REST and GraphQL arms in github_proxy_mitm.go), instead of the normal write_surface.enforce directive. Update policy_callback_guard_test.go so each gate that uses it asserts the reason equals policyCallbackFailedReason(gate), not only the PAUSED and NOT scoped strings. Keep the rest unchanged. |
|
Decision recorded by @clubanderson for head |
Per maintainer decision on #19005: when the write_surface.enforce predicate panics or times out, the REST and GraphQL arms now return policyCallbackFailedReason("write_surface.enforce") via a failure flag, like the other gates, instead of the normal write_surface.enforce directive. The test asserts each gate's reason equals policyCallbackFailedReason(gate). Hive-Fix-Attempt: 1/6 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Decision needed: @clubanderson should confirm the proxy write gates (repo pause, repo scope, auto-merge, write_surface.enforce) failing closed with a 403 on a panic or a 2s timeout is the intended policy, since this edits the egress trust boundary.
Read github_proxy_policy.go and the new policy_callback_guard.go at the PR head. The change does what the body says: each of the four gates now calls its predicate through callPolicyPredicate, and a panic or timeout takes that gate's deny direction (paused, not scoped, auto-merge off, lane enforced). The nil predicate semantics are preserved (guardRepoPredicate returns nil for nil, agentRepoScopeRefusal and writeSurfaceEnforcedFunc do the same). laneWriteSurfaceEnforced passes failed=nil, and a failed call there returns true (enforced), which is the deny direction. Looks correct to me.
Two non-blocking observations:
- A timed-out predicate leaves its goroutine running (documented in
policy_callback_guard.go). If a predicate hangs on a lock, each request spawns another stuck goroutine for as long as the fault lasts. Bounded by request rate, but worth knowing. - One request can call several predicates in sequence, so worst-case added latency is 2s per gate.
Because this is the proxy's policy path, a maintainer should sign off on the fail-closed behaviour rather than relying on me. CI is green.
-- hive: agent=reviewer backend=claude model=claude-sonnet-5-5 claude=2.1.327
clubanderson
left a comment
There was a problem hiding this comment.
Approving head e36ab63. The write_surface.enforce failure path now uses a failure flag and returns the policy-failed reason at both the REST and GraphQL call sites, and the guard test asserts the reason for each gate that uses it. The accepted policy: write gates fail closed on a panic or a 2s timeout.
|
LGTM label has been added. DetailsGit tree hash: 9d1680b757b17706423cbcf6845cc2891bffce54 |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether the proxy write gates may take a 2s timeout-and-deny on live policy predicates, since this touches the egress authorization path?
Read github_proxy_policy.go and the new policy_callback_guard.go. The change looks correct to me: each gate's failure value is its deny direction (repo pause -> paused, auto-merge -> off, repo scope -> not scoped, write_surface.enforce -> enforced), nil predicates keep their old "not installed" semantics, and the failure reason deliberately avoids asserting an operator decision.
Routing to a human only because this is the proxy authorization path, a trust surface.
One low-severity note: callPolicyPredicate (policy_callback_guard.go) leaves the goroutine running after the 2s timeout, so a predicate stuck on a lock leaks one goroutine per gated request until it unblocks. The file comment acknowledges this; if predicates can realistically hang, a per-gate in-flight cap would bound it.
-- hive: agent=reviewer backend=claude model=claude-sonnet-5-5 claude=2.1.327
|
/lgtm |
|
LGTM label has been added. DetailsGit tree hash: b510c27831ba3c4bb710f75ebe8e9adbf1ffdc4d |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: clubanderson The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
|
LGTM label has been added. DetailsGit tree hash: 4c72a5b3bc87698a81f89f8abfc47862057557c0 |
The proxy's write gates (repo pause, agent repo scope, repo auto-merge, write_surface.enforce) called live host predicates bare on the request goroutine. Nothing above the MITM request loop recovers, so a panicking predicate crashed the whole proxy, taking down egress for every agent, and a hanging one held the request open with no answer. Neither failure branch denied. Gates are only worth something if they fail closed, so each predicate now runs with panic recovery and a timeout, and either failure takes that gate's deny branch with a reason that names the failed check instead of claiming an operator decision. The predicates return bool, so a panic or a timeout is how they fail. The callbacks deliberately left unguarded (budget limits, credential suppliers, audit sinks) are listed in a comment in policy_callback_guard.go. The fault-injection table test covers panic and timeout for every gate. Without the guard, the panic cases crash the test binary and the timeout cases hang.
Closes #18994
🤖 Generated with Claude Code
-- hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.327