Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

docs(push-notify): state what an old backend really costs per batch

review06117c90368b
diff --git a/docs/hosted-team-relay.md b/docs/hosted-team-relay.md
index 4989c9054..122c1de63 100644
--- a/docs/hosted-team-relay.md
+++ b/docs/hosted-team-relay.md
@@ -749,7 +749,14 @@ proves again.
or old-backend verdict with a negative age is expired). notify and live-update each hold their
own.
- A backend without the proof (challenge 404/405, or no host-auth route) is remembered for 10
- minutes, so it costs one challenge per 10 minutes rather than one per batch.
+ minutes. While that backend accepts the host's posts, the proof costs one challenge per 10
+ minutes (plus the host-auth post, when the challenge answered 200) rather than one per batch.
+ A post it refuses with a 403 forgets the verdict (see below), and an old backend refuses every
+ post from a host with no live pairing (`403 forbidden`). While it does, **every batch** costs
+ the challenge plus the post: one request more per batch than before the proof existed, and
+ live-update can flush once a second. That case ends once the backend with the proof is
+ deployed: its host-auth refuses such a host `forbidden` instead, which is backed off like any
+ other failed proof, and no post goes out.
- Failed proofs back off 0, 5, 15, then 60 s between attempts, since every attempt spends the
per-IP challenge budget the mint needs too. A hold further out than 60 s can only be a clock
that stepped back, and is ignored.
@@ -760,8 +767,9 @@ proves again.
was already on file from an earlier batch, the likely cause is that the host latched since
(through the phone relay's mint, or the other push stream): the batch proves at once and, if that
yields a session, is re-posted **once** with it; otherwise it is dropped. A verdict fetched in the
- same batch is not fetched again, so an old backend that refuses this host costs the same two
- requests per batch it always did.
+ same batch is not fetched again, so an old backend that refuses this host costs two requests per
+ batch (the challenge and the post), not three. That is still one more than before the proof
+ existed (see the bullet on a backend without the proof).
- The Server Edition pushes only in granted mode (per-grant bearer tokens, no host identity), so
there is nothing to prove there.
diff --git a/src/core/push-notify.test.ts b/src/core/push-notify.test.ts
index fac2994b9..7e4bf7a82 100644
--- a/src/core/push-notify.test.ts
+++ b/src/core/push-notify.test.ts
@@ -2169,9 +2169,10 @@ describe('host-mode push proves possession of the host key (hostAuth session)',
h.stop()
})
- it('an old backend that refuses every host notify (403 forbidden) costs what it always did: challenge + notify per batch', async () => {
+ it('an old backend that refuses every host notify (403 forbidden) costs challenge + notify per batch, never a third request', async () => {
// The verdict each batch posts under was asked for in that same batch, so a 403 is no sign the
- // host latched since: nothing is re-asked, and the request count per batch does not grow.
+ // host latched since: nothing is re-asked, and the batch stays at two requests. That is one more
+ // than before the proof existed (notify alone), because each refused post forgets the verdict.
route({ challenge: () => bare(404), notify: () => bare(403) })
const { h, send } = notify()
for (let i = 1; i <= 3; i++) {
diff --git a/src/core/push-notify.ts b/src/core/push-notify.ts
index 2468cb9f3..c137c3d4e 100644
--- a/src/core/push-notify.ts
+++ b/src/core/push-notify.ts
@@ -256,7 +256,11 @@ export interface HostAuthCache {
/**
* One hostAuth session per sender (notify and live-update each own one: they are independent streams
* and each re-proves at most every 10 minutes). The "old backend" verdict is cached the same way, so
- * a backend without the routes costs one challenge per 10 minutes rather than one per batch. The
+ * a backend without the routes that ACCEPTS the host's posts costs one challenge per 10 minutes rather
+ * than one per batch. One that refuses them (403 forbidden: no live pairing) costs a challenge on every
+ * batch, because each refused unproven post forgets the verdict (postHostMode) — one request per batch
+ * more than before the proof existed, until the backend with the proof is deployed and its host-auth
+ * `forbidden` is backed off instead. The
* challenge, the host-auth post and its body read share ONE `FETCH_TIMEOUT_MS` timer: nothing else
* bounds a stalled challenge, and the batch waits on it. Concurrent `get`s share the proof in flight.
*/