Skip to content

fix: ground session companion context before answering - #122329

Merged
shakkernerd merged 8 commits into
mainfrom
fix/session-companion-grounding
Aug 11, 2026
Merged

shakkernerd merged 8 commits into
mainfrom
fix/session-companion-grounding

Conversation

@shakkernerd

Copy link
Copy Markdown
Contributor

Fixes #120746

What Problem This Solves

The Control UI session companion could start its first answer without authoritative context from the selected session. It could then present an internal context envelope as a successful answer even though the visible session already contained the requested information.

Why This Change Was Made

The Gateway now prepares one bounded, fail-closed snapshot from the selected session’s canonical reset/compaction window before the companion model runs. Private transcript and observer material is escaped reference history rather than system policy or operator dialogue. Missing, unreadable, replaced, cancelled, rate-limited, and model-unavailable states remain distinct.

The Control UI shows Reading and Answering phases, preserves failed questions, offers Retry only for retryable outcomes, and reconciles a response through the current Gateway connection before treating a stale browser settlement as failed.

User Impact

The first companion answer is grounded in the selected session or ends in a truthful visible error. Users no longer receive private transport data as an answer, and reconnects cannot create a false history error or encourage a duplicate question after the Gateway already committed the response.

Verification

  • Covered populated, genuinely empty, missing, temporarily unreadable, oversized, reset, compaction, replaced-session, cancellation, provider-failure, and stale-browser outcomes.
  • Covered capable accepted-to-final/error request correlation and legacy final-only compatibility.
  • Verified hard message, selected-byte, raw-byte, scan, exchange-count, and exchange-byte bounds, including a 100k-message retained-prefix case.
  • Verified desktop and materially narrow Control UI layouts with a real provider-backed companion answer.
  • Plugin SDK contracts, typechecks, dead-code checks, full lint, the production Control UI build, and UI performance budgets pass.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@shakkernerd shakkernerd self-assigned this Aug 11, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL labels Aug 11, 2026
@shakkernerd
shakkernerd force-pushed the fix/session-companion-grounding branch from 8f7e3c2 to 7137446 Compare August 11, 2026 22:56
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 11, 2026
@shakkernerd
shakkernerd force-pushed the fix/session-companion-grounding branch from 010f698 to 9c9ab58 Compare August 11, 2026 23:18
@shakkernerd
shakkernerd merged commit 9c9ab58 into main Aug 11, 2026
29 checks passed
@shakkernerd
shakkernerd deleted the fix/session-companion-grounding branch August 11, 2026 23:18
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: the Control UI session companion now grounds its first answer in bounded selected-session context and keeps private transport data out of user-visible replies.

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 size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Session companion can expose its internal context envelope

1 participant