Repository navigation
Commit 927c480
authored
fix: resynchronize current session metadata on ACP v2 resume (#717)
## Summary
- Add one v2 session-info metadata owner at the common send boundary.
Shared v1-shaped and direct v2 publications use the same shallow patch
state. Omission leaves values unchanged, top-level nulls remove keys,
and nested objects replace whole values.
- On every successful resume, after replay/live-event draining and
before the response, clear retained client metadata with `_meta: null`,
then restore the agent's currently known metadata when nonempty.
Serialize both frames with live session-info updates so an older
restoration cannot overwrite a newer patch.
- Keep metadata for the active session lifetime, including full replay.
Resume reinstalls `SessionState`, so the metadata lifetime must not
follow that object's identity. Seed known native thread status before
releasing new live events. Close/reopen starts a fresh metadata
lifetime.
- Carry the current failure reference across active reinstallation.
Clear published failure metadata when that incident resolves, preserving
sibling metadata and checking the ID/revision so a late resolution
cannot remove a newer incident.
- Preserve notification `params._meta` through the shared v2 conversion
path, but do not store or replay it as entity metadata. Keep v1 wire
behavior unchanged.
Checked against ACP `a965f1f1`:
`docs/protocol/v2/extensibility.mdx:103-150` defines metadata
replacement/removal and explicit resynchronization clears.
`docs/protocol/v2/session-setup.mdx:355-358` recommends current session
info after replay and before the response, including omitted/null
`replayFrom`.
## Scope
This synchronizes currently known `session_info_update` metadata. It
does not invent a deep merge for extension namespaces, copy raw
session-list snapshot metadata into entity patches, or reconstruct every
metadata field from persistent storage. Writers sharing a top-level
namespace still need to compose complete values; that cleanup is
separate, with the new serialized domain-patch API available for it.
Newer upstream auth/proxy/background schema additions are not adopted
here. No review/checklist Markdown file is included.
## Validation
- `npm run typecheck`
- `npm run build`
- `npm test`: 2,358 passed, 39 skipped
- `npm run test:integration`: all 19 passed
- `npm run codex-test -- -p "Reply with exactly OK. Do not use tools or
modify any files." -o summary`: completed with `end_turn`
- `git diff --check`
- Opt-in E2E tests were not run.
Coverage includes shallow replacement and removals, nested null values,
clearing keys the agent has never seen, JSON copies, notification-only
metadata, serialization under backpressure, queued patches, disposal
during restoration, write-failure recovery, failure revision matching,
active resumes with/without replay, close/reopen, current failure
continuity, and post-close publication fencing. The real-Codex
foreground-state integration covers all replay settings with the
extended info synchronization sequence.1 parent 580d8b9 commit 927c480
11 files changed
Lines changed: 396 additions & 17 deletions
File tree
- src
- __tests__
- CodexACPAgent
- data
- integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
| |||
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
83 | | - | |
| 89 | + | |
84 | 90 | | |
85 | | - | |
| 91 | + | |
| 92 | + | |
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
| |||
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
102 | 127 | | |
103 | 128 | | |
104 | 129 | | |
| |||
114 | 139 | | |
115 | 140 | | |
116 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
117 | 162 | | |
118 | 163 | | |
119 | 164 | | |
| |||
216 | 261 | | |
217 | 262 | | |
218 | 263 | | |
219 | | - | |
| 264 | + | |
220 | 265 | | |
221 | 266 | | |
222 | 267 | | |
| |||
297 | 342 | | |
298 | 343 | | |
299 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
300 | 350 | | |
301 | 351 | | |
302 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1407 | 1407 | | |
1408 | 1408 | | |
1409 | 1409 | | |
1410 | | - | |
| 1410 | + | |
1411 | 1411 | | |
1412 | 1412 | | |
1413 | 1413 | | |
| |||
1593 | 1593 | | |
1594 | 1594 | | |
1595 | 1595 | | |
1596 | | - | |
| 1596 | + | |
1597 | 1597 | | |
1598 | 1598 | | |
1599 | 1599 | | |
1600 | 1600 | | |
1601 | 1601 | | |
1602 | 1602 | | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
1603 | 1614 | | |
1604 | 1615 | | |
1605 | 1616 | | |
| |||
1962 | 1973 | | |
1963 | 1974 | | |
1964 | 1975 | | |
1965 | | - | |
1966 | | - | |
1967 | | - | |
1968 | | - | |
| 1976 | + | |
1969 | 1977 | | |
1970 | 1978 | | |
1971 | 1979 | | |
| |||
3567 | 3575 | | |
3568 | 3576 | | |
3569 | 3577 | | |
3570 | | - | |
| 3578 | + | |
3571 | 3579 | | |
3572 | 3580 | | |
3573 | 3581 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
372 | 373 | | |
373 | 374 | | |
374 | 375 | | |
| 376 | + | |
375 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
376 | 387 | | |
377 | 388 | | |
378 | 389 | | |
| |||
381 | 392 | | |
382 | 393 | | |
383 | 394 | | |
384 | | - | |
| 395 | + | |
385 | 396 | | |
386 | 397 | | |
387 | 398 | | |
| |||
1199 | 1210 | | |
1200 | 1211 | | |
1201 | 1212 | | |
1202 | | - | |
| 1213 | + | |
1203 | 1214 | | |
1204 | 1215 | | |
1205 | 1216 | | |
| |||
0 commit comments