Skip to content

fix(batch): stop impossible language recovery inspection loops - #23795

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/projfence-followup
Oct 27, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/projfence-followup

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Problem and behavior

A language-guarded window longer than the fixed 60-second independent recovery limit could remain prepared when strict CPU VAD found no spans. Every recovery wake downloaded and inspected the same audio again, with no possible paid start or durable refusal.

Recovery now transactionally records an independent_duration_limit refusal and retains the unit as failed_held before any paid start. It keeps encrypted audio, worker VAD evidence, and the maximum held speech census. Successful siblings can finish as partial while this audio remains retained for a separate recovery plan. The existing paid-redrive tool requires a started intent and cannot adopt this no-spend refusal; the 60-second independent limit still applies. This change stops the loop without transcribing longer units. No speech result is fabricated and no provider call is added. Temporary settings, lower runtime caps, and allowance refusals retain their existing retry behavior.

The transaction requires the current prepared token, original ledger and privacy generation, no existing result, and no live worker lease. It uses the validated WAV duration, checks the same immutable audio URI, and rechecks the inspector's 0.1-second stored-duration tolerance. A concurrent paid start, stale token, changed privacy state, other audio, or other owner cannot be retired through this path.

Validation

  • backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST covering language recovery, quarantine recovery, and speech redrive: 268 passed (104+134+30), including stored59.96s/decoded60.04s and stored60s/decoded60.04s boundaries.
  • Hermetic sync harness: 11 passed, 129 deselected.
  • Strict transaction regressions cover retained zero/positive worker census, one download across repeated deliveries, no provider calls, partial sibling completion, and stale/running/leased/receipted/privacy-blocked refusal.
  • Tests run serially through omi-heavy under nice -n 19. Mandatory repository push gates and remote CI are recorded separately.

Follow-up to #23783 under lead ruling 08863e; this PR requires review and green CI before handoff. Lead owns merge and deployment. No production write, flag flip, provider spend, or deployment is performed by this lane.

Failure-Class: FC-batch-fault-domain-head-of-line-poison

The regression in backend/tests/unit/test_batch_language_recovery.py ensures an impossible prepared recovery reaches reasoned held custody after one inspection, preserving audio and all positive speech evidence.

A guarded window above the fixed independent duration limit with no CPU VAD
spans remained prepared, repeatedly downloading and inspecting the same audio.
Retain it as failed-held with a reasoned no-spend refusal, preserving worker
speech evidence and reviewed redrive custody. Temporary runtime policy and
allowance refusals retain their retry behavior.

Failure-Class: FC-batch-fault-domain-head-of-line-poison
Verify the current paid-redrive tool cannot treat a never-started custody hold
as a spent recovery. Document that longer-window transcription needs a separate
reviewed recovery plan; the bounded custody fix does not perform it.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T07:22:53.354649Z 2c12425 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Use the decoded WAV duration for the hard independent limit and transactionally
verify the immutable audio URI and existing 0.1-second job-duration tolerance.
Cover slightly-under-limit stored durations paired with over-limit WAVs, plus
refusal if the audio identity changed before settlement.

Failure-Class: FC-batch-fault-domain-head-of-line-poison
@Git-on-my-level
Git-on-my-level merged commit 568c436 into main Oct 27, 2026
61 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/projfence-followup branch October 27, 2026 13:58
Git-on-my-level added a commit that referenced this pull request Oct 27, 2026
 repair and #23795 duration-limit

Reconciles the operator script's four modes (epoch-2 default, epoch-3
independent, epoch-4 words repair from main, epoch-1 prepared take-over
from this lane) and keeps every existing plan digest byte-stable.

Also extends the prepared take-over to the exact failed_held shape that
#23795's hold_duration_limit refusal settles without ever starting the
intent: RecoveryStore.start_duration_limited reopens only that shape
(never a spent intent) in one fenced transition into the running
take-over, so a concurrent sweep cannot re-settle the refusal between
reopen and start.
Git-on-my-level added a commit that referenced this pull request Oct 27, 2026
…r language guards (#23812)

## Summary

Two reviewed capabilities for the 5-r1027b language-guarded held set
(lead ruling 0f7cec on op1 900ca2; partition in
`selector/proposal-14z.md`, option A design in
`selector/proposal-soniox18.md`):

1. **Scoped operator recovery for language-guarded `prepared` units
above the 60s bound (option A).** A new `--prepared-independent` mode in
`backend/scripts/batch_pipeline_speech_redrive.py` accepts an explicit
sealed id list (`--unit-ids-file`, exact ids required) and takes over
the **existing** epoch-1 prepared intent via `RecoveryStore.start` — the
same at-most-once token fence; no new marker intent is created and
custody is preserved. It then runs independent Soniox recovery for those
ids only, up to a scoped `--max-seconds` that must exceed the runtime
60s bound. Dry-run by default; the plan sha (`paid_digest`) binds the
seal census, `max_seconds` and `usd_cap`; the closed cost estimate
(`ESTIMATED_USD_PER_AUDIO_HOUR`) must fit `--usd-cap` or the plan
refuses. The owner allowance is rechecked against Soniox exactly as the
runtime independent route (`sync_allowed`, `DispatchPath.QUARANTINE`) —
the take-over never bypasses it.

2. **Guarded terminal outcome.** A language-guarded unit may settle
`no_recoverable_speech` only when every recognizer returned a
**validated empty receipt** (modulate and soniox, `word_count == 0`) and
independent recovery was attempted; the payload records
`LANGUAGE_GUARD_EMPTY_EVIDENCE`. The existing refusal (`independent
recovery required`) stands whenever recovery was not attempted or any
receipt is non-empty (words/error/refused). Guarded silence and the
guarded canary route keep refusing in the terminal tool.

## Reconciliation with #23795 (duration-limit refusal) and #23775 (words
repair)

Main moved under this lane; the branch merges origin/main and reconciles
the operator script's four modes (epoch-2 default, epoch-3 independent,
epoch-4 words repair, epoch-1 prepared take-over) with every existing
plan digest byte-stable.

#23795's `hold_duration_limit` settles the sealed population's
no-CPU-span subset as `failed_held` with an `independent_duration_limit`
refusal — **without ever starting the intent** (no provider call,
receipt, provider or failure). Once that fix train serves, those units
are no longer `prepared`, so the take-over extends to exactly that
shape:

- `config.batch_language_recovery.duration_limited(job)` recognizes only
the exact refusal shape #23795 writes; a spent intent (real failure)
never matches.
- `RecoveryStore.start_duration_limited` mirrors `hold_duration_limit`'s
fence and performs one atomic transition refusal→running (provider
`modulate`, fresh `started_at`, refusal and its `settled_at` removed).
Going straight to running closes the race where a concurrent sweep could
re-settle the refusal between a reopen and a `start()`.
- The sealed plan's fingerprint freezes `(token, epoch,
privacy_generation, prepared_at)`, none of which the refusal settlement
touches — so one frozen cohort covers each unit in whichever state the
runtime has left it (`prepared`, refusal-settled, or already spent by
this plan).

## What is deliberately unchanged

- The global runtime 60s independent bound (`MAX_AUDIO_SECONDS`) and
`allowed()` — the env can still only lower it. The runtime's new #23795
settlement behavior is preserved verbatim (test
`test_runtime_duration_limit_still_settles_without_a_provider_call`).
- `held_result_allowed` / the runtime settle fence — a guarded unit
still cannot settle `no_recoverable_speech` through the runtime; only
the reviewed terminal tool path gains that outcome.
- An empty or failed operator take-over settles `failed_held` through
the same Soniox receipts as the runtime independent route. It never
fabricates the unattempted Modulate receipt that the independent silence
contract (`validate_independent_silence`) requires, so a take-over
cannot settle silence.
- Existing epoch-2/3/4 plan digests are byte-stable (the new knobs are
only bound into prepared-mode digests).

## Fences (per unit)

`prepared_eligible`: owner pin, quarantined in window, `worker_failed`,
language-guarded, epoch 1 with token and no `started_at`/receipts,
`prepared` (unsettled) **or** the exact duration-limit refusal shape, no
result and no
`speech_redrive`/`silence_disposition`/`terminal_disposition` marker,
and `60 < duration <= max_seconds`. Every id in the sealed file must be
eligible (`unit_not_eligible` otherwise); the cohort manifest freezes
ids and per-unit fingerprints; `checked_prepared` revalidates seal
identity, eligibility and ledger debt in a read-only transaction before
any apply step; `RecoveryStore.checked` gains an opt-in
`allow_completed_recovery` ledger path (default off, no existing caller
changes) so a settled unit replays after projection completes.
`start_duration_limited` refuses everything except the exact refusal
shape (wrong token, foreign audio uri, sub-bound duration, spent
intent).

## Tests

New: `tests/unit/test_batch_pipeline_prepared_independent.py` (30) —
sealed-selection fence matrix (including the refusal shape and a
spent-failure negative), dry-run read-only and no-audio-download, spend
cap, scoped bound (both > max and <= 60 refused), runtime bound identity
(flag on + env 190 still refuses >60s), #23795 runtime identity, refusal
reopen through the take-over, `start_duration_limited` shape-fence
negatives, words recovery through worker-VAD word clocks, empty/error
settle `failed_held` with soniox-only receipts, allowance recheck,
at-most-once (`already_applied`, `running_held`, artifact-only
reconcile), fingerprint stability across refusal settlement and spend,
digest binding incl. legacy byte-stability.
`tests/unit/test_batch_pipeline_guarded_terminal.py` (17) — guarded
terminal settle with recorded evidence + replay, negative controls for
each missing/non-empty receipt condition, guarded silence and canary
still refused, dry-run read-only, and the live runtime→terminal
integration (runtime records both empty receipts, plan settles the
unit). Existing suites for every touched module (12 files incl. main's
repair/duration-limit suites) pass unchanged.

## Operator runbook (after lead grant by plan sha)

Dry-run from the pinned train image, RO tier: `--stage prod
--prepared-independent --unit-ids-file <sealed 18 file> --cohort-file
<new> --quarantined-after/-before <window> --expect-count 18
--expect-speech-count 18 --paid-epoch 1 --max-seconds 190 --usd-cap 3`.
Then apply with `--apply --approve-plan-sha256 <plan sha> --apply-limit
18` under prod-operator. Sealed snapshot:
`prepared-snapshot-124022.json` (sha256 bfc0e6d5…, 18 ids,
60.02–181.02s, 1458.57s total ≈ $0.04 estimated). The plan covers each
unit whether the runtime has left it `prepared` or
#23795-refusal-settled.

Note for the run: on an empty Soniox answer these units settle
`failed_held` (soniox-only receipt). The terminal tool then requires
padded-retry evidence they do not carry, so empty answers stay held —
words are what releases them. The 6 guarded failed_held with both empty
receipts (and padded evidence) settle through
`scripts/batch_pipeline_terminal_empty.py` as `no_recoverable_speech`.

Failure-Class: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant