Skip to content

quota scrape resilience: stale-read detection, failure classification, and CDP wedge probe for console-scraped pools (Mistral first) #10630

Open

Description

@dezren39

The gap

The 2026-11-13→16 Mistral outage (57h dark) had two halves. The first half is now closed: the CDP Helium browser carrying the Mistral console session died at a laptop reboot and nothing owned it. As of 2026-11-16 it runs under a supervised systemd user unit (helium-cdp.service, restart-on-failure, correct profile, kill/restart recovery proven live — see #6032 comment 6910076337).

The second half is still unbuilt, and it is the half that made the outage silent for 57 hours:

  1. No stale-read detection that leads anywhere. When a console-scraped pool's read goes stale, the quota-check stale-source escalation exists on paper (it fired once, 2026-11-14, quota-check v71) but dedupe held it forever and no repair was ever dispatched. Detection must end in a repair action, not a note.
  2. No failure classification. On 2026-11-15 a replacement browser with the wrong profile (no Mistral session) bounced admin.mistral.ai to a login page and the gatherer reported it as cdp-unavailable. The design's session-expired class exists; the gatherer must distinguish at minimum: CDP endpoint down, browser wedged, session expired / login page, page reachable but data fetch failing.
  3. No CDP-level liveness probe. Process supervision (Restart=always) catches a dead browser. A browser that is alive and still listening on :19222 but wedged (renderer hung, page unresponsive) passes supervision and fails every tick silently.

Scope

For console-scraped quota sources (Mistral first; the pattern should generalize to any CDP-scraped pool):

  • Wedge probe: periodic CDP-level check (endpoint answers + target page responsive, not just port listening). On wedge: restart the browser unit and verify a fresh read lands; escalate if it does not.
  • Staleness detector with teeth: when a scraped pool's last good read crosses the stale threshold, (a) record the failure with its correct class, (b) create exactly one fleet-queue repair task (dedupe by pool + failure class), (c) re-escalate if the read is still stale at the next threshold instead of deduping into silence, (d) auto-close the escalation when a fresh read lands.
  • Session-expiry path: a session-expired classification surfaces as a named attention state (sign-in needed) immediately — it is a human/agent action, not a retry loop. Never script token exchange or credential handling as part of recovery.

Acceptance

  • Simulated wrong-profile / logged-out session: gatherer reports the session-expired class (not cdp-unavailable) and the attention state names the needed sign-in within one tick cycle.
  • Simulated wedged browser (process alive, CDP unresponsive): probe catches it, unit restarts, fresh Mistral read lands, no human touch.
  • Simulated dead scrape with repair task ignored: escalation re-fires at the second threshold — silence past the threshold is impossible without an open, visible escalation.
  • Fresh read after any automated recovery is verified from quota-current.json (new measuredAt, no retainedFromFailedTick), not from process state alone.

Record

Activity

  1. developing-today commented on Nov 16, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    Implementation cross-check: the recovery planner already merged in #8357, pm-stack/exporters/src/watchdog-escalation.ts, still emits close_issue and complete_task on producer recovery. That is a concrete contract to fix, not just wording: #10136 reserves GitHub closure for the authorized authority, and a fresh provider read is not proof of safe completion for a repair task with open work or a draft PR (#10611). On a genuinely newer successful measurement (not a retained failed-tick value), resolve the operational incident/attention state, record recovery on the existing issue, and preserve the issue/task for authorized disposition where work remains. At the next stale threshold update the existing escalation by pool + failure class without dispatching duplicate repair tasks. Add fixtures asserting zero issue-close actions, retained data cannot clear attention, and recovery leaves task/PR ownership intact. This is source-level evidence; it does not establish that a live effector ever closed an issue.

  3. added
    kind/featureNew feature or capability request
    priority/normalOrdinary priority (the default)
    app/fleetpkgs/fleet multicall binary + platform crates
    effort/lLarge: multi-day or open-ended; expect staged check-ins
    on Nov 16, 2026
  4. dezren39 commented on Nov 16, 2026

    @dezren39
    MemberAuthor

    Recurrence 2026-11-16: dark since 05:29 CST with browser + unit UP — defect is the session layer, error still says cdp-unavailable

    Follow-up investigation to the 2026-11-16 01:06 CST repair (same night). The Mistral read went dark again: freshness measuredAt stuck at 2026-11-16T11:29:48Z, error Mistral console budget read failed (cdp-unavailable): Mistral console read produced no response in the browser; the enrolled API key is live.

    What was verified live this time (all via CDP against the running browser):

    • helium-cdp.service enabled + active since 07:00:37 CST (after the 05:37 reboot), NRestarts=0; port 19222 listening; correct profile (/home/user/.config/net.imput.helium). The hardening from last night did its job — the browser came up at boot.
    • Tab layer is functional: creating a page and navigating works fine. But no admin.mistral.ai tab exists, and a fresh navigation to https://admin.mistral.ai/ bounces to https://v2.auth.mistral.ai/login ("Login - Mistral AI").
    • Cookie store is healthy: the running browser holds the Ory Kratos session cookie (__Host-ory_kratos_browser_... on auth.mistral.ai, local expiry 2027), can decrypt it, and Network.getCookies confirms it WOULD be sent to auth.mistral.ai.
    • The session is dead server-side anyway: GET https://auth.mistral.ai/sessions/whoami with credentials from an auth.mistral.ai page returns 401 "No valid session credentials found in the request". The cookie is sent; Mistral/Kratos no longer honors the session behind it.

    Why the error misclassifies (the classification gap, demonstrated end-to-end): after the login bounce, the read's page sits on the auth origin (v2.auth.mistral.ai). waitForPage never sees the admin origin, and the in-page fetch to admin.mistral.ai runs cross-origin and dies with status 0 — which mistral.ts maps to cdp-unavailable ("produced no response"). The true class is session-expired, but isSessionExpiredStatus never receives a response it can classify. CDP itself was reachable and working throughout.

    Fix / what's needed: a human sign-in to admin.mistral.ai in the laptop Helium browser (not attempted by the agent, per policy). After sign-in, the per-tick read creates its own page and should go fresh on the next completed tick. No browser restart or unit change is indicated — the failure is above the layer the helium-cdp hardening covers.

    Adjacent observation (separate defect, noted not chased): the gather ticks finishing 10:34 and 10:38 CST failed before providers ran — opencode quota subcommand failed: Command failed: /run/current-system/sw/bin/opencode quota --json (journalctl --user -u quota-gatherer.service). The last completed tick in quota-current.json (generatedAt 2026-11-16T16:08:50Z) still shows the mistral cdp-unavailable error above. So even the proof path (fresh ticks) is currently blocked by the subcommand failure, independent of the Mistral session.

    Not closing: the stale-read detection / re-escalation and failure-classification acceptance items remain open — this recurrence is a session-expired case filed under cdp-unavailable, with no distinct escalation.

  5. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 17, 2026
  6. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged

  7. added
    status/triagedTriaged and routed (see agent note)
    and removed on Nov 17, 2026
  8. 15 remaining items

  9. dezren39 commented on Nov 19, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: escalated (owner decision)
    issue: #10630
    task: 20669
    lane: oc-code-03
    worker: repo-worker-code
    at: 2026-11-19T13:20Z

    Read attached — this is a decision only Drew can make, so it is escalated once instead of re-parked again.

    Fresh state (2026-11-19T13:19Z):

    The gate being cited by lanes is a "scoped handoff" / "dedicated build session" that is not recorded on this issue — the citation chain is circular (each note points at an earlier note). Under the runbook, a plain assignment is not a hard stop, so an ordinary lane could implement slice 1; but silently overriding an owner assignment is also wrong. That choice is Drew's.

    Question: should an ordinary queue lane implement #10630 slice 1 now (with ownership released), does Drew keep it (and lanes stop claiming until unassigned), or should slice 1 be re-scoped into a lane-sized task?

    If released, the work is: Mistral logged-out/auth-origin-landing read reports the session-expired class (not cdp-unavailable) and surfaces the sign-in attention state; the watchdog recovery planner emits zero close_issue / complete_task actions; fixtures assert retained data cannot clear attention and task/PR ownership survives recovery; existing exporter/watchdog tests stay green.

    Labels now status/blocked + queue/blocked + user/escalated; the task is blocked with reason class escalated-to-user so no further lane burns a claim on it. No credentials, no sign-in automation, no source edits.

  10. removed their assignment
    on Nov 20, 2026
  11. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Decided: Proceed with the code-owned watchdog recovery-contract slice; exclude the Mistral gatherer classification because its source is in the OpenChamber-side follow-on.
    Why: #10630 has no human hold label, assignment alone is not a hold, and pm-stack/exporters/README.md identifies Mistral’s adapter/gatherer as an OpenChamber-side follow-on while watchdog-escalation.ts and its tests are in this repository.
    Undo: A later packet may broaden scope once the gatherer implementation is present in this repository or split into a repository-matched task.
    By: oc-code-08 / repo-worker-code

    Re-scoped task 20669 to the code-owned recovery contract. Recovery now records operational recovery on the existing issue but does not close GitHub issues or complete queue tasks; the Mistral session-expired gatherer classification is excluded from this code-only slice because the source lives in the OpenChamber-side follow-on. Implementing and testing this slice on a task worktree.

  12. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Progress on task 20669: opened #12293 for the code-owned watchdog recovery contract. Recovery now records the healthy observation without closing incident issues or completing/cancelling repair tasks. Focused watchdog tests: 39 pass. Mistral gatherer classification remains outside this code-owned slice; this PR does not close the issue.

  13. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · claim (Lane GF, archer)

  14. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · progress (Lane GF, archer)

    PR opened: #12965 — re-escalation at the second threshold (acceptance criterion 3, watchdog half).

    A confirmed hand-off no longer dedupes into silence: unresolved for 24h (ESCALATION_REPEAT_AFTER_MS), the plan posts one "Still unresolved" comment on the existing incident issue — no new issue, no new task — and repeats once per window while the source stays down, stamped via lastReEscalatedAt (survives state coercion, including displaced previous records). Verified: 46 pass / 0 fail across the three watchdog suites, 7 of them new against this criterion.

    Still open on this issue after this slice: the CDP wedge probe, and the Mistral gatherer failure classification (OpenChamber-side per the 2026-11-22 decision here).

  15. added a commit that references this issue on Nov 23, 2026
  16. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · slice landed (Lane GF, archer)

    PR #12965 merged (b11391422a9) — re-escalation at the second threshold, the watchdog half of acceptance criterion 3.

    • planEscalation takes the tick clock; a fully confirmed (source, class) hand-off unresolved for ESCALATION_REPEAT_AFTER_MS (24h) now plans one "Still unresolved" comment on the existing incident issue instead of an empty dedupe plan — no new issue, no new queue task.
    • recordReEscalation stamps lastReEscalatedAt (new EscalationRecord field, preserved by coerceHealth, displaced previous records included), so it fires once per window, never per tick, for as long as the source stays down.
    • Wired in watchdog.ts (clock passed; stamp applied only after the comment confirms). Clock-less callers keep the exact old dedupe behavior.

    Verification: bun test on the three watchdog suites — 46 pass / 0 fail, 7 new tests against this criterion.

    Next slices on this issue: (1) CDP wedge probe (endpoint answers + target page responsive; restart + verify fresh read) — code-owned parts can land here; (2) Mistral gatherer failure classification (session-expired vs cdp-unavailable, etc.) — OpenChamber-side per the 2026-11-22 decision, not this repo.

  17. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · claimed — Lane JQ (archer), 2026-11-23 ~01:05 CST

    Slice: the CDP wedge probe — the code-owned half of #10630's remaining scope, named as next slice (1) in Lane GF's landed record on PR #12965: periodic CDP-level check (endpoint answers + target page responsive, not just port listening); on wedge, restart the browser unit and verify a fresh read lands; escalate if it does not.

    Premise check (fresh, this pass): #10630 open; criterion 3's re-escalation half landed (PR #12965, b11391422a9); #12293 (recovery handoff disposition) closed; the Mistral gatherer classification half is OpenChamber-side per the 2026-11-22 decision and is NOT part of this slice. No live claim on the wedge probe.

    Pickup path: fleet agent next — all rungs empty/down (queue session-proxy leg still down), self-served from GitHub.

  18. added a commit that references this issue on Nov 23, 2026
  19. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · slice landed — Lane JQ (archer), 2026-11-23

    PR #13015 merged — merge commit a189f9ff178, head-SHA guarded at d974f6bc686; wedge-probe symbols verified present on main. This is the slice Lane GF's record named as next slice (1): the code-owned CDP wedge probe.

    The gap it closes: rung 2 (the repair rung for browser-down / cdp-unreachable) validated a CDP session using only browser-level signals — /json/version, /json/list, and Storage.getCookies over the browser websocket. A hung page renderer answers all three, so a wedged browser passed re-validation as "succeeded" while every scrape kept failing.

    What landed (pm-stack/exporters/src/watchdog.ts):

    • cdpPageResponsive(wsUrl, timeoutMs) — a trivial Runtime.evaluate over the page target's own debugger websocket, wait bounded; answering at all is the signal, the value is discarded. Error replies, dead endpoints, and silence all read unresponsive with a named detail; nothing throws.
    • pickAllowlistTarget(targets, origins) — pure choice of the page-type allowlist target carrying a debugger websocket; background pages, workers, and off-origin pages never count as "the page is open". An allowlist page with no debugger websocket is now an honest failure ("cannot probe it") instead of a silent pass.
    • Rung 2 validates in layers (page open → renderer answers → cookies by name). A wedge triggers the same bounded supervised restart as a dead endpoint, followed by the full validation again — a restart that leaves the page hung is a failure, not a repair. "Verify a fresh read lands" stays where fix(watchdog): preserve handoff disposition on recovery #12293 put it: the next tick's healthy observation + recovery path, not this rung's claim.

    Verification: new test/watchdog-wedge.test.ts (8 tests) — a wire oracle (fake CDP page websocket: answers / never replies / CDP error / dead endpoint) and a target-choice oracle. All four watchdog suites on the laptop worktree: 54 pass / 0 fail (46 pre-existing + 8 new).

    Remainder on #10630 (unchanged, not this repo): the Mistral gatherer failure classification (session-expired vs cdp-unavailable etc.) — OpenChamber-side per the 2026-11-22 decision recorded on this issue. #10630 stays open on that alone.

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

    app/fleetpkgs/fleet multicall binary + platform crateseffort/lLarge: multi-day or open-ended; expect staged check-inskind/featureNew feature or capability requestpriority/normalOrdinary priority (the default)status/triagedTriaged and routed (see agent note)status:in-reviewtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions