Skip to content

feat(runtime): /ready reports cluster driver health when multi-replica is declared (#3814) #31601

Closed

Description

@objectstack-fleet

epic:#3814#1 · os-zhuang · session_01QUs3BrVu5TqwtmuhsjdEvM
Filing gate: ③ maintainer-dispatched task (child of #3814). Maintainer, (2026-11-08, 16:25 UTC): 「继续,现在派第二批」 (gate 1 after the card 0 inventory, cloud#3868 comment 6723322368).

Parent: #3814 (rulings R0-R6 on comment 6722625146).

Problem (smoke, card 0; fable plan review #6)

/ready checks only the primary datasource. With Redis stopped, a replica's /ready stayed 200 throughout, and an operator has no signal that the cluster has lost coordination.

Do

  1. When multi-replica is declared on the Redis driver, /ready includes the cluster driver's health (from F3a's health seam, or a ping if F3a is not merged) and, when Redis is down, answers 200 with status: degraded and a cluster entry naming the driver as unreachable. PM decision D4 (2026-11-08): not 503. Every replica loses Redis together, so 503 would turn a degraded cluster into a total outage while the DB is still the source of truth.
  2. Single node: body and status byte-identical to today.
  3. Tests: declared + Redis down = 200 degraded with the cluster entry; declared + Redis up = 200 ok; single node unchanged; the stopping (SIGTERM) 503 path unchanged.

Rules that bind every #3814 child (verbatim rulings on the parent)

R1 peer round-robin. R2 Redis required for multi-replica only. R3 「同意:每张卡都只在"声明多副本并接上 Redis 驱动"时才生效」: the single-node default path is unchanged, multi-replica behaviour switches on only behind declared replicas>1 AND a connected Redis cluster driver, the split-brain guard is never weakened, and the deploy README "multi-node unsupported" line stays until the final gate.

Done when

PR merged; operators can see a degraded cluster from /ready without replicas leaving rotation; single node unchanged.

Activity

  1. added
    enhancement
    priority:p2
    pm:queue
    domain:server
    on Nov 8, 2026
  2. objectstack-fleet commented on Nov 8, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: confirmed · domain:server · p2 · pm:queue · 2026-11-08T17:01Z

    ⛔ Not a claim.


    Generated by Claude Code

  3. objectstack-fleet commented on Nov 8, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX

    Claim: PM loop round 1 · #31601 · 2026-11-08T21:32Z
    Session: session_01ADHkmP8JJo4zF2sjTBRwnX (seat); dev = card thread session_01ADHkmQwuHPnJPK768Mta39
    Account: os-steve
    Branch: claude/project-thread-niooue
    Worktree: the card thread's checkout of objectstack-ai/objectstack
    Domain: domain:server
    Seat: domain:server#4
    File surface: packages/runtime/src/** (the /ready handler in http-dispatcher.ts / dispatcher-plugin.ts), a health read on packages/services/service-cluster/src/** if #31596's seam is not on main, their tests, .changeset/31601-*.md (stop on breach; stop if /ready's body has a published schema in packages/spec)
    Container & model: S, mode:thread, model: default tier (dispatch-gates --tier on runtime: no path-derived mandate), effort: medium
    Clause-②: yes (widening)
    Metadata-protocol: none
    Responsibility: the readiness probe in objectstack (packages/runtime) checks only the primary datasource · no platform path covers it today (a replica with Redis down answers 200 ok) · reached by every /ready probe on a deployment that declares replicas>1 on the Redis driver
    Thread-read: 6724391071
    Premise: holds (PM decision D4 2026-11-08: 200 status: degraded, never 503; #3814 R3 binds)
    Serial constraints cleared: #31596 (seat 1, F3a health seam) is read, not waited on: the dev pings the driver if the seam is not merged.

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 8, 2026
  5. objectstack-fleet commented on Nov 8, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#4 · os-steve · session_01ADHkmQwuHPnJPK768Mta39
    os-dev-report

    {
      "issue": 31601,
      "status": "done",
      "branch": "claude/project-thread-niooue",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/31711",
      "session": "session_01ADHkmQwuHPnJPK768Mta39",
      "premise_still_valid": true,
      "summary": "Declared multi-node (declaresMultiNode: OS_EXPECT_MULTI_NODE=true or OS_CLUSTER_REPLICAS>1) AND a cluster service offering a redis connection: /ready's 200 body gains cluster {driver, reachable, reason?}; Redis unreachable answers 200 status 'degraded' (D4, never 503). The probe is new probeClusterDriverHealth in @objectstack/service-cluster (one PING bounded at 500 ms over readClusterDriverConnection, closed reason set, never throws, no address in the body), memoized 1 s in HttpDispatcher and consulted on the two 200 branches only, so single node / memory driver / no cluster stay byte-identical and the booting/stopping 503 and primary-datasource 503 return before it. #31596's seam was not merged (no PR), so the driver connection is pinged directly as dispatched.",
      "tests": "head 04ca432f: runtime test 563 files / 9047 passed, 19 skipped; runtime typecheck exit 0 (after building driver-turso, a devDep outside the closure: TS2307 on a turso-remote test, missing dist); service-cluster test 9 files / 123 passed, typecheck exit 0; service-cluster-redis test 3 files / 39 passed; eslint --no-inline-config on packages/runtime and packages/services/service-cluster exit 0/0. Head ce30cfbf (adds one collection-time import to the /ready test): http-dispatcher.ready.test.ts 41 passed. Base leg: merge-base 1a20cbc8's http-dispatcher.ts under the new pins answers 200 {status:'ready',state:'running'} (4 cluster pins red). Real redis-server smoke, real ioredis driver, OS_CLUSTER_REPLICAS=3: up 200 ready+reachable; stopped 200 degraded ping-failed (188 ms) then timeout (501 ms); restarted 200 ready+reachable; undeclared: 200 {status:'ready',state:'running'} throughout. Ablations via ablation-replace (src imports, no dist leg), all red then restored blob==HEAD, git diff HEAD empty: A1 drop declaration gate (3 red), A2 degraded as 503 (1 red), A3 probe before state 503 (4 red), A4 probe on primary 503 (1 red; first attempt refused by the tool, anchor inside replacement, no test ran), A5 no-probe as healthy (1 red), A6 leak error text, nested (2 red).",
      "gates": "ce30cfbf: dispatch-gates --commands derived 71; all 71 ran, each exit 0; --ran: '71 derived famil(ies) accounted for — 71 run, 0 NOT-MEASURED' exit 0. Earlier round on 04ca432f: teardown-shape --self-test exit 3 (fixture commit absent; fetched, exit 0), dual-build-cjs-loads exit 3 (dists outside closure; exit 0 after packages build), test-source-alias exit 1 (fixed in ce30cfbf). PR check-runs: in_progress at report time (not awaited).",
      "dogfood_battery": "04ca432f · VERDICT command-exit 0 (lock 26m36s) · Test Files 440 passed, 3 skipped (443) · Tests 3652 passed, 41 skipped (3693) · no failures. Run because the delta named dogfood (no ! title, no narrowing arm). Not re-run on ce30cfbf: test-file-only commit dogfood does not load.",
      "mcp_calls": "5 — issue_read x4 (get, get_comments x3), pull_request_read get x1; no write tools",
      "api_writes": "2 — relay pr_create (PR #31711, request fw-20261108T224648Z-fa4ccc, 15337 bytes sent = stored), this os-dev-report comment via post-stamped",
      "files_changed": [
        ".changeset/31601-ready-cluster-driver-health.md",
        "packages/runtime/src/http-dispatcher.ts",
        "packages/runtime/src/http-dispatcher.ready.test.ts",
        "packages/services/service-cluster/src/driver-health.ts",
        "packages/services/service-cluster/src/driver-health.test.ts",
        "packages/services/service-cluster/src/index.ts"
      ],
      "line_budget": "+484 / -4 over 6 files (PR additions/deletions); source 81 (runtime) + 112 (driver-health) + 8 (index); tests 188 + 80; changeset 19",
      "deviations": [
        "Runtime typecheck needed @objectstack/driver-turso built (devDependency outside the runtime closure); first reading was TS2307 from a missing dist, not this diff.",
        "A full packages build was started with OS_SKIP_DTS=1 (a turbo globalEnv, so it rebuilt dists without .d.ts); stopped my own run after ~62 tasks and rebuilt ./packages/** without the flag (81 tasks, 66 cached) before the final gate round, which then read every dts gate green.",
        "Ablation A4's first attempt was refused by ablation-replace (anchor contained in the replacement, count 1 -> 1); no test ran; re-run with another anchor.",
        "Dogfood measured on 04ca432f, not the final head ce30cfbf (test-file-only commit)."
      ],
      "open_questions": [
        {
          "question": "New public export names in @objectstack/service-cluster: probeClusterDriverHealth, DEFAULT_CLUSTER_PROBE_TIMEOUT_MS, ClusterDriverHealth, ClusterDriverUnreachableReason, ProbeClusterDriverHealthOptions; and the /ready body key 'cluster' with values driver/reachable/reason (timeout | ping-failed | unexpected-reply | no-probe). Seat's call on names.",
          "options": [
            "A keep as named (follows readClusterDriverConnection / ClusterDriverConnection)",
            "B rename before landing"
          ],
          "recommendation": "A, because it sits beside the existing driver-connection seam and F3a (#31596) can feed or replace it in one place."
        },
        {
          "question": "Card acceptance says 'declared + Redis up = 200 ok'; today's healthy body is status 'ready'. Kept 'ready' (plus cluster reachable:true) rather than introducing 'ok'.",
          "options": [
            "A keep 'ready'",
            "B use 'ok' on declared deployments"
          ],
          "recommendation": "A, because 'ready' is the published healthy value and 'ok' would change it for every declared deployment."
        },
        {
          "question": "The #13408 degraded-SECONDARY branch keeps status 'ready' with a degraded object, while the cluster reading uses status 'degraded' (card/D4). Unify later?",
          "options": [
            "A leave as is",
            "B follow-up card to align the secondary branch"
          ],
          "recommendation": "A for this card; B is a separate decision because it changes a single-node body."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: none (noted) · reach: real redis-server stopped under the redis driver · ioredis prints '[ioredis] Unhandled error event: ECONNREFUSED' per reconnect attempt (driver client has no error listener) · carrier: #31596 (F3a, seat 1) · noted, not filed",
        "class: none (noted) · content/docs/protocol/kernel/lifecycle.mdx GET /ready block and content/docs/deployment/self-hosting.mdx probe table do not mention the cluster entry; outside the claim's file surface · carrier: seat 4 · noted, not filed"
      ]
    }

    Stamped 2026-11-08T22:47Z.

  6. objectstack-fleet commented on Nov 8, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX

    Claim amendment · #31601 · 2026-11-08T22:48Z · amends claim 6727414288 · File surface only (Branch, Clause-②, Metadata-protocol unchanged)

  7. objectstack-fleet commented on Nov 9, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX

    Landed · #31601 · 2026-11-09T00:39Z

    Probe Reading
    PR #31711 merged through the queue 2026-11-09T00:37Z as 00205e1057. The merged head is eddeda2669 (ACCEPT 6728588970, TIER_DEFAULT review 6728568993 PASS).
    #31601 closed by Fixes #31601

    State change: pm:dispatched is removed in this stroke. No follow-up card is owed.

  8. removed
    pm:dispatched
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:serverenhancementpriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions