Skip to content

fix: simplify and harden session companion grounding - #122380

Merged
shakkernerd merged 3 commits into
mainfrom
fix/session-companion-snapshot
Aug 12, 2026
Merged

shakkernerd merged 3 commits into
mainfrom
fix/session-companion-snapshot

Conversation

@shakkernerd

Copy link
Copy Markdown
Contributor

Summary

  • restore canonical reset-only transcript visibility and remove companion-only progress/reconciliation machinery
  • fail closed on malformed reset state and fence multi-page context to one authoritative transcript snapshot
  • cancel disconnected asks before commit and keep repeated-question hydration identity-safe

Verification

  • focused Blacksmith Testbox gateway/runtime and Control UI tests
  • core, test, and UI typechecks; targeted and full lint/guard evidence
  • Plugin SDK API baseline checks, production build, UI performance budgets, and docs checks
  • clean autoreview and fresh independent Workloop review

Corrective follow-up to #122329.

@shakkernerd
shakkernerd requested a review from a team as a code owner August 12, 2026 02:15
@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Aug 12, 2026
@shakkernerd shakkernerd self-assigned this Aug 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 10:20 PM ET / August 12, 2026, 02:20 UTC.

ClawSweeper review

What this changes

This PR simplifies the Control UI session companion by using reset-visible transcript context, removing progress/reconciliation handling, and aborting a companion ask when its requester disconnects.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer review. The PR is a focused corrective follow-up to main-only companion grounding work, but exact PR-head blobs could not be read from this partial checkout because the required promisor fetch fails DNS; no concrete patch defect was confirmed.

Priority: P2
Reviewed head: 392a178175266e81f94edf8c6c92ea6dffe17e7e
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The proposed simplification is supported by current-main owner-boundary evidence, but incomplete access to the exact PR tree prevents a stronger patch-quality rating.
Proof confidence 🌊 off-meta tidepool Not applicable: The PR author is a repository member, so the external-contributor real-behavior-proof gate does not apply; the PR body nevertheless reports focused runtime and Control UI validation.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The PR author is a repository member, so the external-contributor real-behavior-proof gate does not apply; the PR body nevertheless reports focused runtime and Control UI validation.
Evidence reviewed 5 items Current owner boundary: Current main routes companion asks through the Gateway handler into the companion service, where context is prepared before the model run and answers are committed only after identity checks.
Cancellation path: Current request dispatch already carries an optional in-process AbortSignal to registered handlers; the supplied PR patch extends its existing CLI disconnect behavior to companion asks.
Prior grounding provenance: The preceding grounding refactor is present on current main as commit 9c9ab58, dated 2026-08-12T01:17:18+02:00; local history also shows the subsequent fail-closed companion-context work.
Findings None None.
Security None None.

How this fits together

The Control UI sends a session-companion question over the Gateway, which reads bounded selected-session transcript context and invokes a read-only utility-model run. The answer or typed error returns to the Control UI session rail without entering main chat history.

flowchart LR
  A[Control UI session rail] --> B[Gateway companion request]
  B --> C[Transcript snapshot reader]
  C --> D[Bounded visible context]
  D --> E[Read-only companion run]
  E --> F[Gateway response]
  F --> G[Session rail answer or error]
Loading

Decision needed

Question Recommendation
Should this maintainer-owned corrective refactor proceed after an exact-head transcript-context review and green required CI, given that this reviewer could not read its complete PR tree? Complete exact-head review: Restore access to the PR blobs, verify the context-page failure semantics and required CI, then decide on the current refactor.

Why: The protected maintainer label and unavailable exact-head blobs prevent an automated merge-ready conclusion; the remaining choice is whether maintainers accept the reviewed direction once that evidence is restored.

Before merge

  • Resolve merge risk (P1) - Exact-head source inspection is incomplete because the partial checkout cannot fetch PR blobs; before merge, review the context paging path against the existing fail-closed oversized-transcript contract and wait for exact-head CI.
  • Complete next step (P2) - A protected maintainer PR needs exact-head source review and normal maintainer approval; no narrow automated repair is established.
Agent review details

Security

None.

PR surface

Source -354, Tests -98, Docs 0, Generated 0. Total -452 across 43 files.

View PR surface stats
Area Files Added Removed Net
Source 15 283 637 -354
Tests 7 303 401 -98
Docs 3 8 8 0
Config 0 0 0 0
Generated 18 18 18 0
Other 0 0 0 0
Total 43 612 1064 -452

Review metrics

Metric Value Why it matters
Production versus test LOC production +283/-636; tests +303/-401; docs/generated +26/-27 The net production reduction is consistent with removing companion-only machinery, while the changed test surface is substantial enough to require exact-head verification.

Stored data model

Persistent data-model change detected: serialized state: src/config/sessions/session-accessor.sqlite-active-events.test.ts, serialized state: src/config/sessions/session-accessor.sqlite-active-events.ts, serialized state: src/config/sessions/session-accessor.sqlite-reset-window.ts, serialized state: src/gateway/session-companion-ask.ts, serialized state: src/gateway/session-companion-context.test.ts, serialized state: src/gateway/session-companion-context.ts, and 15 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Review the exact PR head once its blobs are available, confirm that reset-visible context retains the existing fail-closed behavior for malformed or oversized transcript state, then merge only after the required checks complete.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Review the exact PR head once its blobs are available, confirm that reset-visible context retains the existing fail-closed behavior for malformed or oversized transcript state, then merge only after the required checks complete.

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

No high-confidence runtime reproduction was established here: current main and the supplied patch make the lifecycle path understandable, but complete PR-head source and executable validation were unavailable in this checkout.

Is this the best way to solve the issue?

Unclear: consolidating companion behavior onto the canonical visible-transcript reader and disconnect cancellation is directionally sound, but the exact page-accumulation implementation could not be inspected against the existing fail-closed oversized-context behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7630d060f850.

Labels

Label changes:

  • add P2: This is a focused corrective change to Control UI session context and Gateway request lifecycle, with no demonstrated released-user outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR author is a repository member, so the external-contributor real-behavior-proof gate does not apply; the PR body nevertheless reports focused runtime and Control UI validation.

Label justifications:

  • P2: This is a focused corrective change to Control UI session context and Gateway request lifecycle, with no demonstrated released-user outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR author is a repository member, so the external-contributor real-behavior-proof gate does not apply; the PR body nevertheless reports focused runtime and Control UI validation.

Evidence

What I checked:

  • Current owner boundary: Current main routes companion asks through the Gateway handler into the companion service, where context is prepared before the model run and answers are committed only after identity checks. (src/gateway/session-companion-ask.ts:535, 7630d060f850)
  • Cancellation path: Current request dispatch already carries an optional in-process AbortSignal to registered handlers; the supplied PR patch extends its existing CLI disconnect behavior to companion asks. (src/gateway/server-methods.ts:559, 7630d060f850)
  • Prior grounding provenance: The preceding grounding refactor is present on current main as commit 9c9ab58, dated 2026-08-12T01:17:18+02:00; local history also shows the subsequent fail-closed companion-context work. (src/gateway/session-companion-context.ts:127, 9c9ab5836d11)
  • Release provenance: The preceding grounding commit is not an ancestor of v2026.7.1-2, so this PR corrects behavior that is currently main-only rather than a demonstrated released regression. (9c9ab5836d11)
  • Inspection limitation: The PR commit object is locally known, but its required tree blobs are promisor-missing; git show/diff attempted a GitHub fetch that failed because github.com DNS was unavailable. The supplied patch excerpts and current main were reviewed, but not the complete exact-head files. (392a17817526)

Likely related people:

  • shakkernerd: Current-main history attributes the companion context, reset-boundary, and fail-closed work, as well as the preceding merged grounding refactor, to this contributor. (role: recent area contributor; confidence: high; commits: 281fe1e5029e, 72528033b2ff, 8dc50164605e; files: src/gateway/session-companion-context.ts, src/gateway/session-companion-ask.ts, src/config/sessions/session-accessor.sqlite-reset-window.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore exact-head source access and inspect the transcript paging path before relying on the reported validation.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@shakkernerd
shakkernerd force-pushed the fix/session-companion-snapshot branch from 392a178 to 8efbefe Compare August 12, 2026 02:27
@shakkernerd
shakkernerd merged commit 8efbefe into main Aug 12, 2026
29 checks passed
@shakkernerd
shakkernerd deleted the fix/session-companion-snapshot branch August 12, 2026 02:27
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: Session companion grounding now uses one bounded authoritative transcript snapshot with fail-closed reset handling and identity-safe reconnect recovery.

With thanks to @shakkernerd.

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 docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR 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