Skip to content

feat(sessions): consume flattened gateway classification - #1069

Merged
bkudiess merged 4 commits into
mainfrom
feat/flatten-session-classification
Aug 5, 2026
Merged

bkudiess merged 4 commits into
mainfrom
feat/flatten-session-classification

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Jul 30, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Windows session presentation depended on a draft nested Gateway object. That duplicated title policy in the Gateway and prevented Windows from consuming the canonical session facts now exposed by the Gateway protocol.

Why This Change Was Made

The Windows client now consumes the flattened classification, agentId, accountId, peerKind, isMain, and isBackground fields directly. Windows retains ownership of localized titles and presentation, including direct-peer display-name suppression.

User Impact

With an updated Gateway, Windows categorizes and filters sessions using canonical, non-sensitive facts while preserving its own display and localization policy. Gateways without the flattened fields continue through the existing bounded key fallback.

Evidence

  • Companion protocol PR: feat: expose session classification facts openclaw#106832.
  • Final head 9374c838b66699b681d8a531843d2059955fd0cb passed the Windows build and both native test projects.
  • GitHub CI passed, including Windows x64/ARM64 builds and all three Windows E2E shards.
  • Focused coverage includes flat session facts, sparse updates, direct-peer privacy, title formatting, tray filtering, and chat projection.

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

Validation

Final head 9374c838:

  • ./build.ps1: passed, 0 warnings, 0 errors.
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 3,382 passed, 32 skipped, 0 failed.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 2,022 passed, 0 skipped, 0 failed.
  • Synthetic merge onto main (d2de6150): build passed; Shared 3,382 passed and 32 skipped; Tray 2,053 passed.
  • Resolve_DoesNotUseRawKeyEchoAsDisplayName verifies that agent:main:dashboard:new resolves to New session with generated-title provenance.

Real Behavior Proof

  • Environment tested: Windows 11 ARM64 Parallels app snapshot.
  • PR head or commit tested: 9374c838b66699b681d8a531843d2059955fd0cb.
  • Exact command: OPENCLAW_REPO=/Users/dallin/dev/worktrees/openclaw/session-ux ./scripts/parallels-windows-vm.sh run-tests --ref feat/flatten-session-classification.
  • Evidence after fix: the parser reads the six flattened fields; direct-peer display names are never selected as a title when peerKind is direct; absent flat fields retain the bounded legacy-key fallback.
  • Observed result: the complete build and both required test projects passed.
  • Screenshot or artifact links verified? N/A — no visual-layout change.
  • Not verified or blocked: no live Gateway was configured in the restored app snapshot; the protocol-to-Windows path is covered by parser, resolver, and native suites.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? No
  • Data access scope changed? No

Compatibility and Migration

  • Backward compatible? Yes
  • Config or environment changes? No
  • Migration needed? No

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.

@clawsweeper clawsweeper Bot added 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. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed August 5, 2026, 6:57 PM ET / 22:57 UTC.

ClawSweeper review

What this changes

This PR replaces Windows consumption of Gateway's nested session-presentation object with flattened session classification and identity facts, then resolves titles and visibility locally.

Merge readiness

⛔ Blocked by patch quality or review findings - 7 items remain

Keep open. The prior P1 remains unfixed at the current head: the flat-only parser drops valid legacy nested session facts, breaking rolling-upgrade classification and potentially direct-peer display-name suppression.

Priority: P1
Reviewed head: 9374c838b66699b681d8a531843d2059955fd0cb

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 5 items Current-main compatibility contract: Current main still parses a valid nested presentation object and requires its title, family, isMain, and isBackground facts before using it for session display and filtering.
Current-head regression: The PR head reads only flattened fields in this changed parser region and removes the nested presentation parse, so nested-only rows lose their classification, peer, account, background, and main-session facts.
Prior finding remains at this head: The gateway-client parser is unchanged between the previously reviewed head and the current head; the newest commit only adjusts raw-key display-name handling, not legacy fact ingestion.
Findings 1 actionable finding [P1] Restore the nested presentation fallback
Security Needs attention Legacy direct-peer classification is discarded: The changed parser ignores the only peer-kind and classification facts supplied by current nested-only payloads. If such a row has an opaque key, the resolver can treat it as non-direct and surface its legacy display name.

How this fits together

Gateway session rows enter the Windows gateway client, which stores session facts for the local display resolver. The resolver supplies localized titles, background filtering, and session metadata to tray and chat surfaces.

flowchart LR
  A[Gateway session rows] --> B[Windows session parser]
  B --> C{Flat facts available}
  C -->|yes| D[Local display resolver]
  C -->|no| E[Legacy session facts]
  E --> D
  D --> F[Tray session list]
  D --> G[Chat thread list]
Loading

Before merge

  • Restore the nested presentation fallback (P1) - The branch deletes the only parser for current-main presentation rows. A nested-only or rolling-upgrade row now falls back to key parsing, losing main, classification, background, agent, account, and peer facts; an opaque direct key can consequently select DisplayName because it is no longer known to be direct. Fill missing flat fields from a valid nested object while keeping flat values authoritative, and add nested-only plus mixed-input regressions.
  • Resolve security concern: Legacy direct-peer classification is discarded - The changed parser ignores the only peer-kind and classification facts supplied by current nested-only payloads. If such a row has an opaque key, the resolver can treat it as non-direct and surface its legacy display name.
  • Resolve merge risk (P1) - Older or rolling-upgrade Gateways that send only nested presentation facts lose main-session, classification, account, peer-kind, and background information.
  • Resolve merge risk (P1) - For an opaque legacy direct-message key, losing nested direct classification can make the local resolver select the legacy display name, defeating the intended privacy suppression.
  • Complete next step (P2) - The remaining P1 is a narrow, mechanically repairable parser compatibility gap; current-head runtime proof still needs to be supplied before merge.
  • Improve patch quality - Resolve the security review concern or explain why the changed path is safe.
  • Improve patch quality - Address the highest-priority review finding and re-run the changed-surface validation.

Findings

  • [P1] Restore the nested presentation fallback — src/OpenClaw.Shared/OpenClawGatewayClient.cs:3839-3845
  • [high] Legacy direct-peer classification is discarded — src/OpenClaw.Shared/OpenClawGatewayClient.cs:3839
Agent review details

Security

Needs attention: Removing legacy presentation parsing can bypass direct-peer display-name suppression for nested-only Gateway rows.

Review metrics

Metric Value Why it matters
Compatibility refactor size 17 files affected; production +277/-403, tests +119/-358 The broad removal of a session transport contract makes mixed-version regression coverage especially important.

Merge-risk options

Maintainer options:

  1. Restore legacy fact fallback (recommended)
    Parse valid nested presentation facts only when their flattened equivalents are absent, add nested-only and mixed-version coverage, and collect current-head Gateway proof before merge.
  2. Require flat-only Gateways
    Intentionally accept that older and rolling-upgrade Gateway deployments can lose session classification and direct-peer protection, contrary to the PR's backward-compatibility claim.

Technical review

Best possible solution:

Keep flattened facts authoritative, but translate valid legacy nested facts into missing flat fields without restoring Gateway-owned title rendering, then prove nested-only and mixed-version rows through the Windows Gateway path.

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

Yes, from source. A nested-only Gateway row with an opaque direct-session key follows the removed parser path and can be covered by a focused gateway-client plus resolver regression test; no write-capable runtime execution was performed in this review.

Is this the best way to solve the issue?

No. Removing the legacy contract before flattened facts are guaranteed loses established session behavior; a flat-first compatibility translation is the narrower maintainable path.

Full review comments:

  • [P1] Restore the nested presentation fallback — src/OpenClaw.Shared/OpenClawGatewayClient.cs:3839-3845
    The branch deletes the only parser for current-main presentation rows. A nested-only or rolling-upgrade row now falls back to key parsing, losing main, classification, background, agent, account, and peer facts; an opaque direct key can consequently select DisplayName because it is no longer known to be direct. Fill missing flat fields from a valid nested object while keeping flat values authoritative, and add nested-only plus mixed-input regressions.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: A current Gateway-to-Windows session workflow can misclassify or expose direct-session display data during a normal rolling upgrade.
  • merge-risk: 🚨 compatibility: The patch removes support for the nested session contract that current main still consumes.
  • merge-risk: 🚨 security-boundary: Legacy direct-peer classification can be lost before the resolver applies its display-name suppression.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

Security concerns:

  • [high] Legacy direct-peer classification is discarded — src/OpenClaw.Shared/OpenClawGatewayClient.cs:3839
    The changed parser ignores the only peer-kind and classification facts supplied by current nested-only payloads. If such a row has an opaque key, the resolver can treat it as non-direct and surface its legacy display name.
    Confidence: 0.94

Acceptance criteria:

  • [P1] ./build.ps1.
  • [P1] dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore.
  • [P1] dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore.
  • [P1] Run a current-head isolated Windows tray session against nested-only and flattened Gateway payloads, preserving a redacted runtime transcript or diagnostics artifact.

What I checked:

Likely related people:

  • RomneyDa: Current-main history attributes the readable Windows session-name feature to this contributor, and the PR changes its parser and resolver boundary. (role: introduced readable session behavior; confidence: high; commits: 959b3527ac7b, 9b7dbd8dcd02; files: src/OpenClaw.Shared/Sessions/SessionPresentationResolver.cs, src/OpenClaw.Shared/OpenClawGatewayClient.cs)
  • bkudiess: This contributor authored the current-head safety correction and has recent current-main gateway-client work, making them a useful reviewer for the compatibility repair. (role: recent gateway client contributor; confidence: medium; commits: b46e91e21b45, 9374c838b666; files: src/OpenClaw.Shared/OpenClawGatewayClient.cs, src/OpenClaw.Shared/Sessions/SessionDisplayResolver.cs)

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.

History

Review history (25 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-02T10:57:19.670Z sha 9e2b337 :: needs changes before merge. :: [P1] Restore the nested presentation fallback
  • reviewed 2026-08-02T13:17:19.648Z sha 9e2b337 :: needs changes before merge. :: [P1] Retain the nested presentation fallback
  • reviewed 2026-08-02T14:31:18.945Z sha 9e2b337 :: needs changes before merge. :: [P1] Restore the nested presentation fallback
  • reviewed 2026-08-02T16:41:31.174Z sha 9e2b337 :: found issues before merge. :: [P1] Restore the nested presentation fallback
  • reviewed 2026-08-02T17:58:15.299Z sha 9e2b337 :: found issues before merge. :: [P1] Retain the nested presentation fallback
  • reviewed 2026-08-02T21:29:28.869Z sha 9e2b337 :: needs changes before merge. :: [P1] Retain nested presentation facts as a fallback
  • reviewed 2026-08-02T23:04:10.959Z sha 9e2b337 :: needs changes before merge. :: [P1] Retain nested presentation facts as a fallback
  • reviewed 2026-08-03T08:00:04.523Z sha 9e2b337 :: needs changes before merge. :: [P1] Retain nested presentation facts as a fallback

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed P2 Normal priority bug or improvement with limited blast radius. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 30, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Aug 2, 2026
@bkudiess

bkudiess commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Maintainer resolution of the remaining ClawSweeper finding: rejected as not applicable to a shipped or current upstream Gateway contract.

  • openclaw/openclaw current main has never emitted nested presentation session rows.
  • The nested shape existed only in intermediate commits of still-open companion PR feat: expose session classification facts openclaw#106832; that PR's final head uses the flattened fields consumed here.
  • Windows commit 959b3527 consumed the draft nested shape, but no release tag contains that commit; latest release v0.6.12 predates it.
  • Released and current upstream Gateways without flattened fields continue through the bounded key fallback, which remains covered.
  • Current head 9374c838 and its synthetic merge onto main pass required local validation, and all GitHub CI checks are green, including all three E2E shards.

Restoring the nested DTO would preserve an unshipped draft contract and reintroduce Gateway-owned presentation data that this coordinated protocol change intentionally removed.

@bkudiess
bkudiess merged commit 2341450 into main Aug 5, 2026
24 checks passed
@bkudiess
bkudiess deleted the feat/flatten-session-classification branch August 5, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants