Skip to content

[codex] Fix local wiki health probing#3

Draft
pauljunsukhan wants to merge 1 commit into
mainfrom
codex/fix-open-wiki
Draft

[codex] Fix local wiki health probing#3
pauljunsukhan wants to merge 1 commit into
mainfrom
codex/fix-open-wiki

Conversation

@pauljunsukhan
Copy link
Copy Markdown
Member

@pauljunsukhan pauljunsukhan commented May 13, 2026

Summary

Fixes the macOS menu bar Open Wiki failure class where setup is complete and local web is healthy, but the app or browser path can disagree on wiki.1context.localhost resolution.

Root-cause shape: multi-label .localhost is not a safe dependency across all macOS client paths. On Jackie's Mac, Apple's CFNetwork/URLSession reports DNS failure for wiki.1context.localhost, while curl and some browser paths may still work. The PR now avoids that dependency in both app readiness and default browser-open behavior.

Product Shape

  • Default Open Wiki URL is now https://localhost/your-context.
  • App-internal readiness uses literal loopback: https://127.0.0.1:39191/__1context/health.
  • Privileged proxy/browser edge is verified separately: https://localhost/__1context/health.
  • Branded alias https://wiki.1context.localhost/your-context is still served by Caddy and diagnosed explicitly, but product UI does not depend on it.
  • Branded host health remains diagnostic-only: https://wiki.1context.localhost/__1context/health; it can report dns failed without blocking Open Wiki.
  • Caddy serves all local backend identities: 127.0.0.1, localhost, and wiki.1context.localhost.
  • Diagnose now separates readiness, privileged proxy, branded-host DNS/TLS/content, setup, Caddy, API, LaunchAgent/helper state, and the browser-facing URL.

Review Loop

Ran the requested 3-agent xhigh review:

  • Code-review agent found no Swift/Caddy compatibility blocker after the readiness split.
  • Web/docs agent confirmed RFC/IANA support .localhost subdomains, but Apple/URLSession and browser behavior are not guaranteed uniformly; it recommended localhost for browser-open compatibility.
  • Bug-hunt agent found two real issues, both fixed here:
    • P1: readiness could be green while the branded browser URL remained DNS-broken. Fixed by making Open Wiki/default URL use https://localhost/your-context and keeping the branded host diagnostic-only.
    • P2: scripts/test-release-train.sh fixture commits inherited global GPG signing. Fixed with per-command commit.gpgsign=false.

PR Hygiene

  • Removed unrelated uv.lock and package-lock.json dependency churn from the PR diff.
  • Added an rg fallback in scripts/test-release-train.sh so CI runners without ripgrep can still run the release-train checks.
  • Hardened scripts/test-release-app-product-https.sh to test the localhost product path, keep checking the branded alias, avoid open -n duplicate app launches, and retry each URL while the app/proxy settles.
  • Rebases cleanly onto main at v0.1.75.

Validation

  • swift test --package-path macos -> 84 tests passed.
  • swift test --package-path macos --filter 'OneContextLocalWebTests|OneContextSetupTests' -> 24 tests passed.
  • bash -n scripts/test-release-train.sh && bash -n scripts/test-release-app-product-https.sh && git diff --check
  • ./scripts/test-release-train.sh -> passes with normal global git config.
  • PATH=/usr/bin:/bin:/usr/sbin:/sbin ./scripts/test-release-train.sh -> passes with no rg on PATH.
  • ONECONTEXT_PRODUCT_HTTPS_SMOKE_INTERACTIVE=1 ./scripts/test-release-app-product-https.sh /Applications/1Context.app -> Product HTTPS smoke passed.

Local Mac Proof

Installed a patched dev-channel 0.1.75 build from this branch into /Applications/1Context.app, preserving existing user data/setup, then force-restarted the app/runtime launch agents.

Observed from 1context-cli diagnose:

  • CLI Version: 0.1.75
  • App Version: 0.1.75
  • Runtime Version: 0.1.75
  • App Readiness: ready
  • Local Wiki: reachable
  • Local Wiki URL: https://localhost/your-context
  • Local Web Health: OK
  • Readiness Probe: https://127.0.0.1:39191/__1context/health -> OK
  • Privileged Proxy Probe: https://localhost/__1context/health -> OK
  • Branded Host Probe through app URLSession: dns failed on this Mac, now diagnostic-only
  • Setup Ready: yes
  • API Health: OK

Additional proof:

  • 1context-cli wiki local-url returned https://localhost/your-context.
  • curl https://127.0.0.1:39191/__1context/health returned status: ok.
  • curl https://localhost/__1context/health returned status: ok.
  • curl https://localhost/your-context returned the Your Context page.
  • /usr/bin/open https://localhost/your-context exited 0.
  • Product HTTPS smoke passed against /Applications/1Context.app.

This is the more compatible product shape: Open Wiki uses the most boring macOS-local URL, readiness uses literal loopback, and the branded alias remains observable without being a hard requirement.

@pauljunsukhan pauljunsukhan changed the title [codex] Fix local wiki URL resolution [codex] Fix local wiki health probing May 13, 2026
@pizzacorruption pizzacorruption force-pushed the codex/fix-open-wiki branch 2 times, most recently from 71c9808 to b18860b Compare May 13, 2026 23:28
@pauljunsukhan
Copy link
Copy Markdown
Member Author

This is a much better root-cause candidate than the older "maybe she is still on 0.1.47" theory. If the installed app now reports 0.1.65, then I agree we should treat the current failure as an Open Wiki/local-web readiness problem, not primarily an update-version problem.\n\nThe important nuance for me is that Jackie is not a random edge-case user. She is our cofounder and basically the only other person actively working on 1Context from a separate Mac, so her machine is a high-signal second real environment. At the same time, Paul's machine and our self-hosted M4 Mac runner apparently do not hit this, and the runner can load the system in Safari. So I would not frame this as "Safari/macOS broadly cannot do wiki.1context.localhost" yet. I would frame it as: we have evidence that at least one real macOS app environment can disagree between resolver/client paths, especially around the app's CFNetwork/URLSession readiness probe versus browser/curl behavior.\n\nThat makes the patch direction feel right to me, but I want one more proof loop before we decide this is the final product shape:\n\n1. Install/run a build containing this patch on Jackie's machine.\n2. Prove the app readiness path succeeds through https://localhost/__1context/health.\n3. Prove Caddy/local web is actually healthy.\n4. Press Open Wiki from the menu and show that it opens the browser.\n5. Prove the default browser loads https://wiki.1context.localhost/your-context.\n6. If the branded URL still fails, classify the exact failure: DNS resolution, TLS trust, connection refused, HTTP/content, or browser-open policy.\n\nIf that succeeds, I think the durable product shape is probably:\n\n- keep https://wiki.1context.localhost/your-context as the canonical user/agent URL;\n- use the most boring/reliable loopback endpoint for internal readiness checks, likely https://localhost/__1context/health;\n- make diagnose separate these layers instead of collapsing them into "Could not open wiki": localhost health, branded-host health, TLS trust, privileged proxy, Caddy process, LaunchDaemon/helper state, and browser-open attempt.\n\nThat is not overfitting to one machine; it removes an unnecessary dependency from the internal health check while preserving the branded product URL.\n\nA couple PR-hygiene notes before merge:\n\n- Please strip the unrelated lockfile churn from this PR unless it is truly required for the local-web fix. The uv/package-lock updates make this harder to review.\n- CI is currently red because the runner is missing rg in scripts/test-release-train.sh. That looks unrelated to this patch, but we should still get the PR green or split the runner/tooling fix separately.\n- The release note/PR wording should be careful: not "macOS/Safari cannot resolve *.localhost" as a universal claim, but "the app should not depend on multi-label .localhost resolution in the internal URLSession readiness gate."\n\nNet: I mostly buy the diagnosis, and I like the narrow architectural move. I just want Jackie's actual machine to prove the full user path before we call the incident solved.

@pizzacorruption pizzacorruption force-pushed the codex/fix-open-wiki branch 2 times, most recently from 77ccc53 to f6769e2 Compare May 14, 2026 03:34
Copy link
Copy Markdown
Member Author

Addressed the review loop on this branch.

Changes after the 3-agent review:

  • Open Wiki/default URL now uses https://localhost/your-context, not wiki.1context.localhost.
  • App readiness stays on literal loopback: https://127.0.0.1:39191/__1context/health.
  • wiki.1context.localhost remains served and diagnosed, but no longer blocks readiness or Open Wiki.
  • Fixed release-train fixture commits so global GPG signing cannot fail the script.
  • Hardened the product HTTPS smoke to avoid duplicate app launches and retry all local URL checks while the app/proxy settles.

Validated on Jackie's machine with a patched 0.1.75 app installed in /Applications/1Context.app: diagnose ready, localhost wiki URL reachable, privileged proxy OK, branded probe still DNS-fails in URLSession as expected/diagnostic-only, /usr/bin/open https://localhost/your-context exits 0, and product HTTPS smoke passes.

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.

2 participants