Skip to content

Install a bundle unattended when no tunnel credential exists - #92

Draft
josephschorr wants to merge 2 commits into
mainfrom
install-channel-endpoint
Draft

josephschorr wants to merge 2 commits into
mainfrom
install-channel-endpoint

Conversation

@josephschorr

Copy link
Copy Markdown
Member

Motivation

oap agent install <bundle> could not complete on OAP Desktop for a bundle
whose manifest declares a webhook channel (requires.channels with a github
channel) when run with nobody at the terminal and no ngrok credential on the
machine. The installer created the webd PublicEndpoint, printed "waiting up
to 3m0s for PublicEndpoint webd to publish a public URL", then failed with
"the public endpoint "webd" did not publish a URL within 3m0s", and nothing
from the bundle was installed. The only way through was to copy the bundle and
set requires: {}.

The wait could not succeed: an endpoint with no credential stays at
Pending/AuthTokenSecretMissing by design. It was also for nothing: the public
URL is read only by a channel's setup flow, and an unattended install never
enters one. It reports each declared channel as skipped and exits 0.

Separately, oap ... </dev/null was treated as interactive while a piped
stdin was not, because the check tested for a character device and the null
device is one.

Summary of changes

  • publicendpoint.PrepareWebdOnDemand plans no endpoint when there is no
    credential (Secret or NGROK_AUTHTOKEN) and nobody to ask. The plan records
    that and exposes MissingCredential(), the sentence saying what is missing
    and what supplies it.
  • oap agent install carries that sentence into the channel summary as a note
    under each skipped webhook channel, next to the existing
    oap channel create finishing command. Exit code stays 0, as for any
    skipped channel.
  • apcmd.StdinIsInteractive uses term.IsTerminal. It has about ten call
    sites (agent install, chat, imagemode, the cloud reporters), so </dev/null
    becomes non-interactive for all of them.
  • oap agent install --help, the generated CLI reference, and the reviewbot
    example README describe the unattended behaviour.

Unchanged: any run with a credential (the tunnel is opened and waited for,
and a tunnel that never comes up still fails with the existing message), any
run with an operator at the terminal, and clusters whose webd already has a
public address.

Worth a reviewer's attention: the old code created the pending endpoint on an
unattended run on purpose, so that a missing credential was reported by the
bounded wait and not silently treated as a decline. This change keeps the
report (the note in the summary) but drops the wait and the failure.

Alternatives considered

  • A flag to skip channel requirements at install time. The installer already
    defers channels on an unattended run; a flag would be a second spelling of
    the same thing and would not have helped anyone who did not know to pass it.
  • Failing fast with a better message when no credential exists. Faster, but
    the bundle still would not install.
  • Creating the Pending endpoint without waiting. Needs a new plan state and
    rollback rules; the re-run with a token already creates it.
  • Making an interactive tunnel failure non-fatal. Out of scope: there the
    setup flow does need the address.

Provenance

  • Author (person, or model and version): Joseph Schorr
  • Harness or tooling, with version:
  • Person who read the diff:

Ship gate

  • mage test:unit
  • mage test:integration
  • mage test:e2e

Results:

Not yet run. What was run locally: go build ./..., go vet on the three
touched packages, and go test -count=1 ./cmd/... (all packages ok). The new
graph test was confirmed to fail with the original three-minute timeout error
when the old planning behaviour is restored. No cluster was used.

Regeneration

  • Changed a +kubebuilder:rbac marker or a CRD-shaping field: n/a
  • Edited anything under config/**: n/a
  • Changed a cobra command or a CRD schema → ran mage docs:cli
    (only oap-agent.mdx kept; the generator also renumbered order: in
    five unrelated pages, left out of this PR)
  • Ran mage fmt:all until mage fmt:check is clean: mage fmt:check
    not run; oxfmt --check passes on the one Markdown file edited

Coverage

  • This adds user-visible behavior, and a bronzethread bundle exercises it,
    or it does not add user-visible behavior. No bundle: the change is
    in the CLI install path, covered by unit tests in
    cmd/oap/internal/agentcmd and cmd/oap/internal/publicendpoint.
  • It touches none of authorization, the SpiceDB schema, or the approver
    model.

Before requesting review

  • The PR holds a single change. Two commits: the stdin detection fix and
    the install fix. They can land independently; they are together because
    both came from the same failed install.
  • A person has read every line of the diff.

StdinIsInteractive tested for a character device, and /dev/null is one,
so `oap ... </dev/null` was read as somebody at the keyboard while a
piped stdin was not. Ask term.IsTerminal instead, as the rest of the CLI
already does.
An unattended `oap agent install` of a bundle declaring a webhook
channel, on a cluster that opens its tunnel on demand, created webd's
PublicEndpoint with no credential, waited out the three-minute bound for
a tunnel that could not open, and failed before applying anything. The
address it waited for is read only by a channel's setup flow, which an
unattended run never enters: it reports those channels as skipped and
exits 0.

Plan no endpoint when there is no credential and nobody to ask for one.
The bundle is installed, and each skipped webhook channel's summary
entry says the tunnel is missing and what supplies the credential. A
run that has a credential, or an operator to ask, behaves as before.
@vercel

vercel Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openagentprimitives Ready Ready Preview Dec 4, 2026 1:25am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 727a6ce8 Deployed Dec 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant