diff --git a/src/app/index.ts b/src/app/index.ts
index b486129..c5194fe 100644
--- a/src/app/index.ts
+++ b/src/app/index.ts
@@ -775,6 +775,7 @@ async function connectUntilDeadline(
mesh: MeshConfig,
bus: Bus,
logger: Logger,
+ url: string,
attempt: () => Promise,
): Promise {
const budgetMs = mesh.bootTimeoutMs ?? mesh.timeoutMs ?? 30_000;
@@ -793,7 +794,7 @@ async function connectUntilDeadline(
// thirty seconds. Retrying a wrong secret only spends the deploy's patience to reach the
// identical error, so it fails now.
if (isPermanentRefusal(error)) {
- logger.error(`mesh: the teapot refused this peer, which retrying cannot fix — ${(error as Error).message}`);
+ logger.error(`mesh: teapot ${url} refused this peer, which retrying cannot fix — ${(error as Error).message}`);
throw error;
}
@@ -804,17 +805,18 @@ async function connectUntilDeadline(
// at all — its routes 404 and a local `needs` on its tokens still fails in finalize().
if (remaining <= 0) {
logger.warn(
- `mesh: teapot unreachable after ${attempts} attempt(s) over ${budgetMs}ms ` +
- `(${(error as Error).message}) — starting without it. It sent no manifest, so none of ` +
- `its steps or routes are in this graph: its routes 404, and the boot still fails if ` +
- `anything local needs one of its tokens.`,
+ `mesh: teapot ${url} unreachable after ${attempts} attempt(s) over ${budgetMs}ms ` +
+ `(${(error as Error).message}) — starting without it. No manifest was ever exchanged, ` +
+ `so none of its steps or routes are in this graph: its routes 404 like any path that ` +
+ `was never registered, and the boot still fails if anything local needs one of its ` +
+ `tokens. This line is what a later 404 on one of its routes points back to.`,
);
return undefined;
}
bus.emit('mesh:boot:retry', { name: `attempt ${attempts}`, error });
logger.warn(
- `mesh: teapot unreachable (${(error as Error).message}) — retrying, ${remaining}ms of boot budget left`,
+ `mesh: teapot ${url} unreachable (${(error as Error).message}) — retrying, ${remaining}ms of boot budget left`,
);
await new Promise((resolve) => setTimeout(resolve, Math.min(delay, Math.max(0, remaining))));
delay = Math.min(delay * 2, 5_000);
@@ -857,7 +859,7 @@ async function spliceRemoteScopes(
try {
for (const teapot of mesh.teapots ?? []) {
warnIfCleartext(teapot.url, logger);
- const link = await connectUntilDeadline(mesh, bus, logger, () =>
+ const link = await connectUntilDeadline(mesh, bus, logger, teapot.url, () =>
connectLink({
url: teapot.url,
secret: teapot.secret,
diff --git a/test/mesh/boot-retry.test.ts b/test/mesh/boot-retry.test.ts
index 3ee4ae1..6100942 100644
--- a/test/mesh/boot-retry.test.ts
+++ b/test/mesh/boot-retry.test.ts
@@ -191,6 +191,41 @@ describe('mesh boot retry', () => {
}
}, 15_000);
+ it('names the teapot in the log a later 404 points back to', async () => {
+ // A route the absent teapot would have exported 404s, because nothing was ever registered for a
+ // manifest that never arrived. That is the right status — you cannot serve what was never
+ // declared — but a bare 404 is indistinguishable from a typo in the path. The boot log is the
+ // only place the two are told apart, so it has to name *which* teapot and say that no manifest
+ // was exchanged. The unreachable error itself is a socket error and does not reliably carry
+ // the url, so the url is passed in rather than scraped out of the message.
+ const { lines, logger } = collect();
+ const teacup = createApp({
+ modules: [LocalOnlyModule],
+ experimental: true,
+ logger,
+ mesh: {
+ teapots: [{ url: 'ws://127.0.0.1:9/x', secret: 's' }],
+ secret: 's',
+ bootTimeoutMs: 300,
+ },
+ });
+
+ try {
+ await teacup.ready();
+ const gaveUp = lines.find((line) => line.includes('starting without it'));
+
+ expect(gaveUp).toBeDefined();
+ expect(gaveUp).toContain('ws://127.0.0.1:9/x');
+ expect(gaveUp).toMatch(/no manifest was ever exchanged/i);
+ expect(gaveUp).toMatch(/404/);
+
+ // and the retry lines on the way there name it too, so a deploy tailing logs sees which one
+ expect(lines.some((line) => /retrying/.test(line) && line.includes('ws://127.0.0.1:9/x'))).toBe(true);
+ } finally {
+ await teacup.close();
+ }
+ }, 15_000);
+
it('still fails the boot when a local step needs a token the absent teapot owned', async () => {
const teacup = createApp({
modules: [NeedsAuthModule], // a step with needs: ['auth']