Skip to content

Commit 358db8a

Browse files
Keep a second credential error from failing the session (#926)
* Keep a second credential error from failing the session A rebuilt agent reused seq 0 for the next same-category inference error, so commitErrors threw Duplicate error record and afterCheckpoint failed the run. Resume the durable error sequence on assembly and drop a colliding flush instead of failing the session. * Ledger vendor error sequence patches * Drop only the colliding error record on a duplicate flush A stale-seq assembly flushing [seq0/dup, seq1/fresh] discarded the whole batch, losing fresh diagnostics. The flush now maps the colliding key back to its record, drops only that record, and retries the rest in the same flush.
1 parent 8f1413f commit 358db8a

16 files changed

Lines changed: 588 additions & 35 deletions

File tree

docs/VENDORING.md

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ points straight at `./src/*.ts` files rather than a `dist/` build.
2222

2323
## What's vendored
2424

25-
| Package | Vendor path | License | Synced from upstream commit | Retrieved | Local patches |
26-
| -------------------------------------------------- | ------------------------------------- | ------------- | ------------------------------------------ | ---------- | -------------------------------------------- |
27-
| `@intx/inference` | `vendor/intx-inference/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | Yes — see `vendor/intx-inference/PATCHES.md` |
28-
| `@intx/types` | `vendor/intx-types/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | Noneverbatim |
29-
| `@intx/storage-isogit` | `vendor/intx-storage-isogit/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | Noneverbatim |
30-
| `@intx/agent` | `vendor/intx-agent/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | Noneverbatim |
31-
| `@intx/authz` | `vendor/intx-authz/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
32-
| `@intx/log` | `vendor/intx-log/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
33-
| `@intx/tools-posix` | `vendor/intx-tools-posix/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
34-
| `@intx/mailbox` | `vendor/intx-mailbox/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
35-
| `@intx/harness` | `vendor/intx-harness/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
36-
| `@intx/mime` | `vendor/intx-mime/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
37-
| `@intx/workflow-host` (partial — `adapters/` only) | `vendor/intx-workflow-host/adapters/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
25+
| Package | Vendor path | License | Synced from upstream commit | Retrieved | Local patches |
26+
| -------------------------------------------------- | ------------------------------------- | ------------- | ------------------------------------------ | ---------- | ------------------------------------------------- |
27+
| `@intx/inference` | `vendor/intx-inference/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | Yes — see `vendor/intx-inference/PATCHES.md` |
28+
| `@intx/types` | `vendor/intx-types/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | Yessee `vendor/intx-types/PATCHES.md` |
29+
| `@intx/storage-isogit` | `vendor/intx-storage-isogit/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | Yessee `vendor/intx-storage-isogit/PATCHES.md` |
30+
| `@intx/agent` | `vendor/intx-agent/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | Yessee `vendor/intx-agent/PATCHES.md` |
31+
| `@intx/authz` | `vendor/intx-authz/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
32+
| `@intx/log` | `vendor/intx-log/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
33+
| `@intx/tools-posix` | `vendor/intx-tools-posix/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
34+
| `@intx/mailbox` | `vendor/intx-mailbox/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
35+
| `@intx/harness` | `vendor/intx-harness/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
36+
| `@intx/mime` | `vendor/intx-mime/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
37+
| `@intx/workflow-host` (partial — `adapters/` only) | `vendor/intx-workflow-host/adapters/` | LGPL-2.1-only | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | 2026-09-07 | None — verbatim |
3838

3939
## Provenance, ownership, and kill dates
4040

@@ -48,9 +48,9 @@ package; the date is the deadline even if it is not.
4848
| Vendor path | Upstream repo | Upstream commit | Patched | Why not the published package | Owner | Proposed kill date |
4949
| ------------------------------------- | ----------------------- | ------------------------------------------ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------ |
5050
| `vendor/intx-inference/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | Yes — `PATCHES.md` | Local fixes not yet upstream | runtime | 2027-03-07 or when patches land upstream and publish |
51-
| `vendor/intx-types/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | No | Cross-package coupling with `@intx/inference` | runtime | 2027-03-07 or when the coupled trio publishes past `0.3.0` |
52-
| `vendor/intx-storage-isogit/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | No | Cross-package coupling with `@intx/inference` | runtime | 2027-03-07 or when the coupled trio publishes past `0.3.0` |
53-
| `vendor/intx-agent/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | No | Vendored at Interchange head ahead of npm | runtime | 2027-03-07 or when `@intx/agent@>=0.4.0` publishes |
51+
| `vendor/intx-types/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | Yes — `PATCHES.md` | Cross-package coupling with `@intx/inference` | runtime | 2027-03-07 or when the coupled trio publishes past `0.3.0` |
52+
| `vendor/intx-storage-isogit/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | Yes — `PATCHES.md` | Cross-package coupling with `@intx/inference` | runtime | 2027-03-07 or when the coupled trio publishes past `0.3.0` |
53+
| `vendor/intx-agent/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | Yes — `PATCHES.md` | Vendored at Interchange head ahead of npm | runtime | 2027-03-07 or when `@intx/agent@>=0.4.0` publishes |
5454
| `vendor/intx-authz/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | No | Vendored at Interchange head ahead of npm | runtime | 2027-03-07 or when `@intx/authz@>=0.4.0` publishes |
5555
| `vendor/intx-log/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | No | Vendored at Interchange head ahead of npm | runtime | 2027-03-07 or when `@intx/log@>=0.4.0` publishes |
5656
| `vendor/intx-tools-posix/` | `faremeter/interchange` | `0205b07b64d03f0fec2e4be3593c764070a9ba8a` | No | Vendored at Interchange head ahead of npm | runtime | 2027-03-07 or when `@intx/tools-posix@>=0.4.0` publishes |
@@ -118,9 +118,11 @@ The 2026-09-07 sync also vendored the remaining four consumed packages
118118
(`@intx/agent`, `@intx/authz`, `@intx/log`, `@intx/tools-posix`) at the
119119
same upstream commit, completing the set: every `@intx/*` package this
120120
repo imports now resolves to vendored source. None of the four carried
121-
local patches at vendoring time; their trees are verbatim upstream
122-
copies. `@intx/tools-lsp` remains on published npm (`0.3.0`) — it is a
123-
thin adapter whose transitive `@intx/*` dependencies resolve to the
121+
local patches at vendoring time. `@intx/agent` later gained the error-seq
122+
patches ledgered in `vendor/intx-agent/PATCHES.md`; the other three remain
123+
verbatim upstream copies. `@intx/tools-lsp` remains on published npm
124+
(`0.3.0`) — it is a thin adapter whose transitive `@intx/*` dependencies
125+
resolve to the
124126
vendored workspaces via root `overrides`, so it tracks the vendored set
125127
without being vendored itself. Published transitive dependencies that
126128
stay on npm (`@intx/crypto`, `@intx/inference-discovery`,
@@ -187,13 +189,14 @@ those packages now resolves to the single root instance. As of this sync,
187189

188190
## Patched vs. verbatim
189191

190-
Of the eleven vendored paths, exactly one carries local patches:
191-
`@intx/inference` — every divergence is a real fix not yet upstream, listed
192-
one-per-patch in `vendor/intx-inference/PATCHES.md`. The other ten paths
193-
(nine whole packages plus the partial `vendor/intx-workflow-host/adapters/`
192+
Of the eleven vendored paths, four carry local patches:
193+
`@intx/inference`, `@intx/types`, `@intx/storage-isogit`, and
194+
`@intx/agent` — every divergence is a real fix not yet upstream, listed
195+
one-per-patch in that package's `PATCHES.md`. The other seven paths
196+
(six whole packages plus the partial `vendor/intx-workflow-host/adapters/`
194197
tree) are verbatim copies of upstream — no modifications. A diff against a
195198
pristine upstream checkout at the same commit and paths will show 100%
196-
upstream-authored lines.
199+
upstream-authored lines for those seven.
197200

198201
## Notable upstream shape changes carried by the 2026-08-22 sync
199202

@@ -229,12 +232,12 @@ different reason — the vendored mime sources import `@intx/crypto`, which
229232
stays on published npm, and `Bun.build` cannot resolve that bare specifier
230233
from inside the vendor workspace.
231234

232-
`@intx/inference` carries local patches — real fixes not yet present
233-
upstream, not workarounds for something upstream has since fixed. Every
234-
patched location carries a one-line comment naming its site-specific entry
235-
in `vendor/intx-inference/PATCHES.md` (e.g. `#reactor-ts-correlating-ids-leak`),
236-
so `grep -rn "Locally patched" vendor/intx-inference/src` finds every
237-
divergence. **Markers are navigation; the SHA-diff is proof.** Run
235+
Patched packages carry local fixes not yet present upstream, not
236+
workarounds for something upstream has since fixed. Every patched
237+
location carries a one-line comment naming its site-specific entry in
238+
that package's `PATCHES.md` (e.g. `#reactor-ts-correlating-ids-leak`),
239+
so `grep -rn "Locally patched" vendor/*/src` finds every divergence.
240+
**Markers are navigation; the SHA-diff is proof.** Run
238241
`bin/vendor-patch-diff` against a pristine upstream checkout at the
239242
recorded SHA to print exactly the lines that are ours. A correspondence
240243
test (`tests/unit/vendor-patch-ledger.test.ts`) fails if a marker anchor
@@ -253,7 +256,8 @@ does not resolve to a ledger heading, or if a ledger heading has no marker.
253256
`adapters/substrate-mailbox-store.ts` and
254257
`adapters/substrate-mailbox-store.test.ts`). Run
255258
`bun install`, `bun run typecheck`, `bun run build`, `bun run test`.
256-
3. For a **patched** package (`@intx/inference`): before overwriting
259+
3. For a **patched** package (`@intx/inference`, `@intx/types`,
260+
`@intx/storage-isogit`, `@intx/agent`): before overwriting
257261
anything, run `bin/vendor-patch-diff` (optionally
258262
`--upstream /path/to/interchange`) to re-derive the exact local
259263
divergences against the recorded SHA — do not trust `PATCHES.md`'s

src/session/assemble-runtime.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ function stubAuditStore(): AuditStore {
143143
commitAudit: async () => undefined,
144144
commitErrors: async () => undefined,
145145
loadAudit: async () => [],
146+
loadErrors: async () => [],
146147
};
147148
}
148149

src/session/optimized-context-store.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@ describe("createSessionStores", () => {
800800
expect(typeof audit.commitAudit).toBe("function");
801801
expect(typeof audit.commitErrors).toBe("function");
802802
expect(typeof audit.loadAudit).toBe("function");
803+
expect(typeof audit.loadErrors).toBe("function");
803804
});
804805
});
805806

src/session/optimized-context-store.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ export async function createSessionStores(
848848
commitErrors: (records, signal) =>
849849
withResolvedDirLock(dir, () => base.commitErrors(records, signal)),
850850
loadAudit: (sessionId, signal) => base.loadAudit(sessionId, signal),
851+
loadErrors: (sessionId, signal) => base.loadErrors(sessionId, signal),
851852
};
852853

853854
return { storage: store, audit: store };

vendor/intx-agent/PATCHES.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Patch ledger — vendor/intx-agent
2+
3+
**The SHA-diff is authoritative; markers are navigation.**
4+
5+
Recorded upstream commit lives in `docs/VENDORING.md`. A pristine checkout
6+
at that SHA, diffed against `vendor/intx-agent/src`, is the only proof of
7+
which lines are ours — run `bin/vendor-patch-diff` to produce it. The
8+
`Locally patched — see …#<anchor>` comments and the entries below are
9+
signposts that point into that diff; they do not define its extent.
10+
11+
## agent-ts-resume-error-seq
12+
13+
`agent.ts``createAgent` resumes `errorSeq` from `auditStore.loadErrors`
14+
so a rebuilt agent does not reuse seq 0 and collide with files the
15+
previous assembly already committed. If `loadErrors` throws, assembly
16+
still succeeds and seq starts at 0; a later colliding flush is dropped
17+
by `agent-ts-duplicate-error-flush` rather than failing the session.
18+
19+
**Disposition:** Promotion candidate. **Removal path:** Upstream PR to
20+
`createAgent` that resumes the durable error sequence; then drop this
21+
entry and its marker.
22+
23+
## agent-ts-duplicate-error-flush
24+
25+
`agent.ts``flushErrors` treats `Duplicate error record:` from
26+
`commitErrors` as already-durable instead of failing `afterCheckpoint`.
27+
Only the record named by the colliding `<sessionId>/<seq>-<category>`
28+
key is dropped; the rest of the batch is retried in the same flush, so
29+
a stale-seq assembly flushing `[seq0/dup, seq1/fresh]` still persists
30+
the fresh record. An unparseable key falls back to dropping the batch.
31+
Identical-bytes exact retries still commit normally upstream.
32+
33+
**Disposition:** Promotion candidate. **Removal path:** Upstream PR with
34+
the same duplicate-flush handling; then drop this entry and its marker.
35+
36+
## testing-audit-noop-ts-load-errors
37+
38+
`testing/audit-noop.ts` — No-op `AuditStore` implements `loadErrors` as
39+
an empty array so it satisfies the patched `AuditStore` contract.
40+
41+
**Disposition:** Companion of `runtime-ts-audit-store-load-errors`.
42+
**Removal path:** Ships out with the types patch.

0 commit comments

Comments
 (0)