Skip to content

refactor(chat): share safe tool details with native panels - #1830

Closed
bkudiess wants to merge 7 commits into
mainfrom
bkudiess-transcript-and-results-parity
Closed

bkudiess wants to merge 7 commits into
mainfrom
bkudiess-transcript-and-results-parity

Conversation

@bkudiess

@bkudiess bkudiess commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Native conversation panels need shared, safely scoped tool details, and tool captions must remain readable when the containing surface changes theme or output updates.

User Impact

User impact: tool input/output captions now follow the containing native Light/Dark surface and native caption typography instead of becoming white on white or reverting to a larger font during output updates. Inline disclosures and panels reuse the same renderer.

The production root still does not assign the optional tool-details callback, so this PR alone does not open a details panel. The separately owned foundation integration consumes that seam.

This is a draft bounded slice, not full chat parity or merge readiness. Three current-head caption cases passed, with viewed component-only Light/Dark/Light captures. Full host/root rendering, live Gateway, keyboard and screen-reader proof remain unverified.

Known continuity limitation: every history commit, including one after run completion or reconnect, invalidates open details. The consuming host must keep an explicit localized unavailable/reopen state and allow the current tool card to reopen. Web-style open-detail continuity is still missing.

Why This Change Was Made

ToolCallCardRenderer remains the single owner of literal, selectable input/output sections. The host receives only a session/generation/history-qualified identity request, resolves against its current authenticated snapshot on every render, and never receives click-time output, a file path or a transport URL through that request.

Local entry IDs and generated tool-call IDs can be reassigned during history replay. Until producers expose verified ID provenance, the resolver rejects every history-revision change rather than borrowing a same-looking row. Live output and status updates do not advance that revision. Native actions have localized names and grouped ordinals; input/output sections retain stable keys and the existing 240px scroll cap.

Caption colors use an element theme reference. Typography is resolved by WinUI's own style engine on one temporary, unattached TextBlock, then copied into immutable element values and cached per application resource-dictionary identity. The temporary control and colors are not retained. Caption and inherited native font/layout definitions are required before resolution; missing keys/definitions fail explicitly. The rendered caption receives no competing Style or ClearValue calls.

This avoids two confirmed consumed-framework limitations: Reactor preview.12 replaces a separately assigned Style when installing its theme-resource style, and raw native setter values/scalar conversion do not reliably expose FontWeight. No framework fork, dependency upgrade, literal font fallback or parser was added.

Shared prerequisite: this branch includes 1d50df9e, a byte-identical cherry-pick of the separately reviewed test-isolation guard 734aa41a (stable patch ID 600926c8fb94ca8e5762324a00b7062de90b7dfb). It prevents default Tray tests from reading real settings bytes and isolates paths before linked owners initialize. Do not review that prerequisite as a second independent implementation. Rebase or drop it once the guard lands or changes.

The foundation consumer has taken the transcript seam as 97bb3958; its root adapter and authenticated account identity remain separate review/proof gates. This PR does not change the root, composer, Gateway parser or send/approval policies.

Evidence

Current candidate: 315dc70f3b9def13850b9babd2d1ed80cc035586, clean, tested against pinned comparison base 51f18c1222c996fb6fa2eb4d7e8d668492103a0e. Fresh main is 8ca63eb746bfafa8a31c743922b5350b839749f5: this branch is seven ahead and two behind it. No rebase-based validation is implied.

All five build targets passed. Shared: 4,659 passed, 0 failed, 25 ordinary skips. Tray: 4,511 passed, 0 failed, 0 skipped. The Tray run includes the 13 new detail-resolution cases covering current live output/status, history-commit invalidation, session/reset changes, duplicate identity and non-tool rows. Source-shape guards are supplementary, not native execution proof.

Current caption native proof: 3 passed, 0 failed, 0 skipped, executed once on the frozen candidate. The positive case compares font size, weight, family, wrapping/trimming, line layout and color/opacity against an independent native XAML caption, across Light/Dark/Light and real output reconciliation on the same caption instances. Both negative cases assert exact missing-key/definition errors using managed lookups with no global resource mutation.

Three viewed component captures show complete, readable captions and literal output. Their physical bounds are 525x225 for the declared 420x180-DIP test surface. The uniform 1.25 scale is inferred from those bounds; RasterizationScale was not sampled. This is not full-window DPI, pointer or production-root proof.

Historical seam proof at unchanged ancestor 1d50df9e: six native tool-activity cases passed, including actual IInvokeProvider request identity, literal output/no Hyperlink, selection-enabled policy and missing-host/session behavior. Those six were not rerun on the current caption candidate and are not presented as current-head passes.

Safe real-profile metadata manifests were identical before and after each current build/test stage, including native execution. Source manifests record this exact HEAD, zero dirty files and the pinned base. Before and post-run native binary hashes agree, and all verified owned processes exited. No real settings contents were collected.

Independent exact-source and native-evidence reviews cleared the scoped caption claim on the current source. A separate task / rubber-duck implementation-and-proof-plan review covered the original seam. The current evidence review verified all three outcomes, the viewed frames and cleanup records; source review alone is not runtime proof.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • windows-winui-interactive: native action invocation, caption theme/typography, literal/selectable detail presentation, accessibility and the consuming host's current-context/reopen behavior. Three current caption cases and viewed component captures passed; full host proof is not verified / blocked. This is not a completed pool.

Validation

All current validation below applies to 315dc70f on Windows x64 with .NET SDK 10.0.402. The prerequisite restore was originally run when the guard introduced ProfileProbe.

Command Result
dotnet restore .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --disable-parallel --nologo -v minimal Passed after the guard introduced the ProfileProbe project dependency.
.\build.ps1 -NoTrustRepository Passed, all five targets. Includes documentation validation.
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore 4,659 passed, 0 failed, 25 ordinary skips, 4,684 total.
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore 4,511 passed, 0 failed, 0 skipped.
git diff --check Passed; working tree clean.
dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -r win-x64 -p:BuildProjectReferences=false --no-restore --nologo -v minimal Passed after the current-head full build; 0 errors/warnings.
dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -r win-x64 --no-build --no-restore --filter FullyQualifiedName~ReactorToolActivityProofTests.DetailCaptions_ --blame-hang-timeout 300s --blame-hang-dump-type none 3 passed, 0 failed, 0 skipped. Same-source negative controls remain retained; no automatic retry. Source clean; before/post-run binary hashes match.

The actual test invocations also wrote TRX files into unique author-local session artifact directories. Those private paths are not public proof links.

Every child inherited process-local isolation and worker controls:

$env:OPENCLAW_REPO_ROOT = (Get-Location).Path
$env:OPENCLAW_TRAY_DATA_DIR = Join-Path $proofRoot 'data'
$env:OPENCLAW_TRAY_APPDATA_DIR = Join-Path $proofRoot 'roaming'
$env:OPENCLAW_TRAY_LOCALAPPDATA_DIR = Join-Path $proofRoot 'local'
$env:OPENCLAW_TRAY_LOCAL_DATA_DIR = Join-Path $proofRoot 'legacy-local'
$env:DOTNET_GENERATE_ASPNET_CERTIFICATE = 'false'
$env:MSBUILDDISABLENODEREUSE = '1'
$env:DOTNET_CLI_USE_MSBUILD_SERVER = '0'
$env:UseSharedCompilation = 'false'
$env:BuildInParallel = 'false'

$proofRoot was a fresh absolute session artifact directory, not a real user profile. No shared build-server shutdown, app registration or unowned-process termination occurred.

For the native testhost only, APPDATA, LOCALAPPDATA, TEMP, TMP and DOTNET_CLI_HOME were also redirected to unique task directories. The real-profile audit retained the original actual profile roots before those overrides. No global input or desktop capture occurred.

Proof-environment caveat: during the 2026-10-22 14:03 UTC caption run on 315dc70f, retained SDK logs report a non-elevated initiating CLI process and ExtractManifestAsync invoking Windows Installer ACTION=ADMIN, with TARGETDIR under this run's task-owned temp directory and the advertising-manifest destination under its isolated CLI home. The verbose MSI log records status 0 for Microsoft.NET.Workloads.10.0.400 (x64) version 86.72.61617 and includes the text "Windows Installer installed the product." This establishes Installer activity, not an independent product-registration audit.

No bounded MsiInstaller event-log records or before/after product/registry baselines were collected for this run. The earlier event-entry and no-package-registration statements were reviewer verdicts, not retained audit evidence, and are withdrawn. Product registration and wider Installer cache/event-log effects remain unverified; matching profile metadata, source/binary hashes and owned-process exit do not prove whole-machine immutability.

Historical failures remain recorded: three earlier real-profile metadata audit intervals failed, and one later full-build invocation failed in a GitVersion subprocess. Their causes remain unattributed. The current isolated serial passes do not erase those attempts or prove a single cause was fixed.

Earlier caption attempts also failed native validation: native font-size assertions exposed overwritten styles; raw setter access failed on FontWeight; a scalar-conversion attempt failed and revealed ambient framework resource fallback in the missing-key fixture. These failures drove the native-style-engine and managed-lookup corrections. None was converted into a pass or hidden by changing the XAML oracle.

The process observer rejected a pre-existing git fsmonitor process discovered through a reused parent PID. It was not stopped or claimed task-owned. Current ownership enrollment requires the recorded parent creation-time identity and a child start no earlier than that parent, in addition to the in-process testhost receipt.

Hosted CI for this updated head must complete independently of local proof. The previous 1d50df9e run failed in fixture readiness and the revocation E2E inactivity watchdog; those failures remain recorded, were not repaired in this slice and were not rerun by dispatch. No all-green or merge-ready CI claim is made.

Real Behavior Proof

  • Environment tested: Windows x64, isolated process profiles and serialized, non-reused build workers. An allocated component testhost created its fixture window and moved it off-screen using the existing fixture. Own-surface RenderTargetBitmap captures were enabled; no Companion app, Gateway, OS input or whole-desktop capture was used.
  • PR head or commit tested: 315dc70f3b9def13850b9babd2d1ed80cc035586.
  • Exact steps or command run: the full build, Shared/Tray commands and exact three-case caption filter above, with real reconciliation, strict native XAML comparisons and before/after source/binary/profile checks.
  • Evidence after fix: all 4,511 Tray cases and all three current native caption cases passed. Test DLL SHA256 0D27A6D91F40B33B47FB2233CF9A2B3051E5D058C99593E7C273D8A32D391876; native TRX SHA256 62E4553DCD5A6D8361871759A9BACEAF6AE64C781905F2583E6C6FB9E74BD2F0. Three viewed captures show Light/Dark/Light captions matching the reference and updated literal output.
  • Observed result: native caption font/color/layout and negative resource contracts passed. In-process receipt recorded PID 60608, start 2026-10-22T14:03:22.2549810Z, HWND 14419118, actual executable/command and all four isolated roots. The host and all six creation-time-verified observed processes exited; source, binaries and real-profile metadata remained unchanged. The queue slot was released. No full production-root render, pointer hit-test, selected text range or Gateway-mediated tool result is claimed.
  • Screenshot or artifact links verified? (Yes/No/N/A) N/A. No screenshot or public runtime artifact is attached.
  • Not verified or blocked: actual foundation root/account binding and aggregate root tests; run-end unavailable/reopen rendering; live Gateway/tool streams or media; full-root pixels/DPI, pointer hit-testing, keyboard traversal, selection continuity, Narrator/real UIA, text scaling, Windows High Contrast or reduced motion. Caption label changes and in-place edits to typography resources are not covered. Static tool-card background/border brush lookup remains out of scope, so complete card theme parity is not claimed. The component run was executed once, not repeated for flakiness. Links and initial-scroll producer work are separately owned; neither is silently included here.

Security Impact

  • New permissions or capabilities? (Yes/No) No.
  • Secrets or tokens handling changed? (Yes/No) No product secret handling changes.
  • New or changed network calls? (Yes/No) No.
  • Command or tool execution surface changed? (Yes/No) No, presentation only.
  • Data access scope changed? (Yes/No) No product data access expansion. The shared test prerequisite redirects profile paths and removes real-settings-content reads.
  • If any answer is Yes, explain the risk and mitigation: N/A. Identity-only requests and same-revision resolution fail closed; output is literal and never navigates or executes. The consuming root must independently validate authenticated Gateway/client/account/epoch context.

Compatibility and Migration

  • Backward compatible? (Yes/No) Yes. The appended callback/history fields are optional; hosts without the callback keep their existing behavior.
  • Config or environment changes? (Yes/No) No end-user configuration change. Validation uses process-local isolation/worker environment variables only.
  • Migration needed? (Yes/No) No.
  • If yes, list the exact upgrade steps: N/A.

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

bkudiess and others added 2 commits October 22, 2026 01:17
Share literal selectable detail rendering and identity-only requests with the native host. Resolve current entries only within the same session, reset generation and history revision. History replay invalidates details until typed Gateway tool-call provenance is available.

Source reviewed, not full parity or behavior-proven. Focused pure tests: 85 passed. Native project compilation passed. ReactorToolActivityProofTests not executed (profile-metadata isolation interval). Full mandatory closeout and visible/Gateway proof remain outstanding; shared root integration is owned by the panel foundation branch.

Co-authored-by: Copilot App <[email protected]>
Guard default tray test processes before linked owners cache paths, preserve safe explicit roots and reject real profiles. Add a discovery-free subprocess regression and stop reading real settings contents in the settings isolation test.

Co-authored-by: Copilot App <[email protected]>
(cherry picked from commit 734aa41)
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🦞👀
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.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR shares literal tool-detail rendering with optional native panels and adds scoped identity resolution plus test-profile isolation.

Example: A panel requests powershell call call-a in session-a at history revision 7.

  • Before: Only inline tool details have an existing rendering path.
  • After: An optional host can reuse that renderer, resolve current output, and reject the request after history advances to revision 8; production keeps inline details because its callback remains unset.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The source change is focused and preserves existing behavior, but automated contracts do not establish native runtime readiness.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Future native conversation panels need inspectable tool details without duplicating transcript rendering or retaining stale conversation content.
Reason: The maintainer-authored direction authorizes this bounded foundation slice, which reuses the existing renderer and preserves current inline behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored draft adds a distinct tool-detail seam, and source review found no definite introduced defect.

Priority: P3
Reviewed head: 1d50df9ef61cd25a72cbd39485c6e68977469b59

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Current-head native action invocation, selectable shared details, and stale-request unavailable/reopen behavior remain unexecuted; no before/after regression run is supplied for the new seam.
Agent review details

How this fits together

Gateway-derived conversation snapshots enter ReactorChatTimeline; ToolCallCardRenderer renders tool activity, while the optional host receives identity-only requests and resolves them against current conversation state.

flowchart TD
  A[Conversation snapshot] --> B[Reactor timeline]
  B --> C[Tool card renderer]
  C --> D[Inline literal details]
  C --> E[Optional identity request]
  E --> F[Current snapshot resolver]
  F --> G[Shared panel details]
Loading

Technical review

Best possible solution:

Keep one literal detail renderer and resolve identity-only panel requests against the host's current authenticated snapshot.

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

This is a preparatory refactor rather than a reported production failure; source confirms that the new optional callback is not assigned by the production root.

Is this the best way to solve the issue?

The approach fits the existing owners: it extracts shared detail sections within ToolCallCardRenderer and adds a small resolver to ChatToolActivityPresentation without duplicating transcript rendering.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 51f18c1222c9.

Provenance checked

  • Inline tool-detail rendering and activity grouping keeps the original intent (aac07ab: Compact tool activity retained inspectable, selectable, bounded input and output details.)
  • Reactor timeline presentation ownership keeps the original intent (d3ed6c7: Retire the unused FunctionalUI chat surface and retain Reactor-neutral presentation inputs with one production rendering owner.)
  • History revision propagation keeps the original intent (5164faa: Modernize native chat through focused presentation owners while preserving controller, snapshot, and Gateway ownership.)
  • Settings isolation verification changes intended behavior with a stated reason (581f78d: Protect real settings while verifying isolated settings writes; the shared prerequisite deliberately replaces real-content reads with metadata checks and retains exact assertions on synthetic saved settings.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Caleb Eden: Raw commit aac07ab adds src/OpenClaw.Tray.WinUI/Chat/ToolCallCardRenderer.cs:20 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: aac07abb1fbd; files: src/OpenClaw.Tray.WinUI/Chat/ToolCallCardRenderer.cs)

Labels

Label changes:

  • add P3: This is a preparatory presentation refactor with no standalone production-visible change or established urgent regression.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a preparatory presentation refactor with no standalone production-visible change or established urgent regression.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Supply current-head native evidence for the changed action, shared detail rendering, and stale-request rejection.

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 execution lanes are retired.

Reviewed October 22, 2026, 5:24 AM ET / 09:24 UTC.

bkudiess and others added 3 commits October 22, 2026 04:08
Use the native caption style and element-scoped secondary text theme reference for shared inline and panel detail captions instead of an application-default static brush. Preserve caption instances across local theme changes and verify the independent native reference, typography and literal body foreground.

Local adoption checkpoint only. Native project and final regression source compile passed; the non-vacuous baseline property case is compiled, not run. Consumer pixels show the pre-fix white-on-light caption. Fresh mandatory suites and integrated Light/Dark rendering proof remain outstanding. Card background/border static brushes and actual OS High Contrast are not claimed fixed.

Co-authored-by: Copilot App <[email protected]>
Clear Reactor local font size and weight values after applying the native caption style. Extend the independent native-theme regression to reconcile changing output on the same caption controls before each theme transition; keep the expected native 12-point font and weight.

Local adoption checkpoint. Integrated prior-revision run at 3ea36be reproduced expected 12 versus actual 14 while color checks passed. Serial native graph rebuild and regression compilation pass; current-head mandatory suites and the allocated foundation native batch remain outstanding. No standalone native window or publication authorized by this checkpoint.

Co-authored-by: Copilot App <[email protected]>
Use the verified native CaptionTextBlockFontSize resource and the most-derived CaptionTextBlockStyle setters, including inherited text layout, as explicit element properties. Do not assign a separate caption Style or clear font properties: preview.12 theme bindings install their own generated Style without BasedOn.

Preserve the independent native XAML font, color and reconciliation regression and extend it to inherited text properties and derived-weight precedence. Actual prior-revision native run afd6a3c reproduced expected12 versus actual14. Local native compilation passes; current-head mandatory suites and allocated integrated native proof are still outstanding. No push or draft evidence update yet.

Co-authored-by: Copilot App <[email protected]>
bkudiess and others added 2 commits October 22, 2026 06:18
Resolve raw native style setters through XamlBindingHelper.ConvertValue, using the Windows.UI.Text.FontWeight type required by Reactor. Cache only theme-independent typography per application resource dictionary identity and invalidate on dictionary replacement; keep colors on live element theme references.

Keep the same independent native XAML/reconciliation oracle, add explicit missing-key and missing-definition checks without mutating application resources, and exercise those negatives before the positive mount. Record the native test window in process before rendering so fast failures retain exact ownership. Actual1681 one-case red is preserved; current native compilation passes. Local adoption checkpoint only, mandatory current-head suites and a new allocated native green run remain required before publication.

Co-authored-by: Copilot App <[email protected]>
Replace unsupported raw setter casts and scalar conversion with one unattached TextBlock styled by WinUI. Read its effective typography into the existing resource-identity cache; never retain or parent the probe and never assign Style or ClearValue to rendered captions. Colors stay on element theme references.

Require only the seven setters explicitly defined by consumed WinUI2.3.9 generic.xaml: Base11106-11113 family,size,weight,trimming,wrapping,line stacking,line bounds; Caption11136-11139 overrides size and weight. Read values through native typed getters. The lookup seam uses managed dictionaries for genuinely missing negative keys, with no ambient fallback or App mutation. Native failures now log the complete exception-chain HRESULTs before rethrowing; the independent native XAML oracle is not weakened.

Local checkpoint only. Prior2a5 native3-case run is retained red1pass2fail; current native compile passed. Exact current-head mandatory suites and a new allocated native green run remain required before publication.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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