Skip to content

tests: answer-delivery storage refusal intermittently never reaches Not saved #2989

Closed as not planned

Description

@schlessera

Context

The unchanged storage that refuses writes: Not saved, nothing sent, the card stays editable cell failed during the complete ui-react suite for #2900 at head 16dc0c7. It timed out after 20 seconds in waitForState(page, requestId, "notSaved") (packages/ui-react/tests/answer-delivery-runtime.test.ts:690); the test took 22.54 seconds.

The fixture makes IDBFactory.prototype.open throw UnknownError: The storage is unavailable. before the page opens (packages/ui-react/tests/answer-delivery-runtime.test.ts:679-686). The timeout diagnostic also failed to read its snapshot with that exception. The recorded network frames still held an ask_user_form_request; no answer response or terminal result had been sent. The failure therefore occurs while the answer is pending, before the terminal Activity notification moved by #2900. The original fixture and all ui-react product code are unchanged by that PR.

The completed full base suite at c670449 passed this cell. The failed full-head attempt was later interrupted by a host reboot, so it has no complete package summary; retain that failure as an observation, not a complete suite result or a causal attribution.

The complete final-head ui-react suite subsequently passed 2521/2521 tests (25331 assertions, 162 files, 1175.44 s), including this cell (1513.49 ms). The isolated base comparison remained queued until another host reboot killed it; it has no behavioral result. Keep the failed full-ordering receipt and passing full base/head controls separate; no cause is attributed yet.

Scope

  • Capture storage initialization, the answer submission attempt, the delivery-store state and visible card state to identify why the expected notSaved state does not become observable.
  • Attribute whether the failure belongs to the fixture, answer delivery or snapshot diagnostics before choosing a correction.

Out of scope

Acceptance criteria

  • Retain the failed full ordering and finite base/isolated controls with head, runtime and exact failure location; a passing isolated control does not establish causality.
  • Name the owning cause with the storage/submit/store/card timeline, or report the missing boundary and failed reproduction attempts.
  • Preserve the original Not saved heading, editable answer, no-response and no-settlement assertions (packages/ui-react/tests/answer-delivery-runtime.test.ts:691-694).
  • A causal mutation fails on the repaired boundary; restored isolated and complete package ordering pass.

Verification

BRAIN_REQUIRE_CHROME=1 scripts/test-offline.sh -- bun run test packages/ui-react/tests/answer-delivery-runtime.test.ts -t 'storage that refuses writes'

Also run the complete ui-react package suite through the shared heavy-command slots. The observed runtime was Bun 1.4.2 / Chrome 140.0.7339.127 with frozen dependencies. Do not replace failed full-ordering evidence with passing retries.

Contract impact

None expected; review the affected product surface if attribution selects product code.

Bounded current-main control — 2026-10-26

An isolated detached checkout of main 2577504d2a75f01d8286896a44b3f5a848e8bdb6 with frozen dependencies, Bun 1.4.4 and real Chromium 155.0.8059.84 ran BRAIN_REQUIRE_CHROME=1 PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium scripts/test-offline.sh -- bun run test ./packages/ui-react/tests/answer-delivery-runtime.test.ts -t 'Liveness B:|storage that refuses writes' under a finite 180-second outer cap. The OS-offline launcher verified separate user/network namespaces, initialized its dummy interface without routes and dropped setup capabilities; existing test/browser guards were unchanged.

Result: exit 0, 2 pass / 22 filtered / 0 fail, 13 assertions, 5.63 s test phase. Storage refusal passed in 1694.19 ms; Liveness B passed in 2173.35 ms. The liveness receipt retained 35000 controlled ms, native greeting, correlated pong and session resync. This is one focused two-cell control, not full-file/package proof, historical Chrome-140 equivalence or a causal repair. No source, interval, margin or assertion changed. Preserve the original failed ordering and collect the same-failure storage/frame/timer/state boundaries before choosing a correction.

2026-10-26 triage at main 2577504d2a75f01d8286896a44b3f5a848e8bdb6: classified wanted unscheduled attribution work as p2 and retained the concrete needs: repro gap. Source and passing controls do not establish the failed invocation’s cause. Keep standalone while fixture-versus-product ownership is unresolved; no matching epic owns the full currently unqualified deliverable. No deadline, guard, release commitment or readiness is changed.

Native ownership reconciliation — 2026-11-02

Attached to #2753. Its browser-verification outcome explicitly includes real-Chrome runtime suites and attributing natural browser failures without assuming a fixture versus product owner; the full storage/submit/store/card investigation here advances that outcome. This is not based on a shared package alone. It supersedes the older standalone/no-matching-epic classification while preserving its historical evidence.

Current source at main a84d9bfbcb4e608b504aa0a9feb1144ad9a0b77e: the actual storage-refusal case is at test("storage that refuses writes, packages/ui-react/tests/answer-delivery-runtime.test.ts:698-716; it still injects the refusal before navigation, requires notSaved and editable contents, and sends neither answer nor settlement. The historical 690/679/691 ranges above describe the original recorded tree. No real Chrome, Docker or qualified namespace runtime is available on this triage host, so no new browser reproduction or passing control is claimed. Retain needs: repro, p2 and every original guard/deadline; the exact missing timeline remains as scoped above.

Main CI recurrence check (2026-11-03): in the window 2026-10-26 18:00 UTC to 2026-11-03 08:00 UTC, main CI ran 116 times; 97 runs were green and the failed-job logs of the other 19 contain no failure of the storage that refuses writes cell. Main CI selects affected suites, so this loosely bounds hosted recurrence; it is not a flake rate, a reproduction or a repair. The test file is unchanged since the 2026-11-02 review. The missing evidence is still the storage/submit/store/card timeline from a failing ordering.

Triage 2026-11-03: added main-CI recurrence check; needs: repro and p2 unchanged.

Latest bounded investigation and remaining evidence — reconciled 2026-11-05

The 2026-11-04 investigator receipt records the following; this triage did not rerun it.

At 53b862123d7b8e4c9d039859fabdc9fc6ad4cd36, the native attempt stopped before discovery on offline namespace setup. Independent queue, injected DOM-state and four real storage-adapter/queue/store controls passed within their stated lower-level boundaries; none exercises the failed Chrome Submit ordering. A useful diagnostic fact is established: storage.load() can still throw after in-memory notSaved is already present, so the historical snapshotError cannot locate the missing transition. Capture in-memory delivery/transitions and lock state independently of the intentionally failing storage read, together with actual Submit/start/admission/card chronology. Current original case is test("storage that refuses writes, packages/ui-react/tests/answer-delivery-runtime.test.ts:701-719; older ranges remain historical.

Historical failures and controls retain their original identities. Keep needs: repro and no agent-ready; no new causal repair, full-suite qualification or provider/device result is claimed.

Activity

  1. added
    type: testCoverage, harness or proof work with no behaviour change.
    area: ui-reactReact chat/files/voice components, stores, WebSocket transport.
    needs: reproBlocked on a reproduction.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    on Oct 26, 2026
  2. added this to the 0.45.0 milestone on Oct 26, 2026
  3. schlessera commented on Nov 4, 2026

    @schlessera
    OwnerAuthor

    Repro triage — 2026-11-04 (UTC)

    Verdict: inconclusive for the reported intermittent real-Chrome timeout. Retain needs: repro; do not add agent-ready. No fix or causal attribution is claimed.

    Inspected clean HEAD and fetched origin/main: 53b8621. Environment: Ubuntu 26.04.1 LTS, Linux 7.0.0-42-generic x86_64, Bun 1.4.4, Node 26.13.0, Docker 29.1.3. bun install --offline --frozen-lockfile --ignore-scripts --backend=copyfile succeeded from the existing local cache (922 packages); tracked files and lockfile stayed unchanged. No credentials, provider calls or external test traffic were required.

    Read the complete issue (zero comments before this note), native parent #2753 and all four parent comments, and the original #2900/#2983 receipts. Verified the historical head's lines 679–694 with git show 16dc0c7533b8c3bb4242bfe7f20f6b484cbb3b9a:packages/ui-react/tests/answer-delivery-runtime.test.ts. Current navigation: test("storage that refuses writes, packages/ui-react/tests/answer-delivery-runtime.test.ts:698-716; the original state wait is now line 709, with all four heading/editable-value/no-response/no-settlement assertions at 710–713. The wait still defaults to 20,000 ms. The answer-delivery decision still requires failed persistence to leave the answer editable and unsent.

    Native attempt and limitation

    With PUPPETEER_EXECUTABLE_PATH pointing to the existing cached Chrome executable:

    timeout --signal=TERM --kill-after=5s 180s env BRAIN_REQUIRE_CHROME=1 \
      PUPPETEER_EXECUTABLE_PATH="$PUPPETEER_EXECUTABLE_PATH" \
      scripts/test-offline.sh -- bun run test \
      ./packages/ui-react/tests/answer-delivery-runtime.test.ts \
      -t 'storage that refuses writes'

    Exit 1 immediately: unshare: write failed /proc/self/uid_map: Operation not permitted. Neither the test module, Chrome nor its state assertion ran. This is an offline-launch prerequisite failure, not the reported failure. A separate --network=none namespace probe in the cached pinned Playwright image (sha256:eff16c30e6f3f4af0a03fa4b706120d5e9b0891c344a27d64559aff5900a4a27), as non-root with all capabilities dropped and no-new-privileges, also refused unshare --user --map-current-user --net -- true. No sandbox/namespace guard was bypassed. Full-file and complete package browser ordering were not run.

    Independent guarded controls

    timeout --signal=TERM --kill-after=5s 90s bun run test \
      ./packages/ui-react/tests/answer-delivery.test.ts
    timeout --signal=TERM --kill-after=5s 60s bun run test \
      ./packages/ui-react/tests/render/answer-delivery.test.tsx -t 'notSaved'
    • Queue file: exit 0, 67 pass / 0 fail, 305 expectations.
    • DOM control: exit 0, 4 pass / 0 fail / 52 filtered, 28 expectations. All four ask kinds retain the exact Not saved copy and editable-question presentation. These are DOM state-injection controls, not Chrome submission proof.
    • The additional reusable probe below: exit 0, 4 pass / 0 fail, 36 expectations. It uses the real IndexedDB storage adapter, real queue manager and real chat store, with an explicitly injected factory throwing the original synchronous UnknownError. It varies startup/hello ordering and no coordinator versus the in-process tab hub. Every arm observes saving → notSaved, returns refused, retains the nonempty form payload, leaves the exchange unanswered and has zero outbound frames/queued entries. This is a lower-level control; the factory and transport are doubles, and native IndexedDB/Web Locks, UI Submit, rendering and host settlement are outside its scope.

    One diagnostic limitation remains reproducible independently: even with notSaved already readable, the same storage object's load() still rejects with UnknownError: The storage is unavailable. In the fixture, async snapshot(), packages/ui-react/tests/fixtures/answer-delivery-client.ts:73-88, awaits storage.load() at line 81 before returning its object, and before querying locks/returning transitions. The timeout handler then replaces that entire snapshot with snapshotError. Thus the historical snapshot exception alone cannot distinguish a missing Submit, pending startup/admission lock, missing store transition, or a healthy notSaved transition. This does not attribute the historical timeout to diagnostics.

    Reusable lower-level control — run from the inspected repository root after the frozen install; creates only a temporary test outside authored source and keeps the repository test preload enabled:

    probe_dir=$(mktemp -d)
    cat > "$probe_dir/storage-refusal-control.test.ts" <<'TS'
    import { test, expect } from "bun:test";
    import { resolve } from "node:path";
    const fromRepo = (path: string) => import(resolve(process.cwd(), path));
    const { createBrainUiRoot } = await fromRepo("packages/ui-react/src/root.ts");
    const { createAnswerDelivery } = await fromRepo("packages/ui-react/src/lib/answer-delivery/manager.ts");
    const { createIndexedDbAnswerStorage } = await fromRepo("packages/ui-react/src/lib/answer-delivery/storage.ts");
    const { createTabHub } = await fromRepo("packages/ui-react/src/lib/answer-delivery/tabs.ts");
    
    for (const coordinated of [false, true]) for (const earlyHello of [false, true]) {
      test(`2989 control: tab-hub=${coordinated}, hello-during-start=${earlyHello}`, async () => {
        const root = createBrainUiRoot({ storage: null });
        const tabs = coordinated ? createTabHub().tab() : null;
        const states: string[] = [], frames: unknown[] = [];
        let opens = 0;
        const storage = createIndexedDbAnswerStorage("odysseus-2989", {
          open() { opens++; throw new DOMException("The storage is unavailable.", "UnknownError"); },
        } as unknown as IDBFactory);
        const queue = createAnswerDelivery({
          chat: root.stores.chat, storage, tabs,
          now: () => Date.UTC(2026, 6, 12, 7, 41),
          transport: {
            ready: () => true, supportsReceipts: () => true,
            principalKey: () => "principal-odysseus", checkLiveness() {},
            send(frame: unknown) { frames.push(frame); return true; },
          },
        });
        const unlisten = root.stores.chat.subscribe((state: any, previous: any) => {
          if (state.deliveries !== previous.deliveries && state.deliveries["odysseus-request"])
            states.push(state.deliveries["odysseus-request"].state);
        });
        try {
          const chat = root.stores.chat.getState();
          chat.setActiveSession("odysseus-session");
          chat.startAssistantMessage("odysseus-session");
          chat.setAskUserFormRequest("odysseus-session", "odysseus-request",
            { prompt: "Record raft supplies", nodes: [{ id: "note", kind: "text", prompt: "Supply note", required: true }] },
            "odysseus-turn");
          const starting = queue.start();
          if (earlyHello) queue.connected();
          await starting;
          if (!earlyHello) queue.connected();
          const result = await queue.submit({
            requestId: "odysseus-request", sessionId: "odysseus-session", turnId: "odysseus-turn",
            payload: { kind: "ask_user_form", answers: { note: { value: "Timber and rope for the raft" } }, visibleNodes: ["note"] },
          });
          const delivery = root.stores.chat.getState().deliveries["odysseus-request"];
          expect(result, "SUBMIT_REFUSED").toBe("refused");
          expect(states, "STORAGE_REFUSAL_REACHES_NOT_SAVED").toEqual(["saving", "notSaved"]);
          expect(delivery.payload.answers.note.value, "REFUSED_PAYLOAD_RETAINED").toBe("Timber and rope for the raft");
          expect(frames, "NO_OUTBOUND_FRAMES").toEqual([]);
          expect(queue.held(), "NO_QUEUED_ANSWER").toEqual([]);
          expect(root.stores.chat.getState().buffers["odysseus-session"].messages.at(-1).askUserExchanges[0].formAnswers,
            "EXCHANGE_NOT_MARKED_ANSWERED").toBeUndefined();
          let snapshotError = "";
          try { await storage.load(); } catch (error) { snapshotError = (error as Error).name + ": " + (error as Error).message; }
          expect(snapshotError, "SNAPSHOT_STORAGE_READ_STILL_THROWS").toBe("UnknownError: The storage is unavailable.");
          expect(root.stores.chat.getState().deliveries["odysseus-request"].state,
            "DIAGNOSTIC_FAILURE_DOES_NOT_IMPLY_MISSING_NOT_SAVED").toBe("notSaved");
          expect(opens).toBeGreaterThan(0);
          console.log(JSON.stringify({ coordinated, earlyHello, opens, result, states, frames: frames.length, held: queue.held().length, snapshotError }));
        } finally {
          unlisten(); queue.dispose(); tabs?.dispose(); root.dispose();
        }
      }, 2000);
    }
    TS
    timeout --signal=TERM --kill-after=5s 30s bun run test \
      "$probe_dir/storage-refusal-control.test.ts"

    Representative result in every arm:

    result=refused; states=[saving,notSaved]; outbound frames=0; held=0
    snapshotError=UnknownError: The storage is unavailable.
    

    Next evidence needed: on a host satisfying the unchanged offline/browser prerequisites, retain a failing original ordering with correlated timestamps for storage initialization/open attempts, actual form Submit callback, start() completion, admission Web Lock request/grant, store.load() rejection, delivery-store transitions and visible card state. Capture in-memory deliveries/transitions and lock state independently of the intentionally failing persisted-storage read. Preserve the existing 20-second wait and all four original assertions. Keep historical failing full ordering, passing base/head suites and the 2026-10-26 focused Chrome control separate; none is superseded by these lower-level passes. A held-lock or other deliberately forced stall would be a mechanism experiment, not the original reproduction.

    No authored source changes or temporary source mutations; scripts/logs stayed outside authored source. git status --porcelain=v1, staged and unstaged diffs were empty after the controls. Labels remain type: test, area: ui-react, priority: p2, needs: repro; milestone 0.45.0, open state, assignments and parent are preserved.

  4. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    2026-11-10 triage at main 3aadc8df5: this extends the 2026-11-03 recurrence check. There is no new occurrence.

    Window checked: main CI runs created 2026-11-03 00:00 UTC to 2026-11-10 09:15 UTC: 167 runs (102 green, 40 cancelled, 24 failed, 1 in progress). I read the failed-job logs of all 24 failed runs, plus the failed first attempts of reruns 42546211003 and 41737142970. None fails storage that refuses writes: Not saved, nothing sent, the card stays editable. The cell passed in all eight places it appears in those logs, in 1.2–2.1 s. The test file is unchanged since #3345, which the 2026-11-05 triage already covered. Main CI selects affected suites, so this loosely bounds hosted recurrence. It is not a flake rate, a reproduction or a repair. needs: repro and p2 are unchanged.

  5. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Test-health audit, 2026-11-10 (push #3855, shard e3855-ui-react-01). Bounded reproduction attempt; no fix and no attribution is claimed.

    • Commit: epic-branch b71c6e4fe, plus test-only edits to the same file that do not touch the asserted path (see below).
    • Command: BRAIN_REQUIRE_CHROME=1 bun scripts/test-health.ts measure packages/ui-react/tests/answer-delivery-runtime.test.ts packages/ui-react/tests/approval-recovery-runtime.test.ts packages/ui-react/tests/association-signout-runtime.test.ts --runs 2, run on a shared host while other workers were running suites.
    • Result: answer-delivery-runtime stable, 2 of 2 green, median about 211 s per run including the fixture build. No storage-refusal timeout, and no duplicate exchange count.

    An earlier shuffled, combined baseline of all five cluster-2 runtime files hit its 2-hour harness limit before it finished. That limit is the harness's, and says nothing about this test.

    The audit changed only how this file reports failures: four frame checks of the form some(...)).toBe(false) became filter(...)).toEqual([]), so a stray frame is printed. Behaviour and waits are unchanged. Still unreproduced, so needs: repro stays.

  6. removed this from the 0.45.0 milestone on Nov 11, 2026
  7. schlessera commented on Nov 13, 2026

    @schlessera
    OwnerAuthor

    Closing as not planned (maintainer-requested triage, 2026-11-13). One sighting on 2026-10-26, in a full package run on a host that rebooted twice during that record. No focused or full attempt since has reproduced it.

    Recurrence sweep (2026-11-13). I read the failed-step log of every failed product job on main CI from 2026-10-28 to 2026-11-13: 84 jobs across 300 runs. In the same window 1,005 unit, 764 browser, 501 layout and 256 runtime_host jobs passed. storage that refuses writes: Not saved appears in eleven of those logs, always as a pass.

    One fixture fact is worth keeping for whoever sees it next: snapshot() awaits storage.load() first, so with storage forced to throw, the diagnostic snapshot fails for the same reason as the case and cannot say which transition was missing.

    On recurrence: file a new issue, and capture the card state without going through the failing storage read.

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

    area: ui-reactReact chat/files/voice components, stores, WebSocket transport.needs: reproBlocked on a reproduction.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: testCoverage, harness or proof work with no behaviour change.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions