Repository navigation
✨ governor: release-feed watcher kicks agents when a tracked upstream dependency releases - #18507
Conversation
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
Mutation testinggremlins found 9 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.
7 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
Verdict: |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. @clubanderson this PR is held at Why:
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. hive/awaiting-ci: rebased onto v5 (one import-list conflict in src/cmd/hive/boot.go, kept both imports). CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325 |
0a9c7d6 to
563ce87
Compare
|
cc @joerunde: this is part of the hive changes for the spyre-inference deps agent and sandboxed reviewer setup. |
|
Scanner triage @563ce87: 🐝 Hive Agent: — hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325 |
There was a problem hiding this comment.
Security review at head 563ce87 (diff read; checkout not needed for these two points).
1. Bearer token can be sent over plain HTTP / downgraded on redirect (src/pkg/releasefeed/fetch.go Fetch, ~L170 Authorization: Bearer; endpoint() accepts http for index; egress.go NewEgressClient has no CheckRedirect; config validation release_feeds.go only requires an http:// or https:// prefix).
auth_var resolves any per-agent or hive-level variable and attaches it to whatever index URL is configured. With an http:// URL the credential goes in cleartext. Even with an https:// URL, net/http keeps Authorization on a same-host redirect, including https→http, so a hostile or misconfigured feed can downgrade and expose it. The NewEgressClient doc comment claims the token "never leaves its host", which does not cover scheme downgrade.
Requested fix: refuse to send a token unless the request is https, and refuse scheme downgrades on redirect.
--- a/src/pkg/releasefeed/fetch.go
+++ b/src/pkg/releasefeed/fetch.go
@@
- if token != "" {
+ if token != "" {
+ if req.URL.Scheme != "https" {
+ return FetchResult{}, fmt.Errorf("fetch %s: refusing to send auth_var credential over %s", src.Key(), req.URL.Scheme)
+ }
req.Header.Set("Authorization", "Bearer "+token)
}
--- a/src/pkg/releasefeed/egress.go
+++ b/src/pkg/releasefeed/egress.go
@@
- return &http.Client{Transport: tr, Timeout: egressRequestTimeout}
+ return &http.Client{Transport: tr, Timeout: egressRequestTimeout,
+ CheckRedirect: func(req *http.Request, via []*http.Request) error {
+ if len(via) >= 10 {
+ return errors.New("stopped after 10 redirects")
+ }
+ if via[0].Header.Get("Authorization") != "" && req.URL.Scheme != "https" {
+ return errors.New("refusing https->http redirect with credential")
+ }
+ return nil
+ }}(add "errors" import; also add a test with an http:// index source plus auth_var asserting no request is sent.)
2 (advisory, out-of-scope-ish). Upstream index version text reaches the kick prompt after whitespace stripping and a 128-byte cap (fetch.go cleanVersion). That blunts but does not eliminate prompt injection, e.g. a long hyphenated instruction string. Consider restricting versions to [A-Za-z0-9._+~:-]. Mentions are neutralized in release_feed_watcher.go Kick, which is good.
— hive: agent=adjudicator-5 backend=claude model=claude-sonnet-5-5 claude=2.1.325
Review follow-ups (below
|
|
Baseline triage: native-queue-policy is stale-branch (25 behind v5) and the PR is DIRTY with conflicts. Human-authored, so not pushing; please merge v5 in. 🐝 Hive Agent: — hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325 |
|
scanner: this PR is currently 🐝 Hive Agent: — hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325 |
563ce87 to
646b6c9
Compare
|
[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 |
… dependency releases
Add governor.release_feeds: per agent, GitHub release/tag, PyPI or generic
index feeds. The watcher polls them with If-None-Match/If-Modified-Since
through the spoke's upstream-proxy rules, persists last-seen versions in
/data/release-feeds.json, and on a new version queues a kick through the
kick queue with a ${NEW_RELEASES} block, recording the reason on the
governor kick-history entry. Kicks pass the CI-failure kick gates and are
bounded by a per-agent cooldown. Private indexes authenticate with
auth_var, an existing per-agent variable that is never logged.
Fixes #18494
Signed-off-by: Andy Anderson <andy@clubanderson.com>
A config reload overwrites b.cfg in place under cfgReloadMu, so the watcher goroutine reading it raced the reload (caught by the race detector in TestRunLoopWithAppliesMidCycleReloadWithoutClobbering). Read b.sweepConfig, the immutable snapshot the loop republishes after every reload, instead. Signed-off-by: Andy Anderson <andy@clubanderson.com>
2e33c68 to
1689e63
Compare
|
New changes are detected. LGTM label has been removed. |
Checks in the hive `deps` agent's prompt, definition and dependency targets under `.hive/`, where hive's repo agent discovery looks for them. The flow is unchanged: bump one dependency group, compile it, open an issue if that fails, open one PR on success, fix our side when CI is red, file dependency bugs upstream, recommend a refresh only when a newer release may fix the bug, never run the test suite and never wait for CI. Hive features this now uses, all merged in hive v5: - `hive-topic claim` from the sandbox, so each group keeps its one-PR claim (hivecommons/hive#18586). - `hive-open-issue` from the sandbox for dependency bugs (on torch-spyre) and compile failures (here). This replaces the `known_bad` ledger PR. `known_bad` stays in `targets.yaml` as a cap maintainers can set by hand (hivecommons/hive#18586). - Fix kicks on the agent's own red bump PR commit on top of it, and sandbox PRs are credited to `deps`, so red CI kicks `deps` and not `scanner` (hivecommons/hive#18587). PRs opened before that fix still get the fix as a patch in the report. - `${NEW_RELEASES}` from the release-feed watcher (hivecommons/hive#18507). - `.hive/agents/` discovery (hivecommons/hive#18505). Files: - `.hive/agents/deps.md`: the kick template (`prompt_source`). - `.hive/agents/deps.yaml`: optional presentation-only definition. - `.hive/deps/targets.yaml`: dependency groups. Only `deps-torch-spyre` is enabled. - `.gitignore`: keeps hive's per-run scratch under `.hive/` ignored and tracks only `.hive/agents/` and `.hive/deps/`. This overlaps torch-spyre#1626, which puts the prompt at `.github/hive/prompts/deps.md` and ignores all of `.hive/`. Its prompt content is merged into `.hive/agents/deps.md` here. If this lands first, torch-spyre#1626 can drop its prompt and `.gitignore` hunks. ## Setup after merge (hive owner) 1. **Approve the prompt source.** Settings, Security, Prompt sources. On the `torch-spyre/spyre-inference` row, click **Approve…** and confirm. Leave `allow_github_prompt` and `github_prompt_allowlist` alone. 2. **Point the agent at the prompt.** Agents, `deps`, General tab, **Prompt from GitHub repo**: Owner `torch-spyre`, Repo `spyre-inference`, File path `.hive/agents/deps.md`, Ref `main`. Save. Keep the current kick template as the cold-start fallback, and replace its text with this file so the fallback runs the same flow. 3. **Variables tab** (static, template scope): - `DEPS_LOCAL_CHECK`: `uv sync --frozen --inexact && uv run --no-sync python -c 'import torch_spyre, spyre_inference; print(torch_spyre.__version__)'` - `DEPS_MAX_REFRESHES`: `2` - `DEPS_UPSTREAM_REPO`: `torch-spyre/torch-spyre` 4. **Cadences tab.** idle, quiet and busy `24h`, surge `pause`. 5. **Optional, release-feed kicks** (YAML only, no Settings control yet): `governor.release_feeds.agents.deps.sources: [{kind: github_tag, repo: torch-spyre/torch-spyre}]`, with `cooldown_s: 21600`. Keep the daily cadence for CI follow-up. 6. **Import tab.** `deps.yaml` will show under "Declared in your repos". Leave it pending or reject it, because approving it would create a second `deps` agent. 7. Unpause `deps`. cc @joerunde 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Andy Anderson <andy@clubanderson.com>
Summary
Adds a governor release-feed watcher. An agent that tracks upstream releases (dependency bumps) is now kicked within one poll interval of a new version, instead of finding it on its own timer.
governor.release_feeds.agents.<agent>.sources[]with kindsgithub_release,github_tag(owner/repo),pypi(package JSON API) andindex(generic URL, JSON field or plain text). It also takesinterval_sandcooldown_sat block level, plus a per-agentcooldown_s, andenabledas an off switch. Named defaults (15m interval, 1h cooldown, 1m floor) can be overridden withHIVE_RELEASE_FEED_INTERVAL/HIVE_RELEASE_FEED_COOLDOWN. Validation rejects malformed sources.pkg/releasefeed): each shared feed is fetched once per poll withIf-None-Match/If-Modified-Since. Requests use a client whose proxy iscrux/upstreamproxy.Default(), the spoke's upstream-proxy rules. State (validators, last-seen versions per agent, pending releases, last kick) is written atomically to/data/release-feeds.json. The first answer is a baseline and an unchanged feed kicks nothing.crux.KickQueuer.EnqueueKick, falling back toSendKickon a runtime without it). It passes the same gates asgovernor.ci_failure_webhook_kick: agent known, enabled and unpaused in config or at runtime, andAgentEligibleForCELKick. A refused kick keeps the releases pending. The new built-in${NEW_RELEASES}renders the block (package, old, new, URL). When the agent's template does not use it, a short targeted kick carries the block instead. The reason goes on the governor kick-history entry through the newKickRecord.Reason, which is persisted in the snapshot.auth_varnames an existing per-agent or hive-level variable, resolved throughResolveRegistryForAgentand sent as a bearer token. The token is never logged or written to state. If it does not resolve, the feed is skipped. Index URL queries are redacted to a digest in keys, logs and links.src/docs/release-feeds.md. Updated env-vars, documentation map, agent-configuration (template variable) and the runtime-and-quota operator reference. Settings-parity allowlist entries are added (the keys are YAML-only).Tests
Fake feeds (httptest) cover every kind, conditional 304s, auth headers, errors, and confirm the body cap and redaction. Watcher tests cover baseline/no-change/kick, cooldown folding, gated and failed kicks staying pending, restart persistence, auth_var, shared feeds and pruning, and Run/cancel. Also tested: config precedence and validation, scheduler
${NEW_RELEASES}substitution,RecordKickWithReason, and the cmd/hive kicker gates, message selection and token resolution.Fixes #18494
🤖 Generated with Claude Code