From eb2f1321c9ee74eaedcd1927d4e331ccfaea9077 Mon Sep 17 00:00:00 2001 From: Sebastian Gieseler Date: Tue, 17 Nov 2026 20:45:33 +0100 Subject: [PATCH] fix(links): the public link router keeps its connections, checked per request (#559) The router behind a named tunnel (hub and node) opened a new connection to the service for every request and closed it first, leaving each in TIME_WAIT for two minutes, the class #556 fixed for `forward`. Its `Dial` was also the owner's check that a host is open, so a plain pool by host would have passed a closed link. `Dial` now only checks and returns a `Way` (target key, port, TLS, and the future that connects: TCP on the hub, the lane's tunnel on a node). It is called for every request; only then the router takes a kept connection for that target from `connpool::Pool`, or opens one, and gives it back through `GiveBack`. Connections are keyed by the target, never by the host name. ADR-0091 amended with the review card the owner approved. Closes #559 Bug-Class: connection-per-request Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 10 + crates/devstack-hub/src/publiclinks.rs | 14 +- crates/devstack-node/src/linkrouter.rs | 218 ++++++++++++++---- crates/devstack-node/src/node/links.rs | 56 ++--- ...inks-through-the-users-own-named-tunnel.md | 33 ++- ...ervice-forwards-paths-to-another-server.md | 3 +- docs/adr/README.md | 2 +- 7 files changed, 253 insertions(+), 83 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2632feb9..23e58667 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ and listed with their assets on the ## [Unreleased] +### Fixed + +- **A public link keeps its connections to the service** (#559). The router + behind a named tunnel (on your machine and on a node of the pool) opened a + new connection for every request, which left a socket waiting two minutes + each, as `forward` did before 0.49.2. It now reuses them per service, on a + node together with the lane's tunnel. Every request is still checked + against the links that are open: a link you close refuses the next + request at once, even while a connection to its service is kept. + ## [0.49.2] - 2026-11-17 Fixed: a static service's `forward` keeps its connections to the target diff --git a/crates/devstack-hub/src/publiclinks.rs b/crates/devstack-hub/src/publiclinks.rs index baaea6d4..3ae3240b 100644 --- a/crates/devstack-hub/src/publiclinks.rs +++ b/crates/devstack-hub/src/publiclinks.rs @@ -90,15 +90,15 @@ impl PublicLinks { router_port, pool: Mutex::default(), }); - // The router asks this hub where a host goes: a port here. + // The router asks this hub where a host goes, for every request: a + // port here (#559: the router keeps the connections, not this check). let dialer = Arc::downgrade(&me); let dial: Dial = Arc::new(move |host: String| { - let me = dialer.upgrade(); - Box::pin(async move { - let me = me.ok_or((503, "the hub is stopping".to_string()))?; - let (port, tls) = me.route(&host).map_err(|w| (404, w.to_string()))?; - linkrouter::local(port, tls).await - }) + let me = dialer + .upgrade() + .ok_or((503, "the hub is stopping".to_string()))?; + let (port, tls) = me.route(&host).map_err(|w| (404, w.to_string()))?; + Ok(linkrouter::local(port, tls)) }); tokio::spawn(linkrouter::serve(listener, dial)); let watcher = me.clone(); diff --git a/crates/devstack-node/src/linkrouter.rs b/crates/devstack-node/src/linkrouter.rs index 3e9547fd..4661ff03 100644 --- a/crates/devstack-node/src/linkrouter.rs +++ b/crates/devstack-node/src/linkrouter.rs @@ -32,21 +32,32 @@ const GRACE: Duration = Duration::from_secs(20); pub trait Io: tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin + Send {} impl Io for T {} -/// A connection to the service a host goes to. -pub struct Upstream { - pub io: Box, +/// Opens a connection to a service: TCP here, or a lane's tunnel on a node. +pub type Open = Pin, (u16, String)>> + Send>>; + +/// Where an open host goes, as its owner checked it; not connected yet +/// (#559). The router keeps connections to services and reuses them, keyed +/// by `key`, the target, never the host name: a link closed and opened again +/// for another service never gets the old connection, and every request is +/// checked before a kept connection is taken. +pub struct Way { + /// The target: `local::` here, `lane:::` on + /// a node. + pub key: String, /// Its port, as a browser on its machine names it in `Host`. pub port: u16, /// It speaks TLS (a development certificate). pub tls: bool, + /// Opens a new connection, when none is kept. + pub open: Open, } -/// Where a host goes: a connection, or the status and why not. -pub type Dial = Arc< - dyn Fn(String) -> Pin> + Send>> - + Send - + Sync, ->; +/// Where a host goes, or the status and why not. It only checks: it opens +/// nothing (the router does, with [`Way::open`]). +pub type Dial = Arc Result + Send + Sync>; + +/// Idle connections to services, by [`Way::key`]. +type Kept = Arc>; // ------------------------------------------------------- the connector @@ -231,6 +242,7 @@ pub fn proc_options() -> devstack_proc::Options { /// Serve the router on `listener`, for the process's life. pub async fn serve(listener: tokio::net::TcpListener, dial: Dial) { + let kept: Kept = crate::connpool::Pool::new(crate::connpool::IDLE_MAX); loop { let Ok((stream, _)) = listener.accept().await else { tokio::time::sleep(Duration::from_millis(50)).await; @@ -238,8 +250,10 @@ pub async fn serve(listener: tokio::net::TcpListener, dial: Dial) { }; let _ = stream.set_nodelay(true); let dial = dial.clone(); + let kept = kept.clone(); tokio::spawn(async move { - let service = hyper::service::service_fn(move |r| handle(dial.clone(), r)); + let service = + hyper::service::service_fn(move |r| handle(dial.clone(), kept.clone(), r)); let _ = hyper::server::conn::http1::Builder::new() .serve_connection(TokioIo::new(stream), service) .with_upgrades() @@ -260,6 +274,7 @@ fn text(status: StatusCode, body: String) -> hyper::Response { async fn handle( dial: Dial, + kept: Kept, req: Request, ) -> Result, std::convert::Infallible> { let host = req @@ -268,14 +283,15 @@ async fn handle( .and_then(|h| h.to_str().ok()) .map(|h| h.split(':').next().unwrap_or(h).to_ascii_lowercase()) .unwrap_or_default(); - let up = match dial(host.clone()).await { - Ok(u) => u, + // Every request is checked, a kept connection or not. + let way = match dial(host.clone()) { + Ok(w) => w, Err((status, why)) => { let status = StatusCode::from_u16(status).unwrap_or(StatusCode::BAD_GATEWAY); return Ok(text(status, format!("devstack: {why}\n"))); } }; - Ok(forward(req, &host, up).await.unwrap_or_else(|e| { + Ok(forward(req, &host, way, kept).await.unwrap_or_else(|e| { text( StatusCode::BAD_GATEWAY, format!("devstack: the service does not answer: {e}\n"), @@ -283,47 +299,63 @@ async fn handle( })) } -/// A connection to `port` on this machine's loopback (IPv4, else IPv6: a -/// dev server may listen on `::1` only). -pub async fn local(port: u16, tls: bool) -> Result { - let tcp = match tokio::net::TcpStream::connect(("127.0.0.1", port)).await { - Ok(s) => s, - Err(_) => tokio::net::TcpStream::connect(("::1", port)) - .await - .map_err(|e| (502, format!("nothing answers on port {port}: {e}")))?, - }; - let _ = tcp.set_nodelay(true); - Ok(Upstream { - io: Box::new(tcp), +/// The way to `port` on this machine's loopback (IPv4, else IPv6: a dev +/// server may listen on `::1` only). +pub fn local(port: u16, tls: bool) -> Way { + Way { + key: format!("local:{port}:{tls}"), port, tls, - }) + open: Box::pin(async move { + let tcp = match tokio::net::TcpStream::connect(("127.0.0.1", port)).await { + Ok(s) => s, + Err(_) => tokio::net::TcpStream::connect(("::1", port)) + .await + .map_err(|e| (502, format!("nothing answers on port {port}: {e}")))?, + }; + let _ = tcp.set_nodelay(true); + Ok(Box::new(tcp) as Box) + }), + } } -/// Forward a request over `up`, with the Host a browser on the service's -/// machine sends; WebSockets pass through. -async fn forward( - mut req: Request, - host: &str, - up: Upstream, -) -> Result, String> { - let port = up.port; - let io: Box = if up.tls { +/// A new HTTP/1.1 connection along `open`, with TLS where the service +/// speaks it. +async fn connect( + open: Open, + tls: bool, +) -> Result, String> { + let io = open.await.map_err(|(_, why)| why)?; + let io: Box = if tls { let name = rustls_pki_types::ServerName::try_from("localhost").map_err(|e| e.to_string())?; Box::new( tokio_rustls::TlsConnector::from(any_certificate()) - .connect(name, up.io) + .connect(name, io) .await .map_err(|e| e.to_string())?, ) } else { - up.io + io }; - let (mut sender, conn) = hyper::client::conn::http1::handshake(TokioIo::new(io)) + let (sender, conn) = hyper::client::conn::http1::handshake(TokioIo::new(io)) .await .map_err(|e| e.to_string())?; tokio::spawn(conn.with_upgrades()); + Ok(sender) +} + +/// Forward a request along `way`, with the Host a browser on the service's +/// machine sends; WebSockets pass through. A kept connection to its target +/// is used if there is one; read to its end, the answer's connection is kept +/// for the next request. +async fn forward( + mut req: Request, + host: &str, + way: Way, + kept: Kept, +) -> Result, String> { + let port = way.port; let client_upgrade = req .headers() .contains_key(header::UPGRADE) @@ -342,7 +374,27 @@ async fn forward( header::HeaderValue::from_static("https"), ); } - let mut resp = sender.send_request(req).await.map_err(|e| e.to_string())?; + // A kept connection the service closed while it was idle hands the + // request back unsent: it goes out on a new one. + let Way { key, tls, open, .. } = way; + let (sender, mut resp) = match kept.kept(&key) { + Some(mut s) => match s.try_send_request(req).await { + Ok(r) => (s, r), + Err(mut e) => match e.take_message() { + Some(back) => { + let mut s = connect(open, tls).await?; + let r = s.send_request(back).await.map_err(|e| e.to_string())?; + (s, r) + } + None => return Err(e.into_error().to_string()), + }, + }, + None => { + let mut s = connect(open, tls).await?; + let r = s.send_request(req).await.map_err(|e| e.to_string())?; + (s, r) + } + }; let upgraded = resp.status() == StatusCode::SWITCHING_PROTOCOLS && client_upgrade.is_some(); strip_hop_by_hop(resp.headers_mut(), upgraded); if upgraded && let Some(client) = client_upgrade { @@ -353,13 +405,14 @@ async fn forward( let _ = tokio::io::copy_bidirectional(&mut c, &mut u).await; } }); + // The upgraded connection is the WebSocket's now: not kept. let (parts, _) = resp.into_parts(); return Ok(hyper::Response::from_parts( parts, Full::new(Bytes::new()).map_err(|n| match n {}).boxed(), )); } - Ok(resp.map(BodyExt::boxed)) + Ok(crate::connpool::GiveBack::wrap(kept, key, sender, resp).map(BodyExt::boxed)) } /// Remove the hop-by-hop headers (RFC 9110 ยง7.6.1); an upgrade keeps @@ -576,13 +629,11 @@ mod tests { let router = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); let at = router.local_addr().unwrap(); let dial: Dial = Arc::new(move |host: String| { - Box::pin(async move { - if host == "web-shop.dev.io" { - local(port, false).await - } else { - Err((404, "no public link is open at this address".into())) - } - }) + if host == "web-shop.dev.io" { + Ok(local(port, false)) + } else { + Err((404, "no public link is open at this address".into())) + } }); tokio::spawn(serve(router, dial)); let get = |host: &'static str| async move { @@ -604,4 +655,77 @@ mod tests { let refused = get("other.dev.io").await; assert!(refused.starts_with("HTTP/1.1 404"), "{refused}"); } + + /// A service that keeps its connections open and counts them (#559). + async fn counting_service() -> (u16, Arc) { + let l = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let port = l.local_addr().unwrap().port(); + let accepted = Arc::new(std::sync::atomic::AtomicUsize::new(0)); + let count = accepted.clone(); + tokio::spawn(async move { + while let Ok((s, _)) = l.accept().await { + count.fetch_add(1, std::sync::atomic::Ordering::SeqCst); + tokio::spawn(async move { + let svc = hyper::service::service_fn(|_req| async { + Ok::<_, std::convert::Infallible>(hyper::Response::new(Full::new( + Bytes::from("pong"), + ))) + }); + let _ = hyper::server::conn::http1::Builder::new() + .serve_connection(TokioIo::new(s), svc) + .await; + }); + } + }); + (port, accepted) + } + + /// `GET /` with `host` on a new connection to the router, closed after. + async fn get_at(at: std::net::SocketAddr, host: &str) -> String { + use tokio::io::{AsyncReadExt, AsyncWriteExt}; + let mut s = tokio::net::TcpStream::connect(at).await.unwrap(); + s.write_all( + format!("GET / HTTP/1.1\r\nHost: {host}\r\nConnection: close\r\n\r\n").as_bytes(), + ) + .await + .unwrap(); + let mut out = String::new(); + s.read_to_string(&mut out).await.unwrap(); + out + } + + #[tokio::test] + async fn the_router_reuses_its_connections_to_a_service() { + let (port, accepted) = counting_service().await; + let router = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let at = router.local_addr().unwrap(); + // The owner's links: which hosts are open now. + let open = Arc::new(std::sync::Mutex::new(vec!["web-shop.dev.io".to_string()])); + let links = open.clone(); + let dial: Dial = Arc::new(move |host: String| { + if links.lock().unwrap().contains(&host) { + Ok(local(port, false)) + } else { + Err((404, "no public link is open at this address".into())) + } + }); + tokio::spawn(serve(router, dial)); + for _ in 0..20 { + let r = get_at(at, "web-shop.dev.io").await; + assert!(r.starts_with("HTTP/1.1 200") && r.ends_with("pong"), "{r}"); + } + let n = accepted.load(std::sync::atomic::Ordering::SeqCst); + assert!(n <= 2, "20 requests opened {n} connections to the service"); + + // The owner closes the link: refused, although a connection to the + // service is kept and idle. + open.lock().unwrap().clear(); + let r = get_at(at, "web-shop.dev.io").await; + assert!(r.starts_with("HTTP/1.1 404"), "a closed link passed: {r}"); + // That connection was there: open again, it serves without a new one. + open.lock().unwrap().push("web-shop.dev.io".into()); + let r = get_at(at, "web-shop.dev.io").await; + assert!(r.ends_with("pong"), "{r}"); + assert_eq!(accepted.load(std::sync::atomic::Ordering::SeqCst), n); + } } diff --git a/crates/devstack-node/src/node/links.rs b/crates/devstack-node/src/node/links.rs index 034bf1d4..5caaf533 100644 --- a/crates/devstack-node/src/node/links.rs +++ b/crates/devstack-node/src/node/links.rs @@ -9,7 +9,7 @@ //! offer, nothing runs and the owners' machines carry the links. use super::{Shared, daemon_of}; -use crate::linkrouter::{self, Connector, Dial, Upstream}; +use crate::linkrouter::{self, Connector, Dial, Io, Way}; use crate::publiclinks::{HostsAnswer, HostsReport, Issued, Offer}; use serde_json::Value; use std::collections::{BTreeMap, BTreeSet}; @@ -212,31 +212,40 @@ fn stack_of(d: &crate::lanerun::DaemonAddr) -> Result { } /// Where the router sends a host: the lane's port, through its daemon's -/// tunnel, for the hosts the coordinator gave a record only. +/// tunnel, for the hosts the coordinator gave a record only. The check is +/// made here for every request; the tunnel is opened only when the router +/// keeps no connection to that lane's port (#559). fn dialer(s: std::sync::Weak, state: Arc>) -> Dial { Arc::new(move |host: String| { - let s = s.upgrade(); - let route = { + let s = s + .upgrade() + .ok_or((503, "the node is stopping".to_string()))?; + let r = { let st = state.lock().unwrap(); st.registered .contains(&host) .then(|| st.routes.get(&host).cloned()) .flatten() - }; - Box::pin(async move { - let s = s.ok_or((503, "the node is stopping".to_string()))?; - let r = route.ok_or((404, "no public link is open at this address".to_string()))?; - let lease = s - .leases - .lock() - .unwrap() - .get(&r.lease) - .cloned() - .ok_or((404, "its lane is gone".to_string()))?; - let d = daemon_of(&s, lease) - .await - .map_err(|_| (502, "its lane's daemon does not answer".to_string()))?; - tunnel_to(&d, r.port, r.tls).await + } + .ok_or((404, "no public link is open at this address".to_string()))?; + let lease = s + .leases + .lock() + .unwrap() + .get(&r.lease) + .cloned() + .ok_or((404, "its lane is gone".to_string()))?; + let (port, tls) = (r.port, r.tls); + Ok(Way { + key: format!("lane:{}:{port}:{tls}", r.lease), + port, + tls, + open: Box::pin(async move { + let d = daemon_of(&s, lease) + .await + .map_err(|_| (502, "its lane's daemon does not answer".to_string()))?; + tunnel_to(&d, port).await + }), }) }) } @@ -245,8 +254,7 @@ fn dialer(s: std::sync::Weak, state: Arc>) -> Dial { async fn tunnel_to( d: &crate::lanerun::DaemonAddr, port: u16, - tls: bool, -) -> Result { +) -> Result, (u16, String)> { let bad = |e: String| (502, format!("the lane's daemon: {e}")); let tcp = tokio::net::TcpStream::connect(&d.addr) .await @@ -278,9 +286,5 @@ async fn tunnel_to( let up = hyper::upgrade::on(resp) .await .map_err(|e| bad(e.to_string()))?; - Ok(Upstream { - io: Box::new(hyper_util::rt::TokioIo::new(up)), - port, - tls, - }) + Ok(Box::new(hyper_util::rt::TokioIo::new(up))) } diff --git a/docs/adr/0091-public-links-through-the-users-own-named-tunnel.md b/docs/adr/0091-public-links-through-the-users-own-named-tunnel.md index d53e6cbf..237a9178 100644 --- a/docs/adr/0091-public-links-through-the-users-own-named-tunnel.md +++ b/docs/adr/0091-public-links-through-the-users-own-named-tunnel.md @@ -1,6 +1,6 @@ # ADR-0091: Public links can go through the user's own named tunnel, at stable addresses; the hub runs its one connector -- **Status:** Accepted (card in the pull request); built; its step 3, the pool, built by [ADR-0092](0092-public-links-through-the-pool.md) +- **Status:** Accepted (card in the pull request); built; its step 3, the pool, built by [ADR-0092](0092-public-links-through-the-pool.md); amended 2026-11-17 (the router keeps its connections to services, checked per request, #559) - **Date:** 2026-11-03 - **Deciders:** project owner - **Related:** [ADR-0090](0090-a-service-can-get-a-public-link-by-hand.md) (public links as Quick Tunnels, which this extends; its points 1 to 3 hold here too), [ADR-0069](0069-devstack-mcp-can-carry-the-tools-of-upstream-mcp-servers.md) (the hub's keychain), [ADR-0053](0053-whoever-a-lane-is-shared-with-connects-to-it.md) (connecting a lane as a whole), [ADR-0045](0045-the-hub-notifies-the-desktop.md) (the hub follows every tree's events), [ADR-0023](0023-stack-file-compatibility.md), [ADR-0070](0070-a-review-card-comes-before-the-code-an-adr-records-what-was-built.md) @@ -85,3 +85,34 @@ and `crates/devstack-env/src/lib.rs` (point 5), `crates/devstack/src/hubcmd.rs` (points 6, 7), `crates/devstack/tests/daemon_lifecycle.rs` (`a_named_tunnel_gives_stable_addresses_and_needs_the_hub`), `docs/stack-file.md` ("Stable addresses"). + +## Amendment 2026-11-17: the router keeps its connections, checked per request (#559) + +The router (`linkrouter.rs`, shared by the hub and a node) opened a new +connection to the service for every request and closed it first, leaving +each in `TIME_WAIT` for two minutes: the class #556 fixed for a static +service's `forward`. Its `Dial` was both the way to the service and the +owner's check that the host is open, so a pool keyed by host would have +passed a link its owner closed. + +The owner approved the review card in the conversation on **2026-11-17**, +all three points: + +| # | Category | Point | Beats | Reversing costs | +|---|---|---|---|---| +| 1 | trust | Every request passes the owner's check before a byte goes to a service; the check (`Dial`) opens nothing, it says whether the host is open and where it goes, and only then a kept or new connection is taken. | A pool by host that skips the check for a kept connection | Low | +| 2 | trust | Kept connections belong to the target (here: port and TLS; on a node: lease, port, TLS), never to the host name; one that no open link leads to idles until the service closes it, unreachable without passing the check. | Dropping a link's connections when it closes (an event per close, protecting nothing point 1 does not) | Low | +| 3 | concept | The rules of #556: up to 32 idle per target, given back at the end of the answer; upgrades and streams that do not end keep their own; on a node the lane daemon's tunnel is reused with its connection. | Keeping the TCP connection and opening the tunnel each time | Low | + +As built: `Dial` returns a `Way` (`key`, `port`, `tls`, and `open`, the +future that connects: TCP here, the lane's tunnel on a node) and is called +for every request. The router keeps a `connpool::Pool` by `Way::key`, sends +on a kept connection or opens one along `open` (TLS on top where the +service speaks it), resends a request a kept connection handed back unsent +on a new one, and gives a connection back through `GiveBack`. The hub's +`route` and the node's registered-host and lease check stay where they +were; the node's look-up of the lane's daemon moved into `open`. Tests: +`linkrouter::tests::the_router_reuses_its_connections_to_a_service` (20 +requests, at most 2 connections; red with one per request), and in it a +request after the link closed is a `404` while a connection to the service +is kept and idle, which serves again once the link is opened again. diff --git a/docs/adr/0110-a-static-service-forwards-paths-to-another-server.md b/docs/adr/0110-a-static-service-forwards-paths-to-another-server.md index 6fc848ae..e829e744 100644 --- a/docs/adr/0110-a-static-service-forwards-paths-to-another-server.md +++ b/docs/adr/0110-a-static-service-forwards-paths-to-another-server.md @@ -119,4 +119,5 @@ had the same flaw. Two places keep their own way: the service proxy's pool is tied to the drain of an instance it switches away from, and the public link router (`linkrouter.rs`) still opens a connection per request, since its `Dial` is also its check that a host is still open; a kept connection -would pass a link its owner closed. +would pass a link its owner closed. (It keeps its connections since #559, +with that check made for every request: ADR-0091, amendment.) diff --git a/docs/adr/README.md b/docs/adr/README.md index 0a02728e..25893fe7 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -173,7 +173,7 @@ stay. | [0088](0088-a-lane-shows-how-far-its-branch-is-ahead-and-behind.md) | A lane shows how far its branch is ahead of and behind its upstream, from the local refs only | Accepted (card in the pull request); built | | [0089](0089-a-folder-scan-filters-and-adds-repositories-not-set-up.md) | A folder scan filters by git and stack file, one level deep by default, and adds a repository without a stack file as not set up | Accepted (card in the pull request); built | | [0090](0090-a-service-can-get-a-public-link-by-hand.md) | A service can get a public link, by its owner's hand: a Cloudflare Quick Tunnel to its fixed port | Accepted (card in the pull request); built; extended by ADR-0091 (the user's own named tunnel) | -| [0091](0091-public-links-through-the-users-own-named-tunnel.md) | Public links can go through the user's own named tunnel, at stable addresses; the hub runs its one connector | Accepted (card in the pull request); built; its step 3, the pool, built by ADR-0092 | +| [0091](0091-public-links-through-the-users-own-named-tunnel.md) | Public links can go through the user's own named tunnel, at stable addresses; the hub runs its one connector | Accepted (card in the pull request); built; its step 3, the pool, built by ADR-0092; amended 2026-11-17 (the router keeps its connections, checked per request, #559) | | [0092](0092-public-links-through-the-pool.md) | A pool can give its members public links below a zone of its own; the coordinator holds the token, each machine gets its own tunnel | Accepted (card in the pull request); built | | [0093](0093-the-main-tree-takes-its-profile-when-it-starts.md) | The main working tree takes its profile when it starts; the daemon carries none | Accepted (card in the pull request); built | | [0094](0094-a-skill-carries-hooks-that-give-text-to-the-agents.md) | A skill carries hooks that give text to the agents; the hub writes one entry per agent and event, `devstack hook` picks the texts | Accepted (card in the pull request); built; addenda 2026-11-06 (end-of-session events `lane-stop`, `session-end`; an upstream the agent has set up itself counts) |