# R05: 5s successful fallback, one terminal

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-28-16.938Z-before-R05`. After run: `/tmp/lead-24640-r1/capture/2026-10-27T14-28-16.951Z-after-R05`.

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 terminates each query near 1s and publishes no busy result. After publishes the 5s result before the roughly 20s idle gap, then completes another query.

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 | R05, background; shim START 2026-10-27T14:28:26.014Z (mono 921895137128097); END 2026-10-27T14:28:26.983Z (mono 921896106058231); 968.9ms, signal 15; acquisition 2026-10-27T14:28:25.973Z→2026-10-27T14:28:26.995Z, 1021.8ms | R05, background; shim START 2026-10-27T14:28:26.212Z (mono 921895334490613); END 2026-10-27T14:28:31.228Z (mono 921900350417211); 5015.9ms, exit 0; acquisition 2026-10-27T14:28:26.177Z→2026-10-27T14:28:31.240Z, 5063.1ms | 1s timeout → 5s result, then ~20s idle |
| Fallback query 2 | R05, background; shim START 2026-10-27T14:28:29.046Z (mono 921898168358127); END 2026-10-27T14:28:30.010Z (mono 921899132818595); 964.5ms, signal 15; acquisition 2026-10-27T14:28:28.998Z→2026-10-27T14:28:30.017Z, 1019.8ms | R05, background; shim START 2026-10-27T14:28:51.545Z (mono 921920668115798); END 2026-10-27T14:28:56.560Z (mono 921925682318148); 5014.2ms, exit 0; acquisition 2026-10-27T14:28:51.496Z→2026-10-27T14:28:56.568Z, 5072.1ms | Measured duration/result above |
| Background completion→next-query gaps | R05→R05: shim gap 2.062s, acquisition gap 2.003s | R05→R05: shim gap 20.318s, acquisition gap 20.256s | 1s timeout → 5s result, then ~20s idle |
| Terminal event 1 | 2026-10-27T14:28:30.271Z `fixture-thread-a/term-0` closed, seq=5 | 2026-10-27T14:28:31.246Z `fixture-thread-a/term-0` activity, seq=5, busy=True, label=`fixture-child` | Compare identity/sequence; subscriptions deduplicated |
| Terminal event 2 | — | 2026-10-27T14:28:56.828Z `fixture-thread-a/term-0` closed, seq=6 | 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:28:17.156Z",
    "mono_ns": "921886278846686",
    "ms": 215.944365,
    "phase": "R05",
    "mode": "valid",
    "delay": 5000
  },
  {
    "kind": "server-ready",
    "utc": "2026-10-27T14:28:24.767Z",
    "mono_ns": "921893889278844",
    "ms": 7826.377374
  },
  {
    "kind": "rpc-connected",
    "utc": "2026-10-27T14:28:24.938Z",
    "mono_ns": "921894060251455",
    "ms": 7997.352019
  },
  {
    "kind": "child-ready",
    "utc": "2026-10-27T14:28:25.153Z",
    "mono_ns": "921894275622974",
    "ms": 8212.718689,
    "threadId": "fixture-thread-a",
    "terminalId": "term-0",
    "childPid": 3415287,
    "marker": "READY_R05_0"
  },
  {
    "kind": "scenario-complete",
    "utc": "2026-10-27T14:28:30.263Z",
    "mono_ns": "921899385527798",
    "ms": 13322.623031
  },
  {
    "kind": "cleanup-start",
    "utc": "2026-10-27T14:28:30.394Z",
    "mono_ns": "921899516286670",
    "ms": 13453.385812,
    "pids": [
      3413396,
      3413402,
      3415285,
      3415287
    ],
    "ptyPids": [
      3415285,
      3415287
    ]
  },
  {
    "kind": "cleanup-end",
    "utc": "2026-10-27T14:28:32.499Z",
    "mono_ns": "921901621473238",
    "ms": 15558.569414,
    "survivorsBeforeFinalKill": [],
    "remaining": []
  }
]
```
Metadata snapshots taken before and after driver cleanup:
```json
[
  {
    "kind": "state",
    "utc": "2026-10-27T14:28:30.263Z",
    "mono_ns": "921899385365883",
    "ms": 13322.463963,
    "terminals": [
      {
        "threadId": "fixture-thread-a",
        "terminalId": "term-0",
        "cwd": "/tmp/lead-24640-r1/capture/2026-10-27T14-28-16.938Z-before-R05",
        "worktreePath": null,
        "status": "running",
        "pid": 3415285,
        "exitCode": null,
        "exitSignal": null,
        "hasRunningSubprocess": false,
        "label": "Terminal 0",
        "updatedAt": "2026-10-27T14:28:25.138Z"
      }
    ]
  },
  {
    "kind": "state",
    "utc": "2026-10-27T14:28:30.372Z",
    "mono_ns": "921899495182180",
    "ms": 13432.279999,
    "terminals": []
  }
]
```

## After scripted milestones and final observation states
```json
[
  {
    "kind": "control",
    "utc": "2026-10-27T14:28:17.118Z",
    "mono_ns": "921886240811725",
    "ms": 164.971884,
    "phase": "R05",
    "mode": "valid",
    "delay": 5000
  },
  {
    "kind": "server-ready",
    "utc": "2026-10-27T14:28:25.086Z",
    "mono_ns": "921894208575468",
    "ms": 8132.742029
  },
  {
    "kind": "rpc-connected",
    "utc": "2026-10-27T14:28:25.176Z",
    "mono_ns": "921894299134139",
    "ms": 8223.296502
  },
  {
    "kind": "child-ready",
    "utc": "2026-10-27T14:28:25.342Z",
    "mono_ns": "921894464392179",
    "ms": 8388.551576,
    "threadId": "fixture-thread-a",
    "terminalId": "term-0",
    "childPid": 3415308,
    "marker": "READY_R05_0"
  },
  {
    "kind": "scenario-complete",
    "utc": "2026-10-27T14:28:56.819Z",
    "mono_ns": "921925941457411",
    "ms": 39865.615816
  },
  {
    "kind": "cleanup-start",
    "utc": "2026-10-27T14:28:56.945Z",
    "mono_ns": "921926067942647",
    "ms": 39992.104479,
    "pids": [
      3413392,
      3413393,
      3415305,
      3415308
    ],
    "ptyPids": [
      3415305,
      3415308
    ]
  },
  {
    "kind": "cleanup-end",
    "utc": "2026-10-27T14:28:59.053Z",
    "mono_ns": "921928175505473",
    "ms": 42099.672844,
    "survivorsBeforeFinalKill": [],
    "remaining": []
  }
]
```
Metadata snapshots taken before and after driver cleanup:
```json
[
  {
    "kind": "state",
    "utc": "2026-10-27T14:28:56.819Z",
    "mono_ns": "921925941291741",
    "ms": 39865.45248,
    "terminals": [
      {
        "threadId": "fixture-thread-a",
        "terminalId": "term-0",
        "cwd": "/tmp/lead-24640-r1/capture/2026-10-27T14-28-16.951Z-after-R05",
        "worktreePath": null,
        "status": "running",
        "pid": 3415305,
        "exitCode": null,
        "exitSignal": null,
        "hasRunningSubprocess": true,
        "label": "fixture-child",
        "updatedAt": "2026-10-27T14:28:31.243Z"
      }
    ]
  },
  {
    "kind": "state",
    "utc": "2026-10-27T14:28:56.929Z",
    "mono_ns": "921926051335063",
    "ms": 39975.495902,
    "terminals": []
  }
]
```

## Behaviour difference
1s timeout → 5s result, then ~20s 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.