Skip to content

refactor(ui): simplify session row and resource ownership - #169044

Merged
steipete merged 8 commits into
mainfrom
deslop/p11-ui-2-20261010
Oct 11, 2026
Merged

steipete merged 8 commits into
mainfrom
deslop/p11-ui-2-20261010

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Simplifies Control UI state ownership that had grown around synthetic response-order interleavings.

User Impact

Normal rendered states and features stay unchanged. Unusual same-context read races become best effort; authorization, resource ownership, and ordinary write settlement remain enforced.

Why This Change Was Made

Remove the Control UI's per-field freshness protocol and simplify its read-side callers. Session rows now carry one coherent observation instead of separate source clocks, writer ancestry, read cutoffs, field selectors, certification fences, and captured-notification custody. Acknowledged writes publish directly into matching rows.

This is the second p11 simplification, following #168656. It removes 988 net production lines (+652/-1640 across 27 production files; tests/fixtures/generated files excluded), with the scope coverage log below. The campaign's 500–999 exception applies after the whole-scope implementation pass: retained write/security/order repairs reduced the original 1,026-line cut, rather than padding it to the threshold.

No markup, styles, Gateway wire/config/persisted shapes, dependency, or schema changes. Current permission checks, exact session/agent/resource identity, ordinary write settlement and rollback, compact-row omission/explicit clearing, bounded caches, and measured refresh pacing remain.

Coverage log

Area Removed Retained contract
Shared session rows Per-field clocks/writers, selector closures, self-merge settlement One row observation; identity; explicit null clearing and compact details
Roster observations Certification/revision fences, successor scans, staged callback custody Direct publication, normal reset/delete retirement, connection isolation, paced refresh
Reconciliation/ACKs General read admission and cross-row ACK arbitration Direct confirmed fields; one timestamp check; permission owner; pending/rollback truth from raw Gateway rows
Sidebar/details/chat Descriptor replay and canonical-list revision fences Current route/session checks, bounded ancestry traversal, normal errors
Activity Recap writer/read-cutoff arbitration and absent-row catch-up Authoritative list membership, summaries, filters, grouping, bounded work
Resource discovery Probe generations/counts, reconciliation promise handoff/replay Exact current assignment and pending-read publication checks, no provisioning/focus, manual layout and dismissal
Updates Four read generations and split-field response recombination Independent progress polling, auth-object retirement, command/consent/settlement boundaries
Inbox Revision floors and stale-list rejection Auth/profile/connection isolation, dismissal writes, coalescing and visible errors
Chat observer release Page retry timers, pending-release custody, rollback of successful replacement One exact-handle unsubscribe, shared-owner cleanup, auth/approval boundaries, readiness and subscribe recovery

The original sharpened provenance audit flipped/narrowed 11 of 15 KEEP groups. Its four retained groups were actual terminal execution/settlement, sandboxed Board authorization, Meetings privacy, and config/draft durability. This follow-up retains those boundaries. The descriptor cache has measured request reduction in #160148; event pacing is retained from #164764.

Best-effort tradeoffs accepted

Evidence

Landed: squash 4d80fd977174c782c3cf59e6264327332d57df8c; ancestry verified on origin/main. Final source head f18e08a32439d2a9b6043dc995d0207abd2b47f2 passed exact-head CI 38144516592, with all required statuses successful and no failed/cancelled checks. The current-head review has zero findings. No admin bypass or CI rerun was used.

  • Final repaired session scope and caller tests: 1,192 passed across 88 files, two existing opt-in performance cases unchanged (116.05 seconds wrapper wall time). The CI-policy Bun approval owner also passes 21/21.
  • Focused Inbox/update/Activity/resource callers: 173 distinct cases passed.
  • Rebased mock-Gateway browser flows: 28/28 passed across five files (103.23 seconds), covering desktop/browser discovery, sidebar stability, lineage, Activity and Details. All four pending-assignment cases remain.
  • Review regressions fail before their fixes: compact settings rollback, renewed-admin-grant Refresh cleanup, explicit-null archive restoration, and changed resource identity during a pending descriptor read. Compact settings owners passed 56 cases; update owners passed 32; archive/resource owners passed 78 before the added identity variant, then the resource owner passed 42/42. No production test seam was added.
  • Rebased UI production types, all seven UI test-type graphs and extension declarations passed.
  • Runtime import cycles: 0; Madge cycles: 0.
  • test/scripts/lint-suppressions.test.ts: 3 passed. No new suppressions, timeout increases, retries or skips.
  • Changed-file gate was run, not reported green: its initial pass reached dead-code checking after all earlier guards/types passed. The two UI unused exports and six UI lint findings were fixed; final targeted lint and Stylelint passed. A named-gate rebase incorporated main's fix for the unrelated GatewayApprovalEventPublisherV2 export. The rebased gate stops on the inherited max-lines failure below; remaining relevant types, cycles, lint and export checks were run directly.
  • Independent managed reviews: three suggestions asked to restore the explicitly accepted terminal-display, timestamp-less archive and Inbox stale-list ordering guarantees; rejected with the above provenance and retained-boundary reasoning. Actionable compact-omission, pending-assignment, loading-settlement, archive-null, and resource-identity findings were repaired with minimal boundary checks and regression proof. Final review raised a cross-agent cache allegation, rejected after tracing the unchanged descriptor owner: currentRow supplies only a freshness comparator, never returned data; request/result cache keys include the requested agent, and reset clears all descriptor reads. The existing agent-isolation tests passed. No actionable finding remains; the review itself did not report a clean verdict.

Testbox attempts produced no remote test result or allocated lease: unsupported direct-provider flags were rejected before allocation, then the corrected preparation was stopped before dispatch when the E2E inventory changed. Local focused proof is recorded; exact-head hosted CI remains the broad Linux gate. The directory-form local session test selector was also stopped during discovery; the explicit 76-file run above supplies the completed scope proof.

Inherited local main failures

Both are reproduced independently on clean main fd1fd2ce0ef8cb7e9c4074c8f855eff8992a54c2; this PR changes neither path:

  • check-max-lines-ratchet.mts: src/web-search/runtime.test.ts adds a max-lines suppression absent from the baseline.
  • check-deadcode-exports.mts: unused captureAgentRunTerminalWriteContext export in src/infra/agent-run-terminal-writes.ts. The full-tree and script scans pass; the production scan reports this same single finding on the candidate and main.

The clean-main export control initially lacked its UI dependency link and was rejected as invalid proof; the corrected linked checkout produced the finding above. No CI rerun, baseline relaxation, or suppression was used.

Exact-head CI correction

Run 38129440676 on bdcbe226ed02c49825602000971040b2ad3b3781 failed one test in checks-ui-e2e (2/4): cached sidebar replay displayed [9,8] children instead of [9]. This was PR-caused, not inherited. ClawSweeper identified the narrow root cause: presentation equality discarded the accepted row's newer sampling time. The correction preserves that whole-row stamp and re-sorts Activity using the merged timestamps it displays. No field clocks or replay protocol returns.

Both owner-level regressions failed before and passed after the fixes (24 tests passed). The original cached-replay E2E was restored unchanged and passes 2/2; an intermediate test-only simplification was superseded by the source repair. The cancelled sibling suites remain missing hosted proof; their local/Testbox results and the replacement exact-head CI are tracked before merge. No CI rerun or source-only repush was requested.

The next exact-head run, 38132988483 on 859d5b7d3cfe23246eb9b7a09d0456b206c4a17b, exposed six caller failures in UI unit shard 2. The global-agent approval queue is now cleared at the existing agent transition; its fixture waits for an active initial subscription, not merely a dispatched request. A raw older row cannot replace the confirmed settings rollback value. Activity keeps server order unless merged timestamps require sorting. These are retained security/write/display contracts, not restored generations.

A single immutable Testbox pass covered all 1,669 selected UI files: 22,187 passed, 19 failed, six existing skips. It exposed the same caller issues and more tests of retired field/read-clock interleavings. Those tests are removed or narrowed to normal scoped publication; existing access, mutation settlement, and resource checks remain. This is failure-discovery evidence on the prior head, not a claimed green run. The final 88-file local pass above covers every repaired owner and reported caller; final hosted CI is tracked separately.

Conflict-only rebase

GitHub reported CONFLICTING after main introduced dashboard partial rows. Rebased onto 5ed6a305669a5619ceb7bdc08936ead5f7f56408, preserving main's new row shape and its four omission/clearing cases. Dashboard rows use the same field-presence rule as compact rows. Three added dashboard rollback cases failed before that integration fix; the final 30-case row/rollback/descriptor run and 72-case affected-owner run pass. The replacement-row validity regression also failed before its one effect check. All seven UI test-type graphs, extension declarations, production UI types, scoped lint and zero-cycle checks pass.

The aggregate changed check now passes its early ratchets but reports the inherited duplicate-scan coverage omission for worker-heap-flag.mjs. The suppression suite reports three inherited entries in untouched state/Solid files. Both failures were reproduced in a clean checkout of the exact rebase base; no ignore, suppression, baseline, or timeout was changed. The new exact head is ea9255ed29de71a91eebf9366a6b65256930aa0d; its hosted results supersede prior-head CI, never relabel it.

Run 38142146543 on ea9255ed29de71a91eebf9366a6b65256930aa0d completed fully green: 44 successful and 40 skipped check runs, none failed or cancelled. Final review then found that descriptor-only restores also need the existing archive-read observation. This one-line behavior fix and its regression are in f18e08a32439d2a9b6043dc995d0207abd2b47f2. The regression failed before and passes after; its four focused suites pass 73 cases, all affected UI/test types and lint pass, and fresh independent review found no actionable finding. The final head's CI is tracked separately before merge.

Supplementary Testbox attempts do not supply passing proof: one command incorrectly compared the carrier commit instead of its verified source tree; a later environment lacked Bun and the E2E command duplicated configLoader. Those leases are stopped. The earlier immutable broad run and final exact-head hosted CI remain separately identified, without turning failed or cancelled attempts into passes.

Visual parity

Inspected synthetic before/after and repeated frames at 1280×900 are byte-identical for New Session, selected Chat, and populated Activity. The attached pairs are from the final rebased tree.

Before: New Session
After: New Session
Before: Chat
After: Chat
Before: Activity
After: Activity

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 11, 2026 09:44
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces per-field session freshness tracking with whole-row observations and simplifies related Control UI request and resource lifecycles.

Example: Session agent:main:descriptor-restore is archived at updatedAt=2, leaves the primary list, and a descriptor reports archived=false at updatedAt=3.

  • Before: The earlier PR head reapplied the archive confirmation and kept the session hidden.
  • After: Descriptor admission updates the archive confirmation and clears archived visibility.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has no remaining actionable finding and passing exact-head validation; behavior evidence remains primarily synthetic production-path harness coverage.
Proof confidence 🦐 gold shrimp (3/6) The supplied maintainer-authored classification exempts this refactor from the ordinary contributor proof gate; current owner and bundled-browser harness coverage supports it, while prepared images are historical and newer parity media retrieval failed on the review host.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Control UI state coordination carries substantial machinery for unusual response-order interleavings.
Reason: The feature-history owner has approved the simplification and explicitly accepted recoverable display tradeoffs; the patch removes complexity without adding configuration or persisted formats.

Merge readiness

✅ Ready for maintainer review

Keep this PR open for landing: the prior archive finding is fixed, the simplification has recorded owner direction, and all applicable exact-head checks pass without a remaining actionable finding.

Priority: P2
Reviewed head: f18e08a32439d2a9b6043dc995d0207abd2b47f2

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI session capability reconciles Gateway lists, descriptors, history, events, and mutation acknowledgements into scoped rows consumed by the sidebar, chat panes, Activity, and resource discovery.

flowchart TD
  A[Gateway responses and events] --> B[Shared session capability]
  B --> C[Whole row observations]
  B --> D[Permission and mutation owners]
  C --> E[Sidebar chat and Activity]
  D --> E
  E --> F[Scoped resource discovery]
Loading

Technical review

Best possible solution:

Land the simpler shared owner with its retained identity, permission, compact-row, and write-settlement contracts and documented best-effort display semantics.

Do we have a high-confidence way to reproduce the issue?

This is an intentional refactor rather than an unresolved bug report; the prior descriptor-restore defect has a focused regression and a verified source repair.

Is this the best way to solve the issue?

