Skip to content

fix(selfhost): unset POSTHOG_CLI_HOST when blank, don't pass empty#8622

Merged
JSONbored merged 2 commits into
mainfrom
claude/fix-posthog-cli-host-empty
Jul 25, 2026
Merged

fix(selfhost): unset POSTHOG_CLI_HOST when blank, don't pass empty#8622
JSONbored merged 2 commits into
mainfrom
claude/fix-posthog-cli-host-empty

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Third fix in this same chain (#8619#8621 → this): confirmed live that orb-v3.4.0-beta.8's release build failed with Oops! Invalid Host: "Host must be a valid URL" from posthog-cli itself. POSTHOG_CLI_API_KEY/POSTHOG_CLI_PROJECT_ID both resolved correctly this time (the #8621 fix worked) — but POSTHOG_CLI_HOST isn't configured as a secret (US-cloud default, correctly left unset), and secrets.POSTHOG_CLI_HOST resolves to an empty string, not an absent variable, when a secret name doesn't exist. posthog-cli treats a present-but-empty host as an explicit invalid URL rather than "use the default."

Mirrors the old SENTRY_URL handling this pipeline replaced (if [ -z "${SENTRY_URL:-}" ]; then unset SENTRY_URL; fi). scripts/deploy-selfhost-prebuilt.sh's own ${host:+-e POSTHOG_CLI_HOST=...} conditional expansion already avoided this correctly — only the GitHub Actions YAML (which has no equivalent conditional-env-inclusion syntax) needed the explicit unset.

Test plan

  • python3 -c "import yaml; yaml.safe_load(...)" — valid YAML
  • npm run actionlint — clean
  • Will re-trigger the beta build once merged and confirm the full pipeline (inject → validate → upload → validate-release → Docker build/push) completes end to end

posthog-cli treats a present-but-empty POSTHOG_CLI_HOST as an explicit
(invalid) URL rather than "unset, use the default" -- confirmed live:
orb-v3.4.0-beta.8's release build failed with `Oops! Invalid Host: "Host
must be a valid URL"` because the workflow always sets the env var to
`secrets.POSTHOG_CLI_HOST`, which resolves to an empty string (not an
absent var) when the secret doesn't exist. Mirrors the old SENTRY_URL
handling this replaced (`if [ -z "${SENTRY_URL:-}" ]; then unset
SENTRY_URL; fi`). scripts/deploy-selfhost-prebuilt.sh's own
${host:+-e POSTHOG_CLI_HOST=...} already avoided this correctly.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.64%. Comparing base (a3465a1) to head (35aca7b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8622      +/-   ##
==========================================
+ Coverage   92.76%   93.64%   +0.87%     
==========================================
  Files         797      701      -96     
  Lines       79355    56878   -22477     
  Branches    24034    20151    -3883     
==========================================
- Hits        73616    53262   -20354     
+ Misses       4592     2647    -1945     
+ Partials     1147      969     -178     
Flag Coverage Δ
backend 93.64% <ø> (ø)
control-plane ?
rees ?

Flags with carried forward coverage won't be shown. Click here to find out more.
see 96 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 25, 2026
@loopover-orb

loopover-orb Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-25 14:37:34 UTC

1 file · 1 AI reviewer · 2 blockers · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
Adds `if [ -z "${POSTHOG_CLI_HOST:-}" ]; then unset POSTHOG_CLI_HOST; fi` before both posthog-cli invocations in release-orb.yml, unsetting the env var when the underlying secret resolves to an empty string (which happens when POSTHOG_CLI_HOST isn't configured as a secret). This correctly mirrors the described root cause: posthog-cli treats a present-but-empty POSTHOG_CLI_HOST as an explicit invalid URL rather than absent-use-default, and the pattern matches the pre-existing SENTRY_URL handling this pipeline replaced. The fix is applied consistently at both call sites (Upload PostHog source maps and Validate PostHog release), so posthog-cli will fall back to its default host when the secret is unset.

Nits — 3 non-blocking
  • The two `unset` guard blocks are identical shell one-liners duplicated across two steps; a shared composite action or script could DRY this, though the duplication is minor given YAML step isolation.
  • The FAILED validate-tests/validate checks have no detail provided, so their cause can't be verified from this diff alone.
  • Consider extracting the `if [ -z "${VAR:-}" ]; then unset VAR; fi` pattern into a small reusable shell function or composite step if more secrets get this treatment in the future (file: .github/workflows/release-selfhost.yml).

Concerns raised — review before merging

  • No linked issue detected: No closing reference or linked issue number was found in the PR metadata/body. — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue: This repo's maintainer focus manifest requires every PR to reference a tracked issue. — Link the relevant issue (for example Closes #123) before opening the PR.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. No linked issue detected: No closing reference or linked issue number was found in the PR metadata/body. — If this PR is intended to solve an issue, link it explicitly in the PR body.

2. Maintainer requires a linked issue: This repo's maintainer focus manifest requires every PR to reference a tracked issue. — Link the relevant issue (for example `Closes #123`) before opening the PR.

Decision drivers

  • ❌ Code review — 2 blockers (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 13 registered-repo PR(s), 13 merged, 235 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 13 PR(s), 235 issue(s).
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Ruby, Go, MDX, Shell, Solidity, JavaScript
  • Official Gittensor activity: 13 PR(s), 235 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Then work through the remaining 2 steps in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 25, 2026
The previous commit's own comment named the old SENTRY_URL var literally,
which trips this file's own docs-selfhost-posthog-release.test.ts
assertion (not.toContain("SENTRY_")) added when Sentry was removed from
this pipeline. Same guard, reworded without the literal substring.
@JSONbored
JSONbored merged commit 5f5f52b into main Jul 25, 2026
7 checks passed
@JSONbored
JSONbored deleted the claude/fix-posthog-cli-host-empty branch July 25, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant