Skip to content

feat(native-chat): open Qoder CLI sessions in the chat view - #31796

Open
QZTnb wants to merge 1 commit into
stablyai:mainfrom
QZTnb:feat/qoder-chat-ui
Open

QZTnb wants to merge 1 commit into
stablyai:mainfrom
QZTnb:feat/qoder-chat-ui

Conversation

@QZTnb

@QZTnb QZTnb commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Qoder is one of the coding agents Orca can run, but until now it only ever showed up as a raw terminal. This lets a Qoder tab switch to Orca's chat view, the same way OpenClaude tabs already can, so you read Qoder's replies, tool steps and questions as a conversation.

What Changed

Before: a Qoder tab is terminal-only. "Continue in Chat UI" (⌘⇧J) is not offered.

After: "Continue in Chat UI" works for qoder and qoder-cn tabs. The chat shows Qoder's prompts, replies, tool calls and questions. Thinking appears as de-emphasized reasoning, and an interrupt leaves the "Conversation interrupted" row.

Mechanism: Qoder writes Claude-format JSONL transcripts and Claude-shaped hooks that report session_id and transcript_path. So both Qoder builds join the terminal-backed chat the way OpenClaude does: they map to the claude transcript agent and bind through the same hook path. Four Qoder-specific rules sit behind isQoderNativeChatAgent:

  • Session lookup (session-file-resolver.ts): the id fallback searches only ~/.qoder/projects or ~/.qoder-cn/projects, never Claude's roots, so a shared id cannot bind another CLI's transcript. The hook's transcript_path still wins, as for every agent.
  • Turn end (transcript-turn-lifecycle.ts): Qoder writes stop_reason: null on every mid-turn row. Claude's backup rule ("no stop reason plus text means done") would settle the spinner at the first thinking row, so Qoder turns end only at an explicit stop reason.
  • Reasoning (transcript-line-decoders-qoder.ts): Qoder rows carry readable thinking. A thinking-only row now decodes as a reasoning row instead of answer prose, matching how Codex, Grok and OpenCode thinking already renders.
  • Interrupt (transcript-turn-markers.ts, transcript-line-decoders-qoder.ts): on Esc, Qoder fires no hook and writes a bare [Request interrupted by user] row without interruptedMessageId. That row now ends the turn and renders the same status row as Claude's notice.

There is also one small refactor: the full-transcript reader now picks its decoder through nativeChatLineDecoderForAgent, so full reads and the live tail share one agent-to-decoder rule.

Why

Linked Issue

Fixes #31787

Visual Proof

All shots use a throwaway demo folder and Qoder CLI 1.1.76 in isolated dev profiles. Before is main; after is this PR plus #31794 and #31795.

  • Before: right-clicking a Qoder terminal offers no "Continue in Chat UI".

    Qoder terminal context menu on main without Continue in Chat UI
  • After:

    • The same menu now offers "Continue in Chat UI ⌘⇧J".

      Qoder terminal context menu offering Continue in Chat UI
    • A turn that read files and ran a command, folded into "Worked for 17s" above the answer.

      Qoder chat view with a tool turn folded into Worked for 17s
    • The same turn expanded. Qoder's thinking shows as a Reasoning row.

      Expanded Qoder turn with a Reasoning row
    • Qoder's AskUserQuestion as a chat card.

      Qoder AskUserQuestion shown as a chat card
    • Stop during sleep 60. The turn ends with "Conversation interrupted", and the sidebar row is idle.

      Interrupted Qoder turn ending with Conversation interrupted while the sidebar row is idle

Testing

Manual: macOS, Qoder CLI 1.1.75 and 1.1.76, in background dev builds driven over CDP. Covered:

  • Toggle to chat.
  • Send a prompt that runs tools.
  • Live append, and the working state holding until the explicit stop reason.
  • Interrupt, with reload afterwards.
  • Answering a question card.

Not tested:

  • Approval cards, because Orca launches Qoder with --dangerously-skip-permissions.
  • Windows and Linux.
  • SSH.
  • The phone app (the support list is shared, so a rebuilt app offers Qoder chat too).

Automated (each of the following fails without the change):

  • session-file-resolver.test.ts: a Qoder id resolves under the Qoder root and never from a Claude root.
  • transcript-turn-lifecycle.test.ts:
    • On the real Qoder fixture, a turn ends only at its stop reason; Claude's backup would end it at the first thinking row.
    • The bare notice row ends the turn.
  • transcript-reader.test.ts: the real Qoder fixture decodes its thinking as reasoning.
  • transcript-interruption-message.test.ts: Qoder's notice becomes the interrupted status row, while a bare Claude row stays harness noise.
  • native-chat-agent-profiles.test.ts: Qoder claims no slash commands, because its TUI runs them.

Local runs:

  • pnpm tc: all four projects.

  • oxlint, oxfmt --check, pnpm run check:code-quality:changed, pnpm run check:max-lines-ratchet.

  • Vitest over src/main/native-chat, src/shared/native-chat, src/renderer/src/components/native-chat, src/main/runtime/orchestration and src/main/ai-vault: 1148 files passed.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Implemented with Claude Code (Claude Opus 5.5) under my direction. I reviewed the diff, the live test runs and the screenshots.

Review

AI agent review of this change:

  • Cross-platform: no platform-specific code. Paths use path.join and homedir().
  • SSH / remote: a hook-reported transcript_path keeps using the existing SSH and WSL transcript readers. The id fallback for Qoder searches only this host's Qoder root, with no WSL tier, so a guest's Qoder session is found through its hook path.
    • Mixed versions: a newer client paired with an older host cannot get the transcript, because the older host does not resolve Qoder sessions. The chat shows its "no transcript" state instead of messages. ZCode's chat support (ecc3433) was added the same way, without a capability flag.
  • Other agents: every Qoder rule is gated by isQoderNativeChatAgent. Claude, OpenClaude, Codex, Grok, OMP, OpenCode, OpenCode 2 and ZCode decode, resolve and end turns exactly as before. The reader refactor keeps the same agent-to-decoder mapping.
  • Performance: Qoder rows are parsed once more by the Qoder layer. No new watchers or IPC.
  • UI: no new components. The change reuses the existing reasoning and interrupted rows.
  • Security: reads only the hook-reported transcript or files under Qoder's own projects root. No new IPC surface and no credentials.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
    • Typecheck, oxlint, the changed-code gate and the affected suites pass locally. A full local pnpm test on macOS hits only pre-existing environment failures, the same on main. CI covers pnpm build.

🤖 Generated with Claude Code

Qoder writes Claude-format JSONL transcripts and Claude-shaped hooks that
report session_id and transcript_path, so both Qoder builds (qoder,
qoder-cn) join the terminal-backed chat the way OpenClaude does: same
decoder, same hook binding. Four Qoder-specific rules sit behind
isQoderNativeChatAgent:

- The id fallback searches ~/.qoder/projects or ~/.qoder-cn/projects
  only, never Claude's roots, so a shared session id cannot bind another
  CLI's transcript.
- Qoder writes stop_reason: null on every mid-turn row, so its turn ends
  only at an explicit stop reason; Claude's missing-stop-reason backup
  would settle the spinner at the first thinking row.
- Qoder rows carry readable thinking; a thinking-only row decodes as a
  reasoning row instead of answer prose.
- On Esc, Qoder fires no hook and writes a bare "[Request interrupted by
  user]" row without interruptedMessageId; that row now ends the turn and
  renders as the interrupted status row.

The full-transcript reader now picks its decoder through
nativeChatLineDecoderForAgent, so full reads and the live tail share one
agent-to-decoder rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf2c2e76-1847-4655-8a32-a96ebf60e4c1
📥 Commits

Reviewing files that changed from the base of the PR and between 5c5f9a2 and a162a5b.

📒 Files selected for processing: 14
  • src/main/native-chat/session-file-resolver.test.ts
  • src/main/native-chat/session-file-resolver.ts
  • src/main/native-chat/transcript-interruption-message.test.ts
  • src/main/native-chat/transcript-line-decoders-qoder.ts
  • src/main/native-chat/transcript-line-decoders.ts
  • src/main/native-chat/transcript-reader.test.ts
  • src/main/native-chat/transcript-reader.ts
  • src/main/native-chat/transcript-tail-reader.ts
  • src/main/native-chat/transcript-turn-lifecycle.test.ts
  • src/main/native-chat/transcript-turn-lifecycle.ts
  • src/main/native-chat/transcript-turn-markers.ts
  • src/shared/native-chat-agent-profiles.test.ts
  • src/shared/native-chat-agent-profiles.ts
  • src/shared/native-chat-agent-support.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The changes add qoder and qoder-cn as supported native-chat agents. Session lookup uses each agent’s Qoder projects root. Transcript reading uses a Qoder-specific decoder for interruption notices and thinking-only assistant messages. Qoder turn lifecycle handling recognizes bare interruption notices and uses explicit stop reasons to mark completion. Tests cover session lookup, transcript decoding, and lifecycle states.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to a162a

Qoder chat support is ready to merge after normal checks; no actionable issue remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 47.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 14 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: enabling Qoder CLI sessions to open in the chat view.
Linked Issues check Passed Issue #31787 requires Chat UI support for qoder and qoder-cn. The support list and transcript mapping add both agents. The resolver limits ID fallback to ~/.qoder/projects or `~/.qoder-cn/projec…
Out of Scope Changes check Passed The changes stay within issue #31787. The full-transcript reader refactor keeps live and full reads on the same agent-to-decoder mapping. Added tests verify the requested Qoder behavior. No unrelated …
Description check Passed The pull request description is complete and follows the repository template. It includes the ELI5 summary, user-facing changes, mechanism, rationale, linked issue, before-and-after visual proof, manu…
Full details: Linked Issues check

Explanation

Issue #31787 requires Chat UI support for qoder and qoder-cn. The support list and transcript mapping add both agents. The resolver limits ID fallback to ~/.qoder/projects or ~/.qoder-cn/projects. The Qoder lifecycle decoder requires explicit stop reasons and recognizes the bare interruption row. The Qoder line decoder renders thinking-only rows as reasoning and renders interruption status. Tests cover resolver isolation, lifecycle, transcript reading, interruption decoding, and agent profiles.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #31787. The full-transcript reader refactor keeps live and full reads on the same agent-to-decoder mapping. Added tests verify the requested Qoder behavior. No unrelated feature or separate issue objective is introduced.

Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It includes the ELI5 summary, user-facing changes, mechanism, rationale, linked issue, before-and-after visual proof, manual and automated testing details, AI disclosure, review notes, scope boundary, platform considerations, and checklist status. The unchecked full local test/build item is explained, including pre-existing environment failures and CI coverage.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dr-xjx

dr-xjx commented Nov 14, 2026

Copy link
Copy Markdown

Independent confirmation from a different environment: Qoder CLI 1.1.89 on Linux x86_64. The three transcript rules this PR relies on all hold, and they are the two things I would have been most worried about before trusting a Qoder chat view.

stop_reason: null on mid-turn rows — confirmed

Across a real 1.1.89 session (641 assistant rows):

{null: 405, tool_use: 215, end_turn: 21}

So the Claude backup rule ("no stop reason plus text means done") really would settle the spinner on the first thinking row. Gating turn end on an explicit stop reason is the right fix.

Readable thinking — confirmed

236 thinking blocks in the same session, so decoding them as reasoning rather than answer prose matters.

Session roots and format — confirmed

~/.qoder/projects/<encoded-cwd>/<sessionId>.jsonl, Claude-shaped rows with uuid / parentUuid / timestamp / message / isSidechain / toolUseResult, plus Qoder-only extras (businessModelKey, requestTokenAnchor, responseGroupId). 220 transcripts on this machine. Scoping the id fallback to ~/.qoder/projects (and refusing to fall through to Claude's roots) is necessary, not defensive.

Not verified: the bare [Request interrupted by user] row — this machine's transcripts contain none, since no turn was ever interrupted there. That rule rests on your 1.1.75 testing.

Two things that may be blocking this

1. The branch is stale and conflicting. mergeable_state: dirty, last updated 2026-10-22 with a single commit, and no review. It needs a rebase onto current main before anyone can evaluate it — that is likely why it has sat.

2. The stream-json note in the linked issue has changed. #31787 says a structured session (-p --output-format stream-json --input-format stream-json) would be a larger adapter. As of 1.1.89 that path does not work at all:

$ qodercli -p "say OK" --output-format stream-json
sdk_worker_removed: SDK worker sessions are no longer supported.
Upgrade to the latest Qoder SDK version, or roll back the CLI to 1.1.80 or earlier.

So the terminal-backed route is not just the smaller first step now — it is the only route that works on current Qoder. Worth stating in the PR description so a reviewer does not ask "why not just use stream-json".

Not a request, just context

For whoever evaluates this: I checked whether the ACP registry proposed in #38083 would cover Qoder instead, and it would not. qodercli exposes no ACP server. The terminal-backed path here is complementary — it gets Qoder into chat today, without waiting on a generic agent registry. Both land in the same place from a user's perspective, so this PR is not made redundant by #38083.

Happy to test a rebased build on Linux if that is useful — the 1.1.89 transcripts above are from a live install, so I can compare rendering against the real files.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Chat UI for Qoder CLI

2 participants