fix(console): read the web allowlist per channel, not once at startup - #44
Merged
Merged
Conversation
The allowlist changes underneath a running agent: `advisor target_set` writes the file, and config_advisor's Commit seeds one on a node that had none. Reading it once at startup meant every such change needed a restart to take effect, and the failure it produced pointed away from the cause -- a channel refused with "target is not in this node's web allowlist", naming a target the file plainly contained. Three times on the r630 this session: cube-cos-idp, then cube-cos-skyline and cube-cos-ceph. Each looked like a proxy bug until the file was read side by side with the agent's startup line. Re-reading costs one small read per channel, and a channel is opened by a person clicking a button. Startup still parses the file once, where an operator is watching a malformed one. A file that stops parsing later refuses rather than falling back to the last good copy: an allowlist nobody can read is not one to keep enforcing from memory. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PZ5umjjCedZwWtbAbiMjfj Signed-off-by: Travis Wu <travis.wu@bigstack.co>
traviswu-bigstack
force-pushed
the
travis.wu/reload-web-allowlist
branch
from
September 17, 2026 03:09
a2330c5 to
6393f6c
Compare
traviswu-bigstack
marked this pull request as ready for review
September 17, 2026 03:14
2 tasks
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.
/kind bug
What
The agent reads
/etc/cube-advisor-agent/web-targets.jsonon every web channel now, instead of once at startup.Why
The allowlist changes underneath a running agent, by design —
advisor target_setwrites it, andconfig_advisor'sCommitseeds one on a node that had none. Reading it once meant every such change needed a restart, and the failure pointed away from the cause:Three times on the 1cc r630 this session —
cube-cos-idp, thencube-cos-skylineandcube-cos-ceph. Each one looked like a proxy bug until the file was read side by side with the agent's own startup line (serving … 3 web targetsagainst four in the file).systemctl restart cube-advisor-agentfixed it every time, which is a step nobody should have to know to run.How
WebHandler.Allowbecomes aWebResolver—WebAllowliststill satisfies it, so every existing test is unchanged, andFileAllowlist{Path}resolves against the file each time.Re-reading costs one small read per channel, and a channel is opened by a person clicking a button. Startup still parses the file once, where an operator is watching, so a malformed one is refused before the agent claims to be serving anything.
A file that stops parsing later refuses rather than falling back to the last good copy. An allowlist nobody can read is not one to keep enforcing from memory — the allowlist is the node's veto over what the Advisor may dial, and the safe direction when it becomes unreadable is to dial nothing.
Testing
go test ./...clean.Two cases added: a target added after startup resolves without a restart (before it is added, it refuses with
ErrNotAllowed), and a file that stops parsing refuses rather than serving the last good copy.Reviewer notes
WebHandler.Allowis now an interface, so a nil one refuses everything explicitly rather than panicking — the doc comment said "empty refuses everything" and that stays true of nil.The other half of this — seeding the targets so an operator has fewer to set by hand — is bigstack-oss/cubecos#1482.
🤖 Generated with Claude Code
https://claude.ai/code/session_01PZ5umjjCedZwWtbAbiMjfj
Tracked by #45.