# R07: 14s near-deadline successful fallback

Before [e9236274a3](https://git.cafe/pingdotgg/t3code/commit/e9236274a3a6e0c731a7df4092db1e686f039068); after [63e44670dd](https://git.cafe/pingdotgg/t3code/commit/63e44670dd1d222cf63619d5e02415f2a9fd3bc2).

Before run: `/tmp/lead-24640-r1/capture/2026-10-27T14-29-41.333Z-before-R07`. After run: `/tmp/lead-24640-r1/capture/2026-10-27T14-29-41.331Z-after-R07`.

Environment: fs-31 Linux x86_64, Node v26.12.1; no viewport/theme/DPR/font scaling. Fresh per-run app databases. Same RPC fixture on each side. Native sidecars compiled with isolated Rust 1.99.1 where used.

Before times out near 1s. After accepts the 14s result and publishes immediately, then waits about 56s before retrying.

Wrapper timings exclude Python startup and stream drain. Acquisition timings use the real terminal.posixProcessTableSnapshot trace span. An idle gap is END→next START, never start-to-start. Before delay=min(1000×2^failureCount,60000)ms; after delay=min(max(1000×2^failureCount,4×measured fallback acquisition),60000)ms. Native-failed production ticks increment failureCount even when fallback succeeds; successful absent-supplier harness ticks reset it. Native requests and terminal processing can add overhead.

| Event | Before ([e9236274a3](https://git.cafe/pingdotgg/t3code/commit/e9236274a3a6e0c731a7df4092db1e686f039068)) | After ([63e44670dd](https://git.cafe/pingdotgg/t3code/commit/63e44670dd1d222cf63619d5e02415f2a9fd3bc2)) | Δ |
|---|---|---|---|
| Fallback query 1 | R07, background; shim START 2026-10-27T14:29:49.055Z (mono 921978177751415); END 2026-10-27T14:29:50.023Z (mono 921979145799423); 968.0ms, signal 15; acquisition 2026-10-27T14:29:49.010Z→2026-10-27T14:29:50.030Z, 1019.8ms | R07, background; shim START 2026-10-27T14:29:49.098Z (mono 921978220966514); END 2026-10-27T14:30:03.112Z (mono 921992234322603); 14013.4ms, exit 0; acquisition 2026-10-27T14:29:49.042Z→2026-10-27T14:30:03.119Z, 14077.4ms | 1s timeout → 14s result, ~56s idle |
| Fallback query 2 | R07, background; shim START 2026-10-27T14:29:52.078Z (mono 921981200834448); END 2026-10-27T14:29:53.045Z (mono 921982167364925); 966.5ms, signal 15; acquisition 2026-10-27T14:29:52.032Z→2026-10-27T14:29:53.051Z, 1018.5ms | R07, background; shim START 2026-10-27T14:30:59.480Z (mono 922048602521359); END 2026-10-27T14:31:13.494Z (mono 922062616731491); 14014.2ms, exit 0; acquisition 2026-10-27T14:30:59.433Z→2026-10-27T14:31:13.503Z, 14070.1ms | Measured duration/result above |
| Background completion→next-query gaps | R07→R07: shim gap 2.055s, acquisition gap 2.003s | R07→R07: shim gap 56.368s, acquisition gap 56.313s | 1s timeout → 14s result, ~56s idle |
| Terminal event 1 | 2026-10-27T14:29:53.306Z `fixture-thread-a/term-0` closed, seq=6 | 2026-10-27T14:30:03.123Z `fixture-thread-a/term-0` activity, seq=6, busy=True, label=`fixture-child` | Compare identity/sequence; subscriptions deduplicated |
| Terminal event 2 | — | 2026-10-27T14:31:13.771Z `fixture-thread-a/term-0` closed, seq=7 | Compare identity/sequence; subscriptions deduplicated |
| Peak all fallback queries | 1 | 1 | Independent closeIdle may overlap one background query |
| Peak background fallback queries | 1 | 1 | Independent closeIdle may overlap one background query |

## Before scripted milestones and final observation states
```json
[
  {
    "kind": "control",
    "utc": "2026-10-27T14:29:41.548Z",
    "mono_ns": "921970670843581",
    "ms": 212.976938,
    "phase": "R07",
    "mode": "valid",
    "delay": 14000
  },
  {
    "kind": "server-ready",
    "utc": "2026-10-27T14:29:47.747Z",
    "mono_ns": "921976869511234",
    "ms": 6411.646835
  },
  {
    "kind": "rpc-connected",
    "utc": "2026-10-27T14:29:47.937Z",
    "mono_ns": "921977059358331",
    "ms": 6601.495436
  },
  {
    "kind": "child-ready",
    "utc": "2026-10-27T14:29:48.150Z",
    "mono_ns": "921977273162952",
    "ms": 6815.293854,
    "threadId": "fixture-thread-a",
    "terminalId": "term-0",
    "childPid": 3418039,
    "marker": "READY_R07_0"
  },
  {
    "kind": "scenario-complete",
    "utc": "2026-10-27T14:29:53.299Z",
    "mono_ns": "921982422061631",
    "ms": 11964.191772
  },
  {
    "kind": "cleanup-start",
    "utc": "2026-10-27T14:29:53.424Z",
    "mono_ns": "921982546838899",
    "ms": 12088.972056,
    "pids": [
      3417062,
      3417063,
      3418034,
      3418039
    ],
    "ptyPids": [
      3418034,
      3418039
    ]
  },
  {
    "kind": "cleanup-end",
    "utc": "2026-10-27T14:29:55.573Z",
    "mono_ns": "921984695391384",
    "ms": 14237.52377,
    "survivorsBeforeFinalKill": [
      3418034,
      3417063,
      3417062
    ],
    "remaining": []
  }
]
```
Metadata snapshots taken before and after driver cleanup:
```json
[
  {
    "kind": "state",
    "utc": "2026-10-27T14:29:53.299Z",
    "mono_ns": "921982421952415",
    "ms": 11964.08455,
    "terminals": [
      {
        "threadId": "fixture-thread-a",
        "terminalId": "term-0",
        "cwd": "/tmp/lead-24640-r1/capture/2026-10-27T14-29-41.333Z-before-R07",
        "worktreePath": null,
        "status": "running",
        "pid": 3418034,
        "exitCode": null,
        "exitSignal": null,
        "hasRunningSubprocess": false,
        "label": "Terminal 0",
        "updatedAt": "2026-10-27T14:29:48.144Z"
      }
    ]
  },
  {
    "kind": "state",
    "utc": "2026-10-27T14:29:53.408Z",
    "mono_ns": "921982530399573",
    "ms": 12072.531197,
    "terminals": []
  }
]
```

## After scripted milestones and final observation states
```json
[
  {
    "kind": "control",
    "utc": "2026-10-27T14:29:41.531Z",
    "mono_ns": "921970653788296",
    "ms": 197.943706,
    "phase": "R07",
    "mode": "valid",
    "delay": 14000
  },
  {
    "kind": "server-ready",
    "utc": "2026-10-27T14:29:47.760Z",
    "mono_ns": "921976882632979",
    "ms": 6426.790012
  },
  {
    "kind": "rpc-connected",
    "utc": "2026-10-27T14:29:47.927Z",
    "mono_ns": "921977049667182",
    "ms": 6593.825748
  },
  {
    "kind": "child-ready",
    "utc": "2026-10-27T14:29:48.170Z",
    "mono_ns": "921977292844222",
    "ms": 6836.998309,
    "threadId": "fixture-thread-a",
    "terminalId": "term-0",
    "childPid": 3418038,
    "marker": "READY_R07_0"
  },
  {
    "kind": "scenario-complete",
    "utc": "2026-10-27T14:31:13.763Z",
    "mono_ns": "922062885865685",
    "ms": 92430.019302
  },
  {
    "kind": "cleanup-start",
    "utc": "2026-10-27T14:31:13.889Z",
    "mono_ns": "922063012097555",
    "ms": 92556.253907,
    "pids": [
      3417058,
      3417059,
      3418036,
      3418038
    ],
    "ptyPids": [
      3418036,
      3418038
    ]
  },
  {
    "kind": "cleanup-end",
    "utc": "2026-10-27T14:31:16.001Z",
    "mono_ns": "922065123803583",
    "ms": 94667.969162,
    "survivorsBeforeFinalKill": [],
    "remaining": []
  }
]
```
Metadata snapshots taken before and after driver cleanup:
```json
[
  {
    "kind": "state",
    "utc": "2026-10-27T14:31:13.763Z",
    "mono_ns": "922062885715824",
    "ms": 92429.871615,
    "terminals": [
      {
        "threadId": "fixture-thread-a",
        "terminalId": "term-0",
        "cwd": "/tmp/lead-24640-r1/capture/2026-10-27T14-29-41.331Z-after-R07",
        "worktreePath": null,
        "status": "running",
        "pid": 3418036,
        "exitCode": null,
        "exitSignal": null,
        "hasRunningSubprocess": true,
        "label": "fixture-child",
        "updatedAt": "2026-10-27T14:30:03.121Z"
      }
    ]
  },
  {
    "kind": "state",
    "utc": "2026-10-27T14:31:13.872Z",
    "mono_ns": "922062994766905",
    "ms": 92538.923617,
    "terminals": []
  }
]
```

## Behaviour difference
1s timeout → 14s result, ~56s idle
Raw UTC/monotonic RPC, query, signal, metadata, warnings, and cleanup records are in the paired transcripts. PID, randomly generated script terminal suffix, database path, UTC, sequence batching, and scheduler jitter naturally vary between fresh runs. No visual comparison is applicable.