Skip to content

fix(pm-stack): align ready-for-agent bind scope to loopback + tailnet (#1181) - #4657

Merged
dezren39 merged 1 commit into
mainfrom
queue/6555-1181-rfa-bind-scope
Nov 3, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/6555-1181-rfa-bind-scope

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Closes the bind-scope half of #1181 (issue stays open until the deploy verification below lands).

Problem (verified by triage task 2470, 2026-11-02)

ready-for-agent listened on 0.0.0.0:6056 (live ss probe) while Grist (8484), Pad (7777) and the aggregator (4870) bind loopback + the host tailnet address only. The all-interfaces bind also claims any future WAN-facing interface — broader than the stack's settled access model (loopback + tailnet; public only behind a password).

Fix

Upstream ready-for-agent start --host <addr> binds a single address, so loopback+tailnet needs a forward for one of them:

  • nixos/services/pm-apps/default.nix (the live source — the running unit is home-manager generated from this module): the app drops bare --host and keeps upstream's loopback default; a new socket-activated ready-for-agent-tailnet unit runs systemd-socket-proxyd on ${tailnetAddress}:6056 → 127.0.0.1:6056 — the same scope Grist/Pad get from dual port publishes.
  • pm-stack/ready-for-agent/systemd/ready-for-agent.service: kept in sync (loopback bind; header explains the tailnet proxy lives in the Nix module; a standalone install is loopback-only).
  • pm-stack/aggregator/src/topology.ts + pm-stack/README.md: bind rows now state loopback + tailnet (the topology row's "(bind scope tracked in fix(pm-stack): ready-for-agent binds 0.0.0.0:6056 while the rest of the stack binds loopback+tailnet - align bind scopes #1181)" marker is resolved).

Verification done

  • nix-instantiate --parse on the module: OK.
  • Aggregator topology tests on the laptop: bun test test/topology.test.ts — 2 pass.
  • Consumers re-checked at HEAD: aggregator defaults to http://127.0.0.1:6056; browser service-links use the tailnet host — both preserved. No LAN-address consumer exists in the repo.

Deploy / remaining verification (post-merge)

Rebuild from the laptop primary (nixos-rebuild switch), then confirm: ss shows 6056 on 127.0.0.1 + the tailnet address only, the UI answers on both, and the aggregator health probe for ready-for-agent stays green. Task 6555 tracks this in the queue result.

Queue: task 6555 (repo-health-code-pilot), follow-up to triage task 2470.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…#1181)

The app ran with bare --host (0.0.0.0:6056, every interface incl. any future WAN-facing one) while Grist, Pad and the aggregator bind loopback + tailnet only. Upstream --host takes a single address, so: the app drops --host and keeps its loopback default, and the Nix module (the live source — the running unit is home-manager generated) adds a socket-activated systemd-socket-proxyd unit listening on the tailnet address and forwarding to 127.0.0.1:6056. Standalone unit file kept in sync (loopback-only there), aggregator topology string and README row updated. Deploy = merge + nixos-rebuild from the primary; verify with ss (6056 on 127.0.0.1 + tailnet only) and the aggregator health probe.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 23:24
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 93dbe566-2f28-433d-9149-a24c9f519901
Commits

Reviewing files that changed from the base of the PR and between 17610f5 and 5ec2fc6.

Files selected for processing: 4
  • nixos/services/pm-apps/default.nix
  • pm-stack/README.md
  • pm-stack/aggregator/src/topology.ts
  • pm-stack/ready-for-agent/systemd/ready-for-agent.service
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T23:26:35.564710Z 5ec2fc6 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ec2fc6ddc

ℹ️ 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".

};

Service = {
ExecStart = "/run/current-system/sw/bin/systemd-socket-proxyd 127.0.0.1:6056";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resolve the proxy executable from the systemd package

On the NixOS deployment, this points into the system profile's bin directory, but systemd-socket-proxyd is installed as a helper under lib/systemd, not bin; a repo-wide search found no wrapper or symlink exposing it at this path. Consequently, incoming tailnet connections activate a service that fails to execute, while the app now accepts only loopback connections, removing remote access. Reference ${config.systemd.package}/lib/systemd/systemd-socket-proxyd instead. The upstream service example likewise uses ExecStart=/usr/lib/systemd/systemd-socket-proxyd.

Useful? React with 👍 / 👎.

Comment on lines +151 to +153
Socket = {
ListenStream = "${cfg.tailnetAddress}:6056";
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow the tailnet socket to bind before Tailscale is ready

If the lingering user manager starts before Tailscale assigns cfg.tailnetAddress at boot, this socket fails with EADDRNOTAVAIL. It is enabled through the user's sockets.target, with neither address-readiness ordering nor a retry mechanism, so the later appearance of the tailnet address does not restore remote access without restarting the socket. Set FreeBind = true so the listener can be established before the address exists; the systemd socket documentation states that this option defaults to false and recommends it when binding a specific IP address.

Useful? React with 👍 / 👎.

@dezren39
dezren39 merged commit 745c8b7 into main Nov 3, 2026
2 checks passed
@dezren39
dezren39 deleted the queue/6555-1181-rfa-bind-scope branch November 3, 2026 11:02
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.

1 participant