Repository navigation
feat(planning): lease and route the shared interview's named tunnel - #10832
Conversation
Before this machine starts the named tunnel, ensure-running asks https://<hostname> itself: a live interview server or another connector answering means the link is held, so the session falls back to a quick tunnel and says why (stderr and tunnelFallback). With the new --tunnel-api-token-file, it points the tunnel's ingress at this session's actual guest port, so any free port works. A token file that cannot be used falls back instead of refusing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nel lease Adds the tunnel_api_token_file option to plugin.json, the options table, the interview skill's Variables line and lane-shared.md's ensure-running command. The shared README replaces "one machine per tunnel" with the lease and route behavior, names the tunnel-only token's permission, and fixes setup step 1's permission naming. Changelog fragment included. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An unset userConfig key can reach the skill as its literal token; a named tunnel then keeps today's fixed-port behavior instead of falling back to a quick tunnel. Neutral wording for a link answer that is not the no-connector page, and no unsourced claim about the connections list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5a9e6dc9b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
claude-security-review reviewed Security review of #10832 (named-tunnel lease and route for the shared interview). I read the whole diff and PR context, and checked the changed critical-findings: 0 Manifest
Checked, no finding
Note, not counted: the API token's permission ("Cloudflare One Connector: cloudflared Write") can change every tunnel in the account. The PR documents this in the README, the option descriptions and the changelog. The option is opt-in, with an empty default. |
|
claude-review reviewed No blocking or advisory findings on What I checked
Manifest (
Minor, not counted as a finding. Spend. Nothing here can start a real charge. The new API-token option calls Cloudflare's tunnel endpoints with the owner's own token, and the PR changes no plan or billing setting. Closing issue. The PR says "Refs #8607" and closes nothing, so there are no acceptance criteria to check. No embedded instructions appeared in the PR text. |
Only Cloudflare's no-connector page (HTTP 530 whose text reads "Error 1033", matched apart from its <span> markup) leaves the link free; a DNS failure, refused connection, timeout or TLS error now counts as held. With the API token file, a session refuses the tunnel while another machine's connector is connected (matched against the Connector ID cloudflared logs), merges only its hostname's rule into the tunnel's configuration (GET, merge, PUT on a change) instead of replacing it, and after starting re-reads the connectors and the route, ending its named tunnel at once when a second machine started alongside. The server's restart of an exited named tunnel goes through the same lease and route: a certain holder gets a quick tunnel, an unclear answer a retry. A session whose own named tunnel runs keeps it when a token file turns unusable, the record keeps apiTokenFile so a re-run without the flags stays routed, both token file options accept ~/, and a bare exception names its type in the probe's reason. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…checks The connector API token can change every tunnel in the account, not only this one: the setup step and option descriptions say so and recommend keeping the account's tunnels to this use. The README's lease section covers the connector check, the merged route, the restart path and the window the lease cannot see; setup step 5 no longer limits the options to one machine; both token file options document ~/ paths. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the lease The connector check now takes the Connector IDs from both the running record and the last record for the link, so a dead cloudflared of this session still listed by Cloudflare is not read as another machine. The server's tunnel watch passes its record the same way; a test covers the routed restart through it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… race A named start that confirm ended after a race restarted through tunnel.ensure with no verify, which ended the quick tunnel guests still held. tunnel.fall_back ends the named tunnel and makes the retired quick tunnel live again when it still runs; ensure-running and the server's restart use it. confirm now answers uncertain when this cloudflared logged no Connector ID and any connector is listed, instead of taking a lone connector as its own. A ~/ token path is normalized, so Windows gets native separators. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rview-named-tunnel
Post-merge mutation testingKilled 0, survived 0, timeout 0, no coverage 0, invalid 0, not run 7.
The run's summary has the full report. |
Refs: #8607
Summary
Shared
/planning:interviewsessions get one stable guest link,https://<tunnel_hostname>, usable from any machine in the owner's fleet on any local guest port. The issue closes separately once the fleet settings land.Fix
ensure-runningprobes the link itself (/api/tunnel-probe/<nonce>). Another live interview answering means this session falls back to a quick tunnel and reports why intunnelFallback; Cloudflare's 530 / error 1033 no-connector page means the link is free. This is a best-effort check, not an atomic lease (see Known limits).tunnel_api_token_fileoption: a Cloudflare account API token with "Cloudflare One Connector: cloudflared Write". With it, the session checks the tunnel's connectors and merges its hostname's ingress rule to its own guest port, so the fixed-8765 rule no longer applies. Without it the guest port stays fixed at 8765.shared/README.md(named tunnel lease and setup),lane-shared.md, plugin options, changelog fragment.Verification
test_share,test_tunnel,test_cfdns,test_server: 478 tests pass, 1 Windows-only skip. Ruff (pinned wrapper) clean.validate-plugin-contracts,sync-plugin-options-docs --checkandinterview-defenses.test.sh(172 pass) green. 4 mutants killed, plus 3 on the review fixes (regression fix removed, bare-1033 match, exception naming), each failing a new test.--guest-port 8790plus hostname, run-token and API-token files:"tunnel": "named", public URL HTTP 200, tunnel ingress read back ashttp://127.0.0.1:8790, one connector."tunnel": "quick",tunnelFallbackset./api/statereturned HTTP 530. B'sensure-runningre-run:"tunnel": "named",shareChanged: true, same#joinkey kept, public URL HTTP 200, ingress read back ashttp://127.0.0.1:8791.<span>Error</span> <span>1033</span>; the match strips tags first.connector).apiTokenFile). A certain holder gets a quick tunnel (guests on the named link then reach the other machine, so no page can learn the new link); an unclear answer leaves the tunnel down and retries after the backoff.path; a per-ruleoriginRequeststays), inserts the rule before the catch-all when absent, keepsoriginRequest,warp-routingand other rules, and PUTs only on a change.Error 1033would never match Cloudflare's real page);str(exc) or type(exc).__name__names a bareTimeoutError; the--tunnel-token-filehelp, README step 5, and the staleset tunnel_api_token_filehint on a re-run without flags are fixed.~/, expanded before the checks; cloudflared gets the expanded absolute path.test_shareandtest_server; the four suites pass (1 Windows-only skip).tunnel.fall_back), instead of ending it for a new link no page can learn; andconfirmtreats a lone listed connector as unclear when its own cloudflared logged no Connector ID.~/expansion now normalizes the path (os.path.normpath), so cloudflared gets native separators;test_token_files_may_start_with_a_tilde_and_resolve_under_homefailed on Windows before it. TheConnectionAbortedErrorintest_unknown_routes_are_404on b3a6eb6's Windows run did not recur on 9a7506c.Related
🤖 Generated with Claude Code