Skip to content

πŸ› fix: restore App reads for opt-in shared-UID agents - #14790

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v5from
thatguywob:fix/14778-shared-uid-read-token
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v5from
thatguywob:fix/14778-shared-uid-read-token

Conversation

@thatguywob

Copy link
Copy Markdown
Contributor

Summary

Shared-UID Kubernetes agents currently have no scoped App cache, so gh run list, gh api, and gh pr view fail even when the hive has working App authentication.

Add default-off github.shared_uid_read_token. With App auth configured, shared-UID agents receive per-agent 0600 cache files and HIVE_AGENT_TOKEN_CACHE at launch, with periodic refresh and credential recovery. Their tokens grant only metadata, contents, actions, checks, pull requests, and issues read access, regardless of agent role. Writes continue through relays; shared agents receive no direct MCP or additional mint credential through this path.

Wire the option into both runtime launch modes, report the posture beside the missing-UID-map boot message, and document setup and the loss of cross-agent read isolation. Existing dedicated-UID behavior stays intact.

Related issues

Fixes #14778

Testing

  • Added regression tests for opt-in/default-off/App-less behavior, launch/refresh/recovery scopes, exact read-only installation permissions, cache delivery and owner-only mode, sidecar delivery, and YAML round trips.
  • gofmt -l on all changed Go files: clean.
  • git diff --check: clean.
  • Not run locally: repository AGENTS.md requires CI validation and forbids local builds/tests in agent panes.

Contributor checklist

  • Added a changelog fragment and updated troubleshooting/configuration guidance.
  • Targets v5, uses the repository title convention, and includes DCO sign-off and issue-author credit.
  • No credentials or runtime state committed.

β€” hive: backend=codex


🐝 Hive Agent: contributor | SHA: 1b47956ff

Mint and refresh read-only per-agent caches when github.shared_uid_read_token is enabled and App auth is configured. Keep shared-UID agents off direct MCP and mint credentials, and document the loss of cross-agent read isolation.

Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>

Hive-Run: hivecommons#14778
Hive-Plan: shared-uid-read-token
Hive-Spec: issue-14778#proposal
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 28, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign danathar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#14702 ✨ review: scale reviewer concurrency up and down with backlog same files src/cmd/hive/main.go
src/hive.yaml.example
src/pkg/config/config.go
#14524 ✨ feat(hub,agent): Hub-coordinated live CLI session pool for multi-tenant runner capacity same files src/cmd/hive/main.go
src/crux/agent/manager.go

@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@thatguywob this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • test (dashboard 3/4)
  • test (dashboard shuffle 1/3)

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (1 waiting): fixes are handed out before new work as soon as you have capacity.

Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision needed: @clubanderson should decide whether shared-UID read tokens are minted automatically whenever App auth is configured (as #14778 proposes) or only behind the new default-off github.shared_uid_read_token flag this PR adds.

Credential-path change; mechanics look sound, but it diverges from the issue on one point a maintainer has to settle.

What I verified at v5 @ 4fc7d11:

  • src/pkg/github/app.go:307-316 adds a shared-uid-read tier whose installation permissions are read-only on metadata/contents/actions/checks/pull_requests/issues, and manager_tokens.go agentTokenTier returns that tier for every UID == 0 agent regardless of role β€” so a shared-UID ci-maintainer cannot obtain a write token through this path. Mint-token issuance and the GITHUB_TOKEN tmux injection are both additionally gated on UID > 0, so shared agents get no second credential.
  • credentials.go WriteAgentToken never chowns (the tree only logs the uid at credentials.go:33-37), so passing agentUID == 0 is safe; the added f.Chmod(0600) defends against the entrypoint's pre-created 0640 group-readable cache from a prior layout. Good.
  • agentTokenCacheEnabled requires m.appAuth != nil, so HIVE_AGENT_TOKEN_CACHE is not exported to a shared-UID agent on an App-less hive β€” the wrapper's existing token_cache_unavailable behaviour is unchanged there.

The decision: #14778 (your proposal) says to mint when UID == 0 and github.app_id is configured β€” no new knob. This PR instead adds github.shared_uid_read_token (config.go:3175-3178, default false) and documents that the reporting OpenShift spoke stays broken until an operator sets it and restarts. The trade is explicit consent to cross-agent cache readability vs. the fleet-generic "just works" the issue asked for. Either is defensible; it is a credentials-posture choice, not a code defect, so I am not judging it. If the opt-in stays, hive.yaml.example:919-922 and troubleshooting.md:366-376 already describe it accurately.

Not a defect, one observation: settings_parity_allowlist.txt marks the key yaml-only; if the flag survives, the dashboard will not surface that a spoke is running with cross-agent read isolation off beyond the boot log line added in manager.go:863-865.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue and removed stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

Head: verdict requires_human @264ff9b, 55/55 checks green, DCO yes, soak 0s of 30m0s.

How to release it:

  • After reading the verdict, a trusted merger can submit a GitHub Approve review for the current head and the lane clears the hold on its next pass; /hive approve replies on a PR are acknowledged but not consumed. An ordinary contributor cannot release their own PR.

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue and removed stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@clubanderson

Copy link
Copy Markdown
Member

/hive decision approve

Approving head 264ff9b with the default-off github.shared_uid_read_token flag as implemented β€” not the auto-mint-whenever-App-auth-exists behaviour #14778 proposed. Shared-UID agents lose cross-agent read isolation by definition, so an operator has to opt in knowingly. The fallback only activates for UID-0 agents when the flag is set and App auth is configured, mints a fixed read-only installation token regardless of role, keeps caches 0600, and never issues mint/MCP credentials on that path, so it does not widen token access to anything that is not a managed agent.

@clubanderson clubanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Owner approval for head 264ff9b β€” see /hive decision approve above. Default-off opt-in flag, read-only token tier, App-only.

@kubestellar-prow kubestellar-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: db2f42c86b9d70f8af11b68c500e8bb26a4d0fe7

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/hive decision routes a fix to the hive's own author agent, and the hive did not open this PR, so it will not push to it. The PR-side equivalents are reviews: Approve head 264ff9b to let it merge as-is, or leave a changes requested review and the author is nudged with your text. See https://github.com/hivecommons/hive/blob/v5/src/docs/maintainer-commands.md.

@hivecommons-hive
hivecommons-hive Bot merged commit ba848b9 into hivecommons:v5 Oct 28, 2026
76 of 81 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#14790264ff9b` sha256:f71a7cc412b2b12b836bae8023267079ba6e7370dd4bd54a55f835aec8e37518 β€” download from the dashboard or `hivectl review evidence #14790`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Merged by hive contributor-lane auto-merge: CI green for β‰₯30m, reviewer verdict not required, @thatguywob holds the trusted tier in this hive's contributor registry.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› gh reads denied (token_cache_unavailable) on k8s hives without a per-agent UID map β€” no App read-token fallback

2 participants