Skip to content

T1b: Reconcile item upserts without full conversation refresh - #41

Merged
VolkerChristian merged 1 commit into
codex/t1a-keyed-segment-reconciliationfrom
codex/t1b-structural-item-upserts
Aug 22, 2026
Merged

T1b: Reconcile item upserts without full conversation refresh#41
VolkerChristian merged 1 commit into
codex/t1a-keyed-segment-reconciliationfrom
codex/t1b-structural-item-upserts

Conversation

@VolkerChristian

Copy link
Copy Markdown
Member

Stack

Depends on #40. This PR is intentionally based on codex/t1a-keyed-segment-reconciliation, so its diff contains only T1b.

Pre-implementation finding check

The scope split was verified against merged AISuite 61ed3704 before implementation:

  • ItemUpsertedOccurrence only calls upsertItem; it cannot delete descendants.
  • Legacy turn.updated sets replaceItems = true, while the public TurnUpsertedChange hides that bit.
  • Therefore only the two resolved ItemUpsertedChange parent branches are structural. TurnUpsertedChange, ThreadUpsertedChange including thread-read effects, unresolved item parents, and broad lifecycle scopes remain full/deletion-capable.

Change

  • Add bounded structurallyAffectedThreadIds alongside the affected/full sets.
  • Preserve it through the one-slot mailbox and 16 ms frame accumulator in either order with exact append metadata.
  • Make full/deletion-capable scope dominate structural scope; all-thread overflow clears bounded structural metadata.
  • Bypass the exact-only early return when structural reconciliation is pending: apply exact content once, then derive the bounded timeline window and reconcile keyed segments.
  • Preserve message content widgets and update only metadata after an already-applied exact append; activity rows reconcile canonically without retrying the append.
  • Skip addition-unneeded dock configuration, thread title/detail, incomplete-history proof, all-turn current-turn scan, turn summary/failure, and Workbench breadcrumb reconstruction. Keep freeze ordering, tail-window eviction, keyed segment reconciliation, geometry/anchor settling, Inspector refresh, and latest-turn agent activity.

Runtime proof

  • Direct and turn-resolved item parents map structural; unresolved parents remain broad; TurnUpsert remains full.
  • Mapper and mailbox full-over-structural dominance work in both orders, with bounded overflow-to-all.
  • Exact and structural metadata survive both mailbox and frame accumulation orders.
  • The Conversation test drives two fresh widgets through the production accumulator for exact→structural and structural→exact. In both runs, all 50 added items receive widgets, all pre-existing segment/content QWidget* identities survive, text appends once, metadata refreshes, streamAppendCount increments once, and materialization/full-replacement counters do not move.
  • Default deletion-capable reconciliation immediately removes the keyed lookup and destroys the removed widget after deferred deletion.

Validation

  • Canonical incremental build root: /home/voc/projects/drafts/.codex-builds/codexui-final-verify-20260822
  • Full CodexUI build: passed
  • Full CodexUI test suite: 7/7 passed
  • Independent scope/Workbench and Conversation reviews: clean
  • Source deletion census: 152 lines, all replaced by the structural/full render guards, extracted tested accumulator, consolidated pending fields, or structural ItemUpsert mapper.
  • No golden hash or protocol fingerprint changed.

Introduce a structural thread scope for only resolved item upserts. Preserve exact append metadata through mailbox and frame coalescing, let deletion-capable scopes dominate, and continue from exact content application into keyed topology reconciliation without rebuilding unrelated presentation state.

Call-site audit: stateUpdateScope has one production caller and 13 pre-existing direct test calls; only its two resolved ItemUpsert branches change. mergeScope has one production call. refreshState has 19 callers; only the 16 ms drain passes structural mode and the other 18 retain defaults. ConversationWidget::render has 80 current call sites (one production, 79 tests); the production caller passes the mode, the 76 pre-existing tests retain the default, and only the structural call among three new proof sites passes true.

Deletion census: 152 lines removed under src/. ConversationWidget removes 78 lines by guarding/refactoring the existing title, completeness-proof, current-turn, summary, and render-signature paths into structural/full modes. Workbench removes 67 lines by extracting its inline frame accumulator and consolidating four pending-state fields. FrontendSessionWorker removes six old full-scope ItemUpsert lines in favor of structural mapping; FrontendSession removes one superseded merge line. No semantic block was discarded.

Runtime proof covers both item-parent resolutions, legacy TurnUpsert full authority, bounded mailbox/full dominance, both exact/structural arrival orders through the production accumulator and UI, 50 new widgets with preserved identities, one incremental append with no rematerialization/replacement, and deletion destruction. No golden hash or protocol fingerprint changed.
@VolkerChristian
VolkerChristian merged commit d341118 into codex/t1a-keyed-segment-reconciliation Aug 22, 2026
1 check passed
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