The shared whole-row owner is a reasonable simplification under the recorded direction, with explicit omission handling and separate permission and mutation settlement owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 89564fa3a101.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 1ad9fe2 adds ui/src/lib/sessions/session-row-provenance.ts:32 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1ad9fe2a759d; files: ui/src/lib/sessions/session-row-provenance.ts)
  • Vincent Koc: Raw commit 523c013 adds ui/src/app/update-overlay-helpers.ts:225 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 523c01363d22; files: ui/src/app/update-overlay-helpers.ts)

PR surface

Source -988, Tests -2126. Total -3114 across 61 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 27 647 1635 -988
Tests 34 605 2731 -2126
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 61 1252 4366 -3114

Review metrics

Metric Value Why it matters
Production versus test LOC Production +647/-1635; tests +605/-2731. The production reduction removes shared freshness machinery; added tests protect retained sampling, archive recovery, settings rollback, and resource identity contracts.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a normal-priority state-ownership simplification with bounded presentation effects and passing validation.
  • merge-risk: 🚨 session-state: The PR deliberately relaxes some session-display ordering guarantees; the maintainer records and accepts those tradeoffs while durable session state remains Gateway-owned.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (5 earlier review cycles)
  • reviewed 2026-10-11T09:51:57.844Z sha bdcbe22 :: needs changes before merge. :: [P2] Preserve the newer sampling time when reusing an unchanged row | [P2] Re-sort Activity rows after merging their accepted timestamps
  • reviewed 2026-10-11T10:53:15.939Z sha 859d5b7d3cfe23246eb9b7a09d0456b206c4a17b :: needs changes before merge. :: [P2] Reject invalidated reads before clearing Goal recovery | [P2] Complete the test cutover for accepted row semantics
  • reviewed 2026-10-11T12:14:20.687Z sha 2e2b40bbe26124e79c11ca7a04e8cb34a0f273dd :: needs changes before merge. :: [P2] Update archive confirmations when admitting descriptor reads
  • reviewed 2026-10-11T12:40:35.635Z sha 2e2b40bbe26124e79c11ca7a04e8cb34a0f273dd :: needs changes before merge. :: [P2] Update archive confirmations when admitting descriptor reads
  • reviewed 2026-10-11T13:30:22.372Z sha ea9255e :: needs changes before merge. :: [P2] Update archive confirmations when admitting descriptor reads

Reviewed October 11, 2026, 9:57 AM ET / 13:57 UTC (Revision 6).

@steipete

Copy link
Copy Markdown
Contributor Author

Both review findings are addressed in 859d5b7d3cfe23246eb9b7a09d0456b206c4a17b.

  • An unchanged presentation now retains its accepted whole-row sampling timestamp. The direct regression failed with 100 instead of 200 before the fix. The original cached-replay browser test is unchanged in the final diff and now passes both scenarios.
  • Activity re-sorts the merged rows by the timestamps it displays, without restoring field clocks or read-custody machinery. Its direct ordering regression failed before the fix.

The two owner suites pass 24 tests; the original browser regression passes 2/2. Net production reduction is 1,002 lines. The prior failed E2E job was PR-caused, not classified as main-red. The replacement exact-head CI is being watched to completion; cancelled prior jobs are not claimed passing. A single Testbox request is also preparing the selected broad suites.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Oct 11, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Oct 11, 2026
@steipete
steipete force-pushed the deslop/p11-ui-2-20261010 branch from 2e2b40b to ea9255e Compare October 11, 2026 13:10
@steipete

Copy link
Copy Markdown
Contributor Author

The descriptor-only archive finding is fixed in f18e08a. Raw descriptor/history reads now pass through the existing timestamp-checked archive observer before final decoration.

The new capability-level regression first confirms an archive, removes the row from the primary list, then reconciles a newer restored descriptor. It failed with archived: true before the fix and passes afterward. The four focused owner suites pass 73 tests; all seven UI test-type graphs, extension declarations, UI production types and scoped lint pass. Independent corrective review found no actionable P0–P2 findings.

The conflict with main's dashboard partial-row work is also resolved without restoring field receipts. Prior head ea9255e had fully green CI; the new head's CI is being watched separately. No prior-head result is claimed as current-head green.

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@steipete
steipete merged commit 4d80fd9 into main Oct 11, 2026
92 checks passed
@steipete
steipete deleted the deslop/p11-ui-2-20261010 branch October 11, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant