Skip to content

feat(tui): show foreground agent activity in /tasks - #5049

Merged
Grapedge merged 1 commit into
mainfrom
tui-tasks
Nov 18, 2026
Merged

Grapedge merged 1 commit into
mainfrom
tui-tasks

Conversation

@Grapedge

Copy link
Copy Markdown
Collaborator

Requirement or Bug

在终端里,前台子 Agent 运行时只有主对话里的简短预览。现在也能从 /tasks 打开它的活动详情,查看正文、工具活动和模型发出的可见思考。查看详情时,主 Agent 继续等待这次工具调用的结果。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

任务浏览器用 SDK 拉取的任务同时驱动列表、预览和详情。后台任务事件更新对应条目。活动详情按本次工具调用匹配子 Agent 的记录。

flowchart LR
    A[SDK 任务列表] --> B[任务浏览器]
    C[子 Agent 活动记录] --> D[活动详情]
    B --> D
    E[子 Agent 终态事件] --> B
Loading

前台运行结束时,浏览器移除列表条目,已经打开的详情继续显示这次运行的最终记录。这里复用现有任务数据和详情组件,工作集中在 TUI。

Screenshots / Recordings

同一个模拟前台 Agent 在运行期间打开 /tasks。改动后可以用 Enter 打开它的活动详情。

改动前
 TASK BROWSER  filter=ALL  0 total                                                                                      
┌─ Tasks [all] ──────────────────────┐┌─ Detail ───────────────────────────────────────────────────────────────────────┐
│No background tasks in this session.││Select a task from the list.                                                    │
│                                                                                                                       
改动后的列表和活动详情
 TASK BROWSER  filter=ALL  1 running  1 total                                                                           
┌─ Tasks [all] ──────────────────────┐┌─ Detail ───────────────────────────────────────────────────────────────────────┐
│❯ agent-3mgrsof7    running Inspect…││Task ID:      agent-3mgrsof7                                                    │
│  fixture-model                     ││Status:       running                                                           │
│                                    ││Description:  Inspect foreground activity                                       │
│                                    ││Mode:         Foreground                                                        │
│                                    ││Agent ID:     agent-0                                                           │
 Agent activity coder › Inspect foreground activity  running  step 1–1 / 1                                              
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ── step 1 ──                                                                                                         │
│   Thinking                                                                                                           │
│   I am checking the requested evidence.                                                                              │
│                                                                                                                      │
│ ● I have started checking the evidence.                                                                              │
│                                                                                                                      │
│                                                                                                                      │

Behavior Changes and Affected Users

行为 改动前 改动后 受影响用户
前台子 Agent 主对话里的简短预览 /tasks 列出运行中的前台子 Agent,按 Enter 查看。前台命令继续在主对话里显示 交互终端用户
任务完成 前台任务没有活动详情 已打开的详情保留结果,返回列表时只显示仍在运行的前台子 Agent 查看前台活动的终端用户
思考内容 活动详情只有正文和工具活动 前后台的活动详情都显示模型发出的可见思考 使用支持思考输出的模型的终端用户
重用同一个子 Agent 活动可能混入不同运行的步骤 活动按调用匹配。旧后台条目缺少对应的活动记录时,显示已保存的任务输出 在同一会话中恢复子 Agent 的终端用户
停止任务 S 可停止运行中的后台任务 S 仍用于后台任务,前台 Agent 的条目用于查看 用 /tasks 管理后台任务的终端用户

普通和全屏终端均用模拟模型验证了列表、活动流、父 Agent 等待和完成后的结果。任务浏览器、活动记录和事件处理的 100 项相关测试通过,类型检查和文档构建通过。

全量 TUI 测试

此前的本地全量运行有 3,779 项通过,10 项失败集中在 kimi-tui-message-flow.test.ts,运行还报告本地监听 EPERM。该文件里与任务和子 Agent 匹配的 6 项测试单独运行通过。

Checklist

  • I have read the CONTRIBUTING document.
  • 用户报告来自本次讨论,未提供关联 issue。
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete.
  • Ran gen-changesets skill.
  • Updated the English and Chinese slash command reference. The docs build passed.

@changeset-bot

changeset-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a4ea44e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T10:53:00.713133Z a4ea44e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 18, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@a4ea44e
npx https://pkg.pr.new/@moonshot-ai/kimi-code@a4ea44e

commit: a4ea44e

@Grapedge
Grapedge merged commit a09bf85 into main Nov 18, 2026
17 checks passed
@Grapedge
Grapedge deleted the tui-tasks branch November 18, 2026 11:54
devin-ai-integration Bot added a commit to 7723qqq/kimi-code that referenced this pull request Nov 24, 2026
Port upstream MoonshotAI#5049's behavior onto the panel architecture: foreground
tasks (detached === false) are listed in /tasks so a running foreground
agent's activity can be inspected, and stop is a no-op for them since
they belong to the foreground turn.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration Bot added a commit to 7723qqq/kimi-code that referenced this pull request Nov 24, 2026
…end drift-allow

- bun scripts/upstream-ledger.mjs --refresh: 148 new pending rows covering
  the 2.7.0 tail and upstream/main.
- Mark MoonshotAI#5043/MoonshotAI#5037/MoonshotAI#5049 ported (26f22db, 0d20273, d61aacc) and
  MoonshotAI#5042 equivalent (multiline feedback editor already shipped, localized).
- Refresh MoonshotAI#4820 evidence: the machine-architecture blocker retired with the
  2.7.0 merge.
- drift-allow: add the missing translated/renamed upstream files (media.ts,
  node-local hostServices/rgLocator/runRg, executor validate.ts, remaining
  vitest configs) so upstream-drift stops flagging deliberate removals.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

2 participants