Skip to content

refactor: remove channel docking and manual session focus - #133153

Merged
steipete merged 6 commits into
mainfrom
codex/remove-docking-and-focus
Aug 30, 2026
Merged

steipete merged 6 commits into
mainfrom
codex/remove-docking-and-focus

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Removes channel docking (/dock-* and /dock_*) and manual conversation attachment (/focus) from chat commands. These controls could redirect a session's saved reply route or attach an existing session to another conversation, adding an overlapping routing workflow that the maintainer explicitly requested retiring immediately, without aliases.

Related: #127600 (the removed focus resolver discarded the authoritative session owner).

Why This Change Was Made

Deletes the docking and focus handlers, arbitrary session-target resolver, generated docking command/category plumbing, obsolete tests, and dead dispatch wrappers. The follow-up architecture review also collapses the built-in command builder into one factory, declares aliases beside their commands, removes a redundant native-command registry cache, and removes obsolete ACP command-list indirection.

Conversation resolution now returns its canonical fields directly. The unused source/placement hints, wrapper module, and duplicate plugin-registry scan are gone; real callers use the canonical loaded-plugin lookup. Session lifecycle updates consume the flat callback result their channel contracts already return instead of converting an impossible alternate record shape.

Consolidates the remaining non-destructive detach operation into /session unbind, beside /session idle and /session max-age, and removes /unfocus. It preserves the existing binding-owner check and leaves the agent session intact. Generic bindings need not implement timeout controls to support detaching. Registered session commands still bypass ACP prompt dispatch.

User Impact

  • /dock-*, /dock_*, /focus, and /unfocus are intentionally removed, with no compatibility aliases. Native command menus, help, config descriptions, and documentation stop advertising them.
  • Use /session unbind to detach a bound conversation without ending its session.
  • Ordinary agent routing, identity links, thread-bound sessions_spawn, and ACP --bind/--thread workflows remain supported. Their binding/delivery infrastructure is independent of manual attachment.
  • No configuration key, SQLite schema, or protocol-version change. Existing bindings remain releasable; existing saved delivery routes are preserved because they contain no reliable marker distinguishing a dock-written route from an ordinary remembered route. No bulk state deletion or speculative migration is performed.
  • Published plugin SDK hooks and command-normalization signatures remain supported. They are external contracts, not removable merely because bundled callers no longer need them.

Evidence

Net diff: −2,054 lines across 72 files: production +174/−1,154 (−980), tests/scenarios +350/−1,239 (−889), docs +35/−220 (−185), generated metadata +16/−16 (0). The second pass removes another 259 production lines, including a complete unused wrapper module, while extending the existing Matrix scenario.

  • Four independent subagent reviews covered command architecture, binding lifecycle, delivery/resolution ownership, and remaining public/documentation surfaces. Consequential findings were checked against source, callers, tests, and release history.
  • 263 focused command, lifecycle, ACP, plugin-command, conversation-resolution, and spawn tests passed after the second pass; 31 Control UI command-menu tests passed. One LINE test initially failed because its plugin existed only behind the old mocked lookup; the fixture now installs the real test registry, with every original expected ID/assertion retained.
  • The initial pass also verified 95 Discord binding lifecycle/message-preflight tests, 9 gateway protocol schema tests, protocol generation, and documentation (7,017 internal links and all 11 changed MDX pages).
  • OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build passed, including plugin bundles and Control UI assets.
  • node scripts/check-changed.mjs passed before the main refresh: all core/UI/plugin/script/root-test typechecks, lint, dead-export scans, generated metadata, architecture guards, five doctor-contract tests, and zero runtime import cycles.
  • Final structured Codex review of the full PR diff against refreshed main returned no actionable P0–P2 findings in two review passes. This complements the source/history review and executed tests; it is not a claim that the existing binding subsystem is defect-free.
  • pnpm openclaw qa matrix --provider-mode mock-openai --scenario subagent-thread-spawn --output-dir .artifacts/qa-e2e/remove-dock-focus-merged-20260830 passed (1 scenario, 0 failures). A disposable real Matrix homeserver and isolated Gateway proved bound follow-up history, same-thread unbind acknowledgment, a new ordinary session for the next message, an intact child session, and exactly one same-thread reply. The model provider was mocked; no external user channel was used. Sanitized verdict: {"verdict":"PASS","boundAndUnboundSessionsDiffer":true,"childSessionPreserved":true,"detachedFollowupReplies":1}. The added flow lives in qa/scenarios/channels/subagent-thread-spawn.yaml.

The first ready-for-review CI run found one orphaned 30-line test fixture whose only caller was the removed focus test. The fixture was deleted; production and full-tree unused-file scans now report zero entries, and a fresh review of the deletion passed. No runtime behavior changed in that CI repair.

A later CI shard exposed an existing skill-workshop test timing flaw: reject/quarantine could share a millisecond, so the production ID tie-break disagreed with the test’s assumed operation order. A forced tie reproduced the exact failure. The test now supplies distinct Date-only fixture times and restores the clock on completion, preserving every original assertion. All 49 tests in that file and the focused review pass; production behavior is unchanged (+8 test lines). A subsequent typecheck caught the cleanup hook returning VitestUtils; the hook now returns void, and the owning services test typecheck plus all 49 tests pass.

After GitHub reported a conflict, main at 279a12cf8b8 was merged into the draft without rewriting commits. The resolution keeps main’s direct command-handler list minus dock, accepts deletion of the obsolete ordering module, and regenerates metadata. All 134 targeted dispatch/lifecycle/ACP tests passed after the refresh; pnpm config:channels:check passed. A structural comparison confirmed that generated metadata differs from main only in four retired-command help strings. An independent integration audit confirmed all remaining handler precedence and lazy loading are unchanged. The Matrix result above is from the refreshed candidate.

Follow-up found during deep review: cross-channel binding-ID collisions

The shared binding service broadcasts ID-only unbind/touch operations to adapters, while some adapters construct IDs as accountId:conversationId. A local reproduction using the real service and two synthetic channel adapters with the same default:room-1 ID removed both bindings when requesting one; result deduplication hid the second removal. The old /unfocus path used the same service call, so this is pre-existing, not introduced by the command move. See src/infra/outbound/session-binding-service.ts and src/infra/outbound/account-scoped-conversation-bindings.ts.

A separate repair should scope binding mutation to its owning channel/account and audit the public/persisted identity contract. This PR does not redesign that contract or silently migrate stored IDs. The Matrix proof covers ordinary single-channel detach; it does not establish collision isolation across adapters.

Maintainer explicitly requested landing after the removal and deep-review passes. Immediate command retirement without aliases is approved.

Telegram-specific proof is unavailable in this environment: no authenticated Convex CLI is installed on PATH, and neither Convex broker setting is present. No Telegram credentials were leased or live user channels touched. The disposable Matrix transport proof above exercises the changed shared binding-command path; Telegram-specific transport behavior remains a proof limitation.

@clawsweeper

clawsweeper Bot commented Aug 30, 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 channel: discord Channel integration: discord channel: matrix Channel integration: matrix channel: telegram Channel integration: telegram app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Aug 30, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 12:37 PM ET / 16:37 UTC.

ClawSweeper review

What this changes

The PR removes manual channel docking and session-focus commands, retaining thread-bound session routing with an explicit /session unbind action.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer confirmation: the refactor is coherent, but it intentionally removes established docking and focus commands and needs an explicit compatibility decision plus Telegram command-surface proof before merge.

Priority: P2
Reviewed head: 855bcc57a7f7463ef6287d97417db5cb0af5a808
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation and focused coverage support the refactor, while explicit compatibility approval and Telegram-visible confirmation remain material merge checks.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR-provided disposable Matrix homeserver and isolated Gateway scenario exercises binding, /session unbind, ordinary follow-up routing, and child-session preservation; Telegram remains a surface-specific proof gap.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR-provided disposable Matrix homeserver and isolated Gateway scenario exercises binding, /session unbind, ordinary follow-up routing, and child-session preservation; Telegram remains a surface-specific proof gap.
Evidence reviewed 6 items Unbind implementation: The new local /session unbind path requires an authorized sender, preserves the binding-owner check, unbinds by binding ID with reason manual, and returns an acknowledgement.
Regression coverage: Lifecycle tests assert both successful manual unbinding and rejection for a different binding owner.
Command-surface replacement: The user documentation states that /session remains local for ACP-bound conversations and lists /session unbind as the replacement detachment command.
Findings None None.
Security None None.

How this fits together

Channel messages enter command dispatch and session routing, which resolve any thread-bound agent session before delivery. This change removes commands that manually changed that routing and retains unbinding as the user-controlled exit.

flowchart LR
  A[Channel message] --> B[Command dispatch]
  B --> C[Session routing]
  C --> D[Thread-bound session]
  D --> E[Agent response]
  B --> F[Session unbind]
  F --> C
Loading

Decision needed

Question Recommendation
Should existing /dock-*, /focus, and /unfocus workflows be retired immediately in favor of automatic thread binding and /session unbind? Approve immediate retirement: Accept the removal now and rely on automatic binding plus /session unbind as the supported workflow.

Why: This is an intentional public-command compatibility decision, not a defect that code review can settle.

Before merge

  • Resolve merge risk (P1) - Existing users of /dock-*, /focus, and /unfocus lose those public workflows immediately; the branch provides /session unbind for detachment but no compatibility alias or migration.
  • Resolve merge risk (P1) - No Telegram Test Server evidence confirms the revised native command/help surface after removal of the former commands.
Agent review details

Security

None.

PR surface

Source -1010, Tests -980, Docs -185, Generated 0, Other +121. Total -2054 across 72 files.

View PR surface stats
Area Files Added Removed Net
Source 38 174 1184 -1010
Tests 19 226 1206 -980
Docs 13 35 220 -185
Config 0 0 0 0
Generated 1 16 16 0
Other 1 124 3 +121
Total 72 575 2629 -2054

Review metrics

Metric Value Why it matters
Production versus test delta production −980, tests/scenarios −889, docs −185, generated 0 net The large deletion is a coherent retirement rather than production growth, but it removes several established user command entry points.

Stored data model

Persistent data-model change detected: unknown-data-model-change: src/config/bundled-channel-config-metadata.generated.ts, vector/embedding metadata: src/auto-reply/reply/commands-subagents/action-unfocus.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm and prove the retirement (recommended)
    Approve the immediate compatibility change and add Telegram Test Server evidence for the revised command surface before merge.
  2. Accept the immediate break
    Merge without aliases only if maintainers explicitly accept that existing manual docking and focus commands stop working on upgrade.
  3. Defer command removal
    Pause this PR if the product still needs a transition period for manual routing workflows.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
After explicit compatibility approval, add Telegram Test Server proof for the revised native command surface.

Technical review

Best possible solution:

Obtain explicit approval for immediate command retirement and capture Telegram Test Server evidence that the new native command surface exposes the supported replacement.

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

Not applicable: this PR intentionally retires command workflows rather than reporting an existing defect.

Is this the best way to solve the issue?

Unclear: the implementation is internally coherent, but whether immediate removal is the best product path depends on maintainer acceptance of the compatibility break.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR-provided disposable Matrix homeserver and isolated Gateway scenario exercises binding, /session unbind, ordinary follow-up routing, and child-session preservation; Telegram remains a surface-specific proof gap.

Label justifications:

  • P2: This is a bounded user-workflow and compatibility decision without evidence of an active outage or data loss.
  • merge-risk: 🚨 compatibility: The branch removes documented manual routing commands that existing operators may invoke after upgrade.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR-provided disposable Matrix homeserver and isolated Gateway scenario exercises binding, /session unbind, ordinary follow-up routing, and child-session preservation; Telegram remains a surface-specific proof gap.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR-provided disposable Matrix homeserver and isolated Gateway scenario exercises binding, /session unbind, ordinary follow-up routing, and child-session preservation; Telegram remains a surface-specific proof gap.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The PR changes Telegram-visible native command and help behavior, so it should be demonstrated with the Telegram Test Server userbot.

Evidence

Acceptance criteria:

  • [P1] Telegram Test Server: verify the native command menu/help no longer exposes retired focus or docking commands and that /session unbind detaches the current bound conversation.

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Confirm immediate removal of the retired public commands.
  • Capture Telegram Test Server evidence for the revised native command/help surface.

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 (1 earlier review cycle)
  • reviewed 2026-08-30T07:17:16.429Z sha 144633b :: needs maintainer review before merge. :: none

@steipete steipete self-assigned this Aug 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 16:05
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 30, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Landing review for head 855bcc57a7f7463ef6287d97417db5cb0af5a808:

The maintainer explicitly approved immediate removal of /dock-*, /dock_*, /focus, and /unfocus, without compatibility aliases. The remaining detach operation is /session unbind; ordinary routing, spawned/ACP bindings, saved state, and published SDK contracts are preserved. Production is net −980 lines; tests/scenarios/support −889; docs −185; generated metadata unchanged in line count.

Four independent source-review lanes, the integration audit, fresh structured Codex review, the orphan-fixture deletion review, and the workshop fixture-clock review found no actionable introduced P0–P2 findings. The latest ClawSweeper review was read at the final head: it reports no actionable code findings and accepts the Matrix behavior proof. Its compatibility decision is explicitly approved by the maintainer. Its Telegram-specific rank-up is not claimed complete: the missing Convex prerequisite and resulting surface-specific proof gap are documented below; Telegram adapter logic is unchanged, while the shared command path has direct Matrix proof. No SQLite schema or stored-ID migration occurs; generated metadata differs only in four help strings.

Focused commands after the main refresh:

pnpm test src/auto-reply/reply/commands-handlers.registration.test.ts src/auto-reply/reply/commands-session-lifecycle.test.ts src/auto-reply/reply/dispatch-acp-command-bypass.test.ts src/agents/subagents/spawn/acp-spawn.test.ts
pnpm config:channels:check
pnpm openclaw qa matrix --provider-mode mock-openai --scenario subagent-thread-spawn --output-dir .artifacts/qa-e2e/remove-dock-focus-merged-20260830
node --import ./scripts/tsx.mjs scripts/check-deadcode-unused-files.mts
node scripts/run-vitest.mjs src/skills/workshop/service.test.ts
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.services.json

Results: 134 targeted tests passed; generated metadata matches source; both unused-file scans have zero entries. The real disposable Matrix server plus isolated Gateway passed bind → bound follow-up → unbind acknowledgment → ordinary follow-up routing, preserving the child session and emitting exactly one reply in the same thread. The model was mocked. Verdict: {"verdict":"PASS","boundAndUnboundSessionsDiffer":true,"childSessionPreserved":true,"detachedFollowupReplies":1}. The final CI repairs delete a 30-line fixture with no remaining callers and make the existing workshop test clock deterministic. A forced timestamp tie reproduced its exact CI failure; all 49 workshop tests pass after explicit increasing timestamps, with all assertions retained. The services test typecheck also passes with a void-return cleanup hook. Neither repair changes production behavior.

Hosted CI run 33322547038, attempt 1, completed success for this exact head. The rollup is GREEN, with zero pending checks. Earlier dependency, timestamp-tie, and cleanup-hook type failures were repaired and revalidated; no gate was bypassed.

Known proof limitation: Telegram Test Server credentials could not be leased because this environment has neither the Convex CLI nor broker settings. No credential installation, login, or unrelated credential fallback was attempted. Matrix covers the changed shared command path; this is not a claim of Telegram-specific transport verification. The pre-existing cross-channel binding-ID collision remains a separate documented ownership follow-up, not an introduced or silently fixed behavior.

@steipete
steipete merged commit 4bc25d7 into main Aug 30, 2026
260 checks passed
@steipete
steipete deleted the codex/remove-docking-and-focus branch August 30, 2026 16:45
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
…33153)

* refactor: remove channel docking and manual session focus

* refactor: simplify conversation binding and command ownership

* test: remove orphaned focus fixture

* test: make proposal transition ordering deterministic

* test: return void from fixture cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: discord Channel integration: discord channel: matrix Channel integration: matrix channel: telegram Channel integration: telegram docs Improvements or additions to documentation extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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