Skip to content

Link routes: cap a late grant at the first deadline, and keep the orphan flag when the pidfile is unreadable #8609

Closed

Description

@lidge-jun

Follow-ups from the fresh final review of #8603 at d63921f (approved with nits; none blocks the merge).

  1. A late grant gives a candidate about 61 s, not the stated 60 s. src/link/route-rounds.ts sets grantedAt = host.now() in the grant tap. If OpenSSH prints the grant line just after spawnedAt + 30 s, before the next 1 s supervisor tick has stopped the candidate as grant_unobserved, readinessDeadline becomes the late grant plus 30 s. The wait is still bounded, but "at most 60 s" in the code comment, structure/remote-link.md, the guide and the PR text is slightly untrue; the probe path already refuses late results. Fix: cap the grant at the first deadline, Math.min(phase.grantedAt, phase.spawnedAt + READY_PROOF_MS) + READY_PROOF_MS, or ignore a grant that arrives after spawnedAt + READY_PROOF_MS. Test: skip READY_PROOF_MS + 500, grant, advance READY_PROOF_MS - 500, expect SIGTERM.

  2. An unreadable pidfile counts as absent when the orphan flag is lifted. src/link/supervisor.ts (the branch where a flagged one-route link gains routes) with readPidfile, which returns null on any read or parse error. The flag is lifted and a candidate spawns while the earlier ssh may still hold the port. The candidate cannot take the port (ExitOnForwardFailure=yes), so the cost is a forward refusal and a 60 s rest. Fix: at that lift site keep the flag unless the read failed with ENOENT.

  3. A stale doc comment. confirmedLineTrust in src/link/route-trust.ts still says "its one line for the alias must carry the confirmed key"; the code now accepts several lines for the alias when they carry the same key type and key.

  4. Test nit. In tests/clients/link-route-supervisor.test.ts the loop that advances the fake clock until a probe appears only proves "within 61 s"; advance straight to the known backoff instead.

Also still open from the earlier review of this PR, by decision: the dashboard shows a generic error for the five new enrollment codes (link_pin_conflict, host_key_changed, trust_file_unexpected, key_cleanup_failed, link_cleanup_uncertain), and no real slow route (for example a relay route to a Windows Child) has been timed against the readiness budget.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions