Repository navigation
π± v6: converge kick_observer.go with v5's fan-out observers - #18315
Conversation
v6's two kick-callback consumers, the mention responder and the Linear agent, now register with crux.AddLegacyKickObserver on the fan-out registry (#18303) instead of chaining through SetKickObserver. The adapter delivers exactly the events the single slot delivered (kick-delivered, kick-log-archived, kick-dropped) with the same detail, in order, on each observer's own goroutine. A runtime without the registry (the sidecar client) falls back to SetKickObserver, as before. SetKickObserver is single-slot again, so kick_observer.go and its test are byte-identical to v5. The v6-only archive-source helpers (#7483) move to kick_observer_source.go, and the v6-only deferred-mention tests to kick_deferred_test.go. A new test pins that both observers fire on the same kick with the same events, order and archive detail. Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible β a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: 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 |
Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: clubanderson <407614+clubanderson@users.noreply.github.com>
|
New changes are detected. LGTM label has been removed. |
Review follow-ups (below
|
|
scanner: the docs link check fails and the branch is 3 behind v5. Merge v5 in and re-check; if it still fails, fix the broken relative link or anchor named in the job log. I don't push to human branches. π Hive Agent: β hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325 |
There was a problem hiding this comment.
Convergence looks right for the in-process runtime, with one regression for runtimes that lack the fan-out registry.
Finding (medium): crux/kick_observer_legacy.go:27-30 β the fallback replaces instead of chaining. For a runtime that is not a KickObserverRegistry, AddLegacyKickObserver calls rt.SetKickObserver(fn) and returns a no-op remover. Only agent.Manager implements AddKickObserver (crux/agent/kick_observer.go:22). The sidecar client (crux/api/client) exposes just the single slot. Both consumers still register through this function: the mention responder at cmd/hive/mention_runtime.go:96 and the Linear agent at pkg/dashboard/api_linear_agent.go:64. On a client-backed runtime the second registration therefore overwrites the first, and one of the two stops receiving kick-delivered, kick-log-archived and kick-dropped. The chaining this PR deletes (kick_observer.go, formerly in SetKickObserver) prevented that, and its test TestKickObserver_ChainsObservers is removed with it. The new tests (kick_observer_source_test.go) only cover *Manager.
I did not check whether hostedRuntime can actually be the sidecar client in production. If it can, the fallback should chain (keep a small multiplexer in crux). If it cannot, a comment or test that says so would settle it.
Everything else I read is consistent: the source helpers moved verbatim into kick_observer_source.go, and notifyKickObserver still emits Detail to the fan-out, so the archive detail keeps its source.
β hive: agent=reviewer-2 backend=claude model=claude-sonnet-5-5 claude=2.1.325
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Looks correct to me overall: One lifecycle gap worth a look:
Smaller note: fan-out channels drop events with a warning once 256 are queued ( @clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. Evidence bundle `#183158639019` sha256:790e48e48eaff611cf12c1ab2c4d2433ff600cb733b4f6990c955257f6245bb8 β download from the dashboard or `hivectl review evidence #18315`. |
|
hive/scanner: the only red check is π Hive Agent: β hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325 |
Mutation testingHead β gremlins did not produce a report for 1 package(s), so no verdict can be derived from this run (see the job log):
Verdict: |
Signed-off-by: Andy Anderson <andy@clubanderson.com>
|
New changes are detected. LGTM label has been removed. |
There was a problem hiding this comment.
Read the adapter (src/crux/kick_observer_legacy.go), the call sites and src/crux/agent/kick_observer.go at this head. The convergence looks correct, and both observers get delivered/archived/dropped with unchanged details. One regression the body does not mention:
Events can now be dropped under load (medium, src/crux/agent/kick_observer.go:92). Each fan-out observer has a 256-slot channel; when it is full emitKickEvent drops the event and only logs a warning. AddLegacyKickObserver filters inside the callback, so queued/output-signal/completed events still occupy the buffer. The old single slot started a goroutine per event and never lost one. If the mention responder's HandleAgentEvent is slow, a kick-dropped or kick-log-archived for a mention could be lost, and the responder would not see that its kick finished. I could not confirm how slow HandleAgentEvent is in practice, so I'm raising this as a risk, not a proven bug. A cheap mitigation would be to filter before enqueue, or to document the drop as accepted.
Otherwise looks correct to me.
β hive: agent=reviewer backend=claude model=claude-sonnet-5-5 claude=2.1.325
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 8639019. |
Why
v6 and v5 each changed
src/crux/agent/kick_observer.go, so the file conflicted on the top-ups (#18306) and could conflict again on any later v5 change to it.SetKickObserverchain observers, because v6 has two consumers of the(agent, event, detail)callback: the mention responder and the Linear agent. It also put the kick source into archive details.AddKickObserver,crux.KickObserverRegistry) and keptSetKickObserversingle-slot.Change
crux.AddLegacyKickObserver(rt, fn)is in the new v6-only filesrc/crux/kick_observer_legacy.go. It registers a callback in theSetKickObservershape on the fan-out registry and delivers only the events the single slot delivered:kick-delivered,kick-log-archivedandkick-dropped, with the same agent, event and detail. Fan-out-only events (kick-queued,kick-completed,kick-failed,output-signal) are filtered out.SetKickObserverwith a no-op remover. That is the sidecar client, whoseSetKickObserveralready replaced rather than chained, so its behaviour is unchanged.cmd/hive/mention_runtime.go(mention responder) andpkg/dashboard/api_linear_agent.go(Linear agent) now register through the adapter.kick_observer.goandkick_observer_test.gonow matchorigin/v5exactly, including the single-slotSetKickObserver.kickObserverArchiveDetail,KickObserverDetailSourceandKickObserverDetailReasonmoved unchanged to the v6-onlykick_observer_source.go.kick_observer_source_test.go.kick_deferred_test.go, next to the v6-onlykick_deferred.go.SetKickObserverno longer chains.Behaviour
source=, so the responder still recognises the kicks it summoned.SetKickObserver(nil)(for example fromcrux serve) can no longer clear the two hive observers.Tests
TestLegacyKickObservers_BothFireOnSameKick. Both observers registered on oneManagereach receive delivered, then archived (detailkick source=mention:IC_1), then dropped, in order. Neither receives the queue or output-signal events. Setting and clearing the single slot does not touch them, and removing one observer leaves the other working.TestAddLegacyKickObserver_FallsBackToSingleSlot/_NilSafe. These cover the fallback and the nil cases.gofmt -lis clean on every edited Go file. Nothing was built or tested locally; CI is the gate.Remaining divergence: the sandbox kick
sourceargumentv6's
startSandboxKickLocked(agent, message, source)takes a third argument and v5's takes two. I am leaving this v6-specific and not opening a v5 backport. In v6 the argument feedsAgentProcess.LastKickSource,KickRecord.Sourceand the archive detail'ssource=, all of which exist only on v6 (#7483). v5 has neither field and no source-in-archive detail, so on v5 the argument would only rename the prompt-record source.manager_sandbox.goalso diverges in other ways (launchGen, therunSandboxKicksignature,TaskMCPURL), so a backport would not remove the structural diff there. The three call sites (kick_async.go,kick_queue.go,manager_kick.go) keep a one-line difference each, and they conflict only if v5 edits those exact lines.π€ Generated with Claude Code