[codex] Fix local wiki health probing#3
Conversation
55f54eb to
2a4a9f9
Compare
71c9808 to
b18860b
Compare
|
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. |
77ccc53 to
f6769e2
Compare
f6769e2 to
b77ab2d
Compare
|
Addressed the review loop on this branch. Changes after the 3-agent review:
Validated on Jackie's machine with a patched |
Summary
Fixes the macOS menu bar
Open Wikifailure class where setup is complete and local web is healthy, but the app or browser path can disagree onwiki.1context.localhostresolution.Root-cause shape: multi-label
.localhostis not a safe dependency across all macOS client paths. On Jackie's Mac, Apple's CFNetwork/URLSessionreports DNS failure forwiki.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
https://localhost/your-context.https://127.0.0.1:39191/__1context/health.https://localhost/__1context/health.https://wiki.1context.localhost/your-contextis still served by Caddy and diagnosed explicitly, but product UI does not depend on it.https://wiki.1context.localhost/__1context/health; it can reportdns failedwithout blocking Open Wiki.127.0.0.1,localhost, andwiki.1context.localhost.Review Loop
Ran the requested 3-agent xhigh review:
.localhostsubdomains, but Apple/URLSession and browser behavior are not guaranteed uniformly; it recommendedlocalhostfor browser-open compatibility.https://localhost/your-contextand keeping the branded host diagnostic-only.scripts/test-release-train.shfixture commits inherited global GPG signing. Fixed with per-commandcommit.gpgsign=false.PR Hygiene
uv.lockandpackage-lock.jsondependency churn from the PR diff.rgfallback inscripts/test-release-train.shso CI runners without ripgrep can still run the release-train checks.scripts/test-release-app-product-https.shto test thelocalhostproduct path, keep checking the branded alias, avoidopen -nduplicate app launches, and retry each URL while the app/proxy settles.mainatv0.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 norgonPATH.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.75build 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:0.1.750.1.750.1.75readyreachablehttps://localhost/your-contextOKhttps://127.0.0.1:39191/__1context/health->OKhttps://localhost/__1context/health->OKURLSession:dns failedon this Mac, now diagnostic-onlyyesOKAdditional proof:
1context-cli wiki local-urlreturnedhttps://localhost/your-context.curl https://127.0.0.1:39191/__1context/healthreturnedstatus: ok.curl https://localhost/__1context/healthreturnedstatus: ok.curl https://localhost/your-contextreturned theYour Contextpage./usr/bin/open https://localhost/your-contextexited0./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.