Skip to content

✨ Settings: "Post on other projects as" control for remote write identity - #18603

Merged
kubestellar-prow[bot] merged 1 commit into
v5from
feat/remote-write-identity-settings
Nov 17, 2026
Merged

kubestellar-prow[bot] merged 1 commit into
v5from
feat/remote-write-identity-settings

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Part 2 of #18516. It adds the Settings control, the API and the docs on top of the backend already merged in #18521.

Settings → Repos → Reference repos

  • New owner-only control: "Post on other projects as:" with three choices: Hive bot, falling back to me (bot, the default), Hive bot only (bot_only) and Me (owner).
  • Provenance line under the control: "The hive bot (hivecommons-hive[bot]) makes clear the work came from the hive you commissioned, not from you personally; it is used only on projects that installed the hive's GitHub App themselves, and the hive never asks anyone to install it."
  • Per-repo line on every write entry, saying who will post there and why:
    • posts as hivecommons-hive[bot]: App installed on <org>
    • posts as <owner>: App not installed on <org>
    • posts as <owner>: set to post as you
    • read-only: connect your GitHub account
    • read-only: bot only, App not installed on <org>
    • read-only this pass: could not check the App on <org>
  • Copy updates: the owner-account panel no longer says remote writes are "never as the hive's App". The repos card chip shows 🤖 as <bot> for bot-identity entries, and the unresolved chip is back.

API

  • New PUT /api/config/reference-repos/write-identity with body {"write_identity": "bot|bot_only|owner"}. It is owner-only.
    • Before saving, it dry-runs the hand-written entries under the new value and refuses anything boot would exit 22 on, with boot's own message.
    • After saving, it re-resolves the reference repos synchronously.
    • It writes a config_remote_write_identity audit entry, marked sensitive.
  • GET /api/config/reference-repos now also returns write_identity, write_identities and bot_login.
  • Entries and /api/status now carry credential_identity and credential_note.

Docs

  • New "Whose name the writes carry" section in the two-lane doc.
  • New operator-reference row, plus a fix to the stale credential text on write and on the derived-entries row.
  • api-reference and openapi entries.
  • Citations resynced with check-docs-citations.py --fix.
  • The project.remote_write_identity line is removed from the settings-parity allowlist.

Tests

  • api_config_remote_write_identity_test.go: owner-only, validation, the dry-run refusal, persistence, the re-resolve hook, the audit entry, and that re-sending the same value does nothing.
  • reference_repos_editor.test.js: the three choices and the default, PUT then reload, a refusal shown in place, and the per-repo lines for bot, owner, read-only and bot_only.
  • The repos card test now covers the bot chip.

Upgrade

Existing hives have no key, so they read as bot, and the control shows Hive bot, falling back to me. Choosing Me gives the pre-#18516 behaviour everywhere.

Fixes #18516

🤖 Generated with Claude Code

…ne, docs (#18516)

- Settings → Repos → Reference repos: owner-only three-way control
  (Hive bot, falling back to me / Hive bot only / Me) with one provenance
  line; every write entry says which identity posts there and why
  ("posts as hivecommons-hive[bot]: App installed on <org>", "posts as
  <owner>: App not installed on <org>", "read-only: connect your GitHub
  account", "read-only: bot only, App not installed on <org>"). Owner-panel
  copy no longer says remote writes are never the App.
- PUT /api/config/reference-repos/write-identity: validates, dry-runs the
  hand-written entries under the new value (refuses what boot would stop
  on), saves, re-resolves synchronously, audits config_remote_write_identity
  (sensitive). GET /api/config/reference-repos carries write_identity,
  write_identities and bot_login; entries and /api/status carry
  credential_identity and credential_note.
- Repos card chip names the bot identity; unresolved chip restored.
- Docs: two-lane section (whose name the writes carry), operator reference
  row, API reference, openapi. Settings-parity allowlist entry removed.

Fixes #18516

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 17, 2026
@clubanderson

Copy link
Copy Markdown
Member Author

@nate-double-u FYI, this adds the Settings choice for #18516: pick "Hive bot only" under Settings, Repos, Reference repos.

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 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
#18576 ✨ Owner-only Send to on model-owned stage-tracker rows same files dashboard/openapi.json
src/cmd/hive/main.go
src/docs/api-reference/configuration.md
src/pkg/dashboard/deps.go
src/pkg/dashboard/static/index.html
#18611 ✨ meetings: desktop companion meetings (/api/companion/*) same files dashboard/openapi.json
src/docs/api-reference/auth.md
src/docs/api-reference/configuration.md
src/pkg/dashboard/api.go
#18610 ✨ Remote items: follow up on issues and PRs the hive opened as its App bot same files src/docs/agent-configuration.md
#18592 🐛 Betty closes the loop on deep dives; research agents survive config reloads same files src/cmd/hive/main.go
src/pkg/dashboard/static/index.html
#18615 ✨ Meetings: delete finished meetings and stale join requests same files dashboard/openapi.json
src/cmd/hive/main.go
src/pkg/dashboard/static/index.html
#18600 🐛 meetings: log every failed meetings call and keep a failed approval's reason same files src/pkg/dashboard/static/index.html

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 17, 2026
@clubanderson clubanderson changed the title ✨ Settings: "Post on other projects as" control for remote write identity (#18516) ✨ Settings: "Post on other projects as" control for remote write identity Nov 17, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • PR Issue

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.

@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing

7 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/cmd/hive/reference_repos.go 322 CONDITIONALS_NEGATION
src/cmd/hive/reference_repos.go 322 CONDITIONALS_NEGATION
src/cmd/hive/reference_repos.go 325 CONDITIONALS_NEGATION
src/cmd/hive/reference_repos.go 329 CONDITIONALS_NEGATION
src/cmd/hive/reference_repos.go 344 CONDITIONALS_NEGATION
src/cmd/hive/reference_repos.go 344 CONDITIONALS_NEGATION
src/pkg/dashboard/api_config_remote_write_identity.go 66 CONDITIONALS_NEGATION

Verdict: uncovered (#17349).

@Karibhou Karibhou 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.

Review of #18603 against what #18536 handled, as requested. Three points; the first two change behaviour.

1. The Settings per-repo line ignores credential_note and re-infers the reason from the saved setting

referenceRepoIdentityLine(entry, setting) (config-governor.js:1276) drops credential_note (the entries.map at L1472 does not copy it). It rebuilds the text from meta.write_identity. The field contract says the note is "in words the Settings page shows as is" (pkg/config/reference_repos.go, CredentialNote). The repos card in this PR already does that (repos-render.js:400). Consequences:

  • Hive with no GitHub App credentials: the backend resolves owner with this hive has no GitHub App credentials (referenceNoteNoApp). The line says App not installed on <org>, which is wrong. The same applies to read-only: bot only, App not installed on <org> under bot_only.
  • The line follows the saved setting, not the installed resolution, so it can contradict the identity actually used (see 2).

Suggested: 'posts as ' + who + (note ? ': ' + note : ''), 'read-only' + (note ? ': ' + note : ''), 'read-only this pass' + …, with credential_note carried in entries.map. Also: no invented installation status when the note is missing.

2. The PUT is not atomic with re-resolution

  • api_config_remote_write_identity.go:63 writes cfg.Project.RemoteWriteIdentity without holding rt.mu. The derive poller reads that field through deps.writeIdentity inside applyReferenceRepos under rt.mu. That is a data race, and a pass can install policies under a value that L65 then rolls back when saveConfig fails.
  • The dry run (checkRemoteWriteIdentity, hand-written only) and the post-save rederiveReferenceRepos are two separate resolutions. If the second one fails, it only logs previous policies kept. The PUT still returns 200 with the new setting stored while the old policies stay installed.

#18536 handled this with a LockRemoteWriteIdentity dep. It holds rt.mu across dry run → save → publish, keeps the dry-run resolution (pendingIdentity), publishes exactly that one after a successful save, and discards it on a failed save. Request latency is the same, since this PR also runs the full pass synchronously in the request.

3. Tests

The radio group's role="radio"/aria-checked and the three tooltips are implemented identically here but untested. #18536's reference_repos_editor.test.js asserted them (plus the per-repo lines for no GitHub App credentials, token_file, unresolved, and a missing note).

Happy to push these as a follow-up on top of this PR once it lands if that's easier than folding them in here.

@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 17, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[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

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 merged commit 8e6f335 into v5 Nov 17, 2026
110 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/remote-write-identity-settings branch November 17, 2026 03:20
@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Remote repos: per-hive write identity (bot, bot only, or owner)

2 participants