Skip to content

L2 serves SPA HTML for /.well-known/cq-node.json — node-discovery clients will break #283

@dwinter3

Description

@dwinter3

Problem

The node-discovery protocol (upstream mozilla-ai/cq #373/#374, tracked for adoption in #270) defines a server-published document at /.well-known/cq-node.json that declares the node's real api_base_url. Discovery-aware SDK/CLI clients probe it instead of guessing addr + /api/v1.

The 8th-Layer L2 currently serves the SPA index.html (HTTP 200, text/html) for /.well-known/cq-node.json — the frontend catch-all intercepts the path. Verified against the engineering L2:

GET https://engineering.8th-layer-corp.8th-layer.ai/.well-known/cq-node.json
→ 200, content-type text/html, body = <!doctype html> … (the SPA shell)

This is the exact failure mode #270's action item #4 anticipated.

Why it matters

  1. The L2 serves its data plane at the root, not under /api/v1 — confirmed: POST /propose works, POST /api/v1/propose 404s. That is a non-default URL shape. The discovery document is the mechanism by which a client learns it. Without a real cq-node.json, an adopted discovery client falls back to addr + /api/v1 and 404s every call against our L2s.
  2. A 200-with-HTML response does not trigger the discovery client's clean "404 → fall back to addr/api/v1" path. The client validates the body against the node-discovery JSON Schema; HTML fails validation and raises DiscoveryError. So once /8l-cq:reflect emits 3-4 KB of pane output per session even with no hard findings #373/fix(#373): /cq:reflect — make silent-default actually silent #374 are adopted, discovery would break clients against our L2s rather than help them.

This is the same SPA-catch-all class of bug as the /propose-returns-HTML interception.

Fix

The L2 (cq-server) should serve a genuine /.well-known/cq-node.json ahead of the SPA catch-all, declaring the node's real API base:

Minimum acceptable interim: 404 the path (don't serve the SPA shell) so discovery clients get the clean fallback. The full fix is to publish the real document.

Applies to all L2s (the cq-directory slug router is itself a split-origin deployment). Coordinate with #270 — when #373 lands upstream, align the document/schema with the merged protocol.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions