Repository navigation
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 20 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
Turn on auto-fix | Re-trigger cubic
71a0ad4 to
328366c
Compare
There was a problem hiding this comment.
All reported issues were addressed across 9 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
The code looks good at 328366c, but I cannot call it fully proven yet because no test or run drives Not blocking, and you can take or leave these: Is there a smaller design? I looked and found none. Host reuses On the open threads: the cubic P3 thread on the help text assertion still applies, since the test would stay green if Nothing blocks merge once you decide whether to add the end-to-end check. |
328366c to
caaa3a9
Compare
Add `agent-device host`, the Host front-end from ADR 0021 §3. It runs as its own process, starts or reuses the local HTTP daemon, and serves it to remote verification workers through the daemon proxy. Workers authenticate with one persistent service credential. Host creates it on first start at <state dir>/host/service-credential.json (directory 0700, file 0600) and reuses it after every restart. A malformed or group/other-readable file stops startup with a typed reason, and so does a TLS file Host cannot read. Both checks run before any daemon starts. --tls-cert and --tls-key serve HTTPS. A wildcard bind advertises the machine's hostname, since workers cannot dial 0.0.0.0. The proxy command behaves as before. Its daemon startup and listen helpers move into a module both commands use. Closes callstack#3265
- Host checks that the TLS certificate and key load together, and that the key is mode 0600, before any daemon starts. A bind other than loopback without TLS is refused (host-tls-required), so the service token never travels in cleartext. - A new credential reaches disk only once Host is serving, so a start that fails earlier never hides the token from the next one. A credential another start wrote first is refused (host-credential-raced). - A credential that is a link or unreadable gets a typed reason, and platforms without POSIX ownership skip the mode check. - The advertised URL keeps the host name the operator bound to, and the worker command in the startup output names the real URL and token. - The proxy command keeps its original code. Host's daemon and listen helpers live in src/cli/host/local-daemon.ts. - The host help topic moves into its own module.
Add `host` to the reviewed device-claim policy set, give the --tls-cert/--tls-key flags their own Host bucket in the integration progress model, list `hostCommand` with the dynamically loaded CLI handlers in the fallow production exemptions, and waive the operator-facing `host` help topic from the help benchmark.
caaa3a9 to
025fb41
Compare
|
Thanks for the review!
Added it in
Done. A bad PEM or a cert/key mismatch now fails with
Agree it's nicer, but the 3 lists hold different sets of commands (
Kept it separate. #3272 wraps it with the route policy, and its tests call it directly.
Fixed, the test matches the whole sentence now,
Agreed. I'd added a 0600 check because of that thread, now it's gone, so 0640 Also rebased on main after #3262, so Host imports only from |
|
Thanks for the update. Most of the earlier review is now fixed, but one problem remains at 025fb41. The delta reverted proxy.ts to its main version, so src/cli/host/local-daemon.ts now repeats proxy.ts's private helpers. formatHostForUrl, formatOutputValue and waitForever are verbatim copies. resolveLocalDaemonBaseUrl, listenOnTcp and resolveLocalHttpDaemonSettings differ only by a command-name parameter. Proxy and host both front the local HTTP daemon, so each now owns its own copy of the loopback upstream URL, the env mask, bind and listen, and URL formatting. A fix to one, such as the wildcard-advertise fix this PR made for host, will silently miss the other. I approved the earlier head because these helpers were shared. The rule is that each local-daemon front-end helper has one definition and every front-end command imports it. Please restore the 328366c shape. proxy.ts should import resolveLocalHttpDaemonSettings, ensureLocalHttpDaemon, listenOnTcp, formatHostForUrl, formatOutputValue and waitForever from src/cli/host/local-daemon.ts, or from a neutral src/cli/commands location, and its private copies should go. That is an import-only change for proxy, and its existing tests should cover it. Please also drop "proxy is untouched" from the PR body. Not blocking: the ensureDaemon stub at host.test.ts:129 goes through CI is green at 025fb41, with one check and none failing. I did not run host.test.ts locally, and I judged the duplication by reading the code, not by running a mutation. Before merge, proxy.ts needs to import the shared helpers again. On the other open threads, the wildcard-bind advertise thread, the credential-before-daemon-start thread, the host-tls-unreadable thread, the help text threads, the docs thread, the options bucket thread and the topic-coverage waiver thread are all fixed at this head. The key-mode thread is benign, since #3265 needs only host-tls-unreadable and 0640 ssl-cert key layouts must keep working. You can resolve all of them. Cubic has not reviewed this head, so this covers threads from earlier heads only. |
Summary
Adds
agent-device host, the Host front-end from ADR 0021 §3. It runs as its own process, starts or reuses the local HTTP daemon, and serves it to remote verification workers through@agent-device/proxy. Theproxycommand is untouched.Workers authenticate with one service credential at
<state dir>/host/service-credential.json(directory 0700, file 0600). Host writes it once it is serving, prints the token that one time, and reuses it after restarts.Host refuses to start, with a typed reason and before any daemon starts, when:
A wildcard bind advertises the machine's hostname; startup prints the exact worker command.
Closes #3265. 22 files, 991 gross lines, with
chore(gates)last.Validation
Tested commit
025fb41b9:pnpm check:affected --run: all pass except a flakyaffected-selectortest (ENOTEMPTY on temp cleanup; unchanged from main). The 17 checks after it pass when run separately.hostCommandend to end against a stub daemon: public health, 401 for a wrong token, and an authenticated request reaching the daemon with the daemon token, across a restart that prints the token only once;No device-facing change.