Skip to content

fix(steer): fallback to sibling direct/DM lanes when slash lane has no active run - #81613

Closed
freeter226 wants to merge 1 commit into
openclaw:mainfrom
freeter226:fix/steer-slash-lane-fallback
Closed

freeter226 wants to merge 1 commit into
openclaw:mainfrom
freeter226:fix/steer-slash-lane-fallback

Conversation

@freeter226

Copy link
Copy Markdown

Summary

Fixes #81594

When /steer targets a slash-command session lane but no active embedded run exists there, the command reports "no active run" even though the user has an active run on the sibling direct/DM lane for the same peer.

Root Cause

resolveSteerSessionId() in src/auto-reply/reply/commands-steer.ts only checks the resolved target session key. When the key resolves to a :slash: lane (because the /steer text command is dispatched through the slash lane), it finds no active run and gives up immediately, without checking sibling lanes.

Fix

After the initial active-run lookup fails on the slash lane, check if the session key contains :slash: and try the corresponding :direct: and :dm: sibling keys. Return the first sibling with an active embedded run.

This matches the approach suggested in the issue and mirrors the pattern used by other channel dispatch paths (Telegram, Discord) where the active run lives on the direct/DM lane.

Testing

  • Code reviewed line-by-line against the existing session resolution pattern
  • Logic verified: only falls back when the original target is a slash lane AND has no active run
  • No side effects: if neither sibling has an active run, existing behavior (return undefined → fallback prompt) is preserved

AI-assisted

This PR was written with AI assistance. I have reviewed and understand every line of the change.

…o active run

When /steer targets a slash-command session lane but no active embedded
run exists there, check sibling direct and DM lanes for the same peer
before giving up. This fixes the false "no active run" result when the
user has an active run on the direct lane but /steer resolves to the
slash lane.

Fixes openclaw#81594

[AI-assisted]
@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 14, 2026
@clawsweeper

clawsweeper Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

This PR is now superseded: the merged replacement at #98126 covers the same slash-lane /steer fallback on current main with broader session-file and Telegram/Codex steering coverage, while this branch is conflicting and still lacks real behavior proof.

Canonical path: Keep the merged replacement implementation as canonical, close this conflicting resolver-only PR, and track any remaining ordinary-message steer ingress work in the separate canonical follow-up.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Keep the merged replacement implementation as canonical, close this conflicting resolver-only PR, and track any remaining ordinary-message steer ingress work in the separate canonical follow-up.

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

Yes, for the original bug at source level: v2026.6.11 resolves /steer only against the selected target key and stored id. Current main no longer reproduces that shape because it now checks slash-lane sibling keys and session-file lookup.

Is this the best way to solve the issue?

Yes, the merged replacement is the better solution because it covers this PR's sibling fallback plus the adjacent session-file, Telegram/Codex registration, and active-run admission paths. The one-file branch is now obsolete and conflicting.

Security review:

Security review cleared: The PR diff is limited to TypeScript steer session lookup and does not change dependencies, workflows, secrets, permissions, package resolution, or downloaded code.

AGENTS.md: found and applied where relevant.

What I checked:

  • Current main implements the requested fallback: Current main builds candidate steer keys from the target key plus :slash: to :direct:/:dm: siblings, then resolves active runs by candidate key, session file, and stored active session id. (src/auto-reply/reply/commands-steer.ts:61, 9d68f877ac3e)
  • Current main has regression coverage: The focused steer test now covers slash-lane command sessions falling back to an active direct sibling and queuing the steering message to that active run. (src/auto-reply/reply/commands-steer.test.ts:152, 9d68f877ac3e)
  • Merged replacement PR supersedes this branch: Live GitHub data for Restore Telegram /steer for active Codex runs #98126 shows it merged on 2026-07-01, explicitly said it superseded this PR, closed the linked bug, and touched src/auto-reply/reply/commands-steer.ts plus adjacent Telegram/Codex steering files. (274b6287cfb3)
  • Git history provenance for the replacement: Commit 274b6287cfb37fef310cf2919c851a9236948d89 is the replacement PR commit that changed commands-steer.ts, commands-steer.test.ts, Telegram sequential-key code, and Codex steering coverage. (274b6287cfb3)
  • This PR is no longer a clean landing candidate: Live GitHub data shows this PR is open but mergeStateStatus is DIRTY, mergeable is CONFLICTING, and the branch only changes src/auto-reply/reply/commands-steer.ts. (e8f8ac877520)
  • Latest release does not contain the newer implementation: The latest release tag v2026.6.11 still has the older target-key-only steer resolver, so the superseding implementation is current-main-only rather than shipped in that release. (src/auto-reply/reply/commands-steer.ts:60, e085fa1a3ffd)

Likely related people:

  • 100yenadmin: Authored the merged replacement PR that incorporated the resolver fallback and broader Telegram/Codex steering repairs. (role: replacement fix contributor; confidence: high; commits: 274b6287cfb3, 6912ef43f0f4; files: src/auto-reply/reply/commands-steer.ts, src/auto-reply/reply/commands-steer.test.ts, extensions/telegram/src/sequential-key.ts)
  • obviyus: Merged the replacement PR after scoped tests and live Codex app-server steering proof were reported in the landing comment. (role: replacement PR merger; confidence: medium; commits: 8d9a7ab2cab6; files: src/auto-reply/reply/commands-steer.ts, extensions/telegram/src/sequential-key.ts, extensions/codex/src/app-server/run-attempt.ts)
  • Kyzcreig: Reported the canonical slash-lane /steer bug and authored the related Telegram control-lane PR that overlapped the command-routing part of the final replacement. (role: source reporter and adjacent contributor; confidence: medium; commits: 0cde4f7edb09; files: extensions/telegram/src/sequential-key.ts, extensions/telegram/src/sequential-key.test.ts)

Codex review notes: model internal, reasoning high; reviewed against 9d68f877ac3e; fix evidence: commit 274b6287cfb3, main fix timestamp 2026-07-01T10:04:17-07:00.

@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 14, 2026
@freeter226

Copy link
Copy Markdown
Author

Thanks for the thorough review @clawsweeper.

Regarding the real behavior proof: this PR fixes a :slash: → :direct:/:dm: lane fallback that only occurs with Discord native slash commands (where CommandSource === "native" and sessions use :slash: lane keys). I don't have a Discord bot setup to reproduce this end-to-end.

However:

  1. The fix is narrow and deterministic — it only activates when the resolved target contains :slash: and has no active run
  2. The logic has been validated by ClawSweeper source inspection ("Yes, the proposed hook point is the narrowest maintainable place to fix the lookup")
  3. Security review cleared

I'm happy to add a regression test covering the slash-to-direct fallback if that helps. Would a maintainer be able to verify this in a Discord test environment, or apply a proof: override?

@steipete @shakkernerd — any guidance would be appreciated.

@clawsweeper clawsweeper Bot removed the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 16, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 2, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 2, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 15, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thanks for the focused fix. Closing as superseded by #98126, which landed the slash-lane direct and DM fallback on current main and also resolves active runs by session file and stored session ID, with focused steering coverage.

The replacement shipped in v2026.7.1-beta.1, and #81594 is closed. If this still reproduces there, please open a fresh report with exact runtime and channel proof.

@steipete steipete closed this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Text /steer can target slash lane instead of active direct lane

2 participants