Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(cli): compact Agent-facing output (#2971)
Call White326c69589b71
diff --git a/core/watches.py b/core/watches.pyindex 8c27f44b1..5974d2fdc 100644--- a/core/watches.py+++ b/core/watches.py@@ -2787,11 +2787,12 @@ class ManagedWatchService:error_text = "timed out"if 124 in set(watch.retry_exit_codes):# A retry authorises no hook: the watch keeps running, and there is- # nothing to tell the user yet.+ # nothing to tell the user yet. A configured retry is the waiter+ # saying "still waiting", so it records its exit code and no error.if not await self._commit_cycle_result_async(watch,exit_code=124,- error=error_text,+ error=None,disable=False,):return@@ -2814,12 +2815,13 @@ class ManagedWatchService:)return- error_text = _squash_error(result.stderr) or f"watch command exited with status {result.exit_code}"if result.exit_code in set(watch.retry_exit_codes):+ # "Still waiting": the exit code is the whole verdict. ``last_error``+ # stays for real failures, so a healthy waiter never reads as broken.if not await self._commit_cycle_result_async(watch,exit_code=result.exit_code,- error=error_text,+ error=None,disable=False,):return@@ -2829,6 +2831,7 @@ class ManagedWatchService:)continue+ error_text = _squash_error(result.stderr) or f"watch command exited with status {result.exit_code}"await self._commit_cycle_result_async(watch,exit_code=result.exit_code,diff --git a/docs/CLI.md b/docs/CLI.mdindex 28b594268..b84bfbd68 100644--- a/docs/CLI.md+++ b/docs/CLI.md@@ -25,6 +25,12 @@ and never provide an unpaginated `--all` bypass. Follow`pagination.next_command` for the next page and use the corresponding `show` or`get` command for full record detail.+List rows carry only what is needed to decide the next step and omit null,+empty, and zero-valued fields, so an absent field means unset. `vibe task show`,+`vibe watch show`, `vibe runs show`, `vibe session get`, and `vibe agent show`+print the full record; add `--brief` to print exactly the row the matching list+command prints.+### Session-owned lists`vibe harness status`, `vibe runs list`, `vibe task list`, `vibe watch list`,@@ -440,7 +446,7 @@ may be omitted and defaults to the caller Session from `AVIBE_SESSION_ID`.List and inspect Agent run records.```bash-vibe runs list --brief # inside an Avibe Agent shell, the caller Session's runs+vibe runs list # inside an Avibe Agent shell, the caller Session's runsvibe runs list --global --definition-id <task-or-watch-id> # every fire, across per-run Sessionsvibe runs show run_abc123vibe runs show run_abc123 --brief # status, timing, error, and callback fields only@@ -480,8 +486,9 @@ Use `vibe task add --help` and `vibe task update --help` for the full command suWhen `vibe task add` runs inside an Avibe-injected Agent shell, `--session-id`may be omitted. Avibe defaults the task target to the caller Session from-`AVIBE_SESSION_ID` and reports that default in the command output. Explicit-`--session-id`, session creation flags, and delivery flags still win.+`AVIBE_SESSION_ID`; the printed definition's `session_id` shows the resolved+target. Explicit `--session-id`, session creation flags, and delivery flags+still win.A pure command task (`--on-failure none`, the default) skips that caller-sessiondefault and takes no session, scope, or agent flags. Successful runs are silent;@@ -560,6 +567,12 @@ Hub menu does not offer, or a menu that cannot be loaded, is refused; for claudeand codex an unknown value is a warning, since their bundled catalogs can lagbehind a new release. `vibe agent models <agent>` lists valid values.+The command prints one `run` object: its `id`, `status`, `run_type`,+`agent_name`, and the `session_id`, `scope_id`, `visibility`, and+`callback_session_id` Avibe resolved for it. `--sync` replaces it with the+finished run record. `callback_notice` appears only when a run on the caller's+own Session gets no callback because the result already lands there.+Async runs need an explicit callback policy unless the command is running insidean Avibe-injected Agent environment. Use `--callback-session-id` when the finalresult text should return to a caller Session as a follow-up Agent message; use@@ -611,18 +624,27 @@ vibe watch remove <watch-id>`vibe task list` and `vibe watch list` read the caller Session by default (see[Session-owned lists](#session-owned-lists)), return 20 definitions per page, and-include `pagination.next_command` when more rows exist. Successful one-shot-definitions are hidden by default. Add `--include-finished` to page through-history. List output is always bounded; there is no unpaginated `--all` mode.-Task and watch commands use `definition` for one record and `definitions` for-lists; they do not duplicate those records under command-specific aliases.+include `pagination.next_command` when more rows exist. Enabled definitions come+first, each group ordered by most recent activity. `--q <text>` searches the+same text fields as the Workbench search (id, name, Agent, Session, message, and+command) and is carried into `next_command`. Successful one-shot definitions are+hidden by default. Add `--include-finished` to page through history. List output+is always bounded; there is no unpaginated `--all` mode. Task and watch commands+use `definition` for one record and `definitions` for lists; they do not+duplicate those records under command-specific aliases.+Both list and show read the same Harness projection as the Workbench:-`lifecycle_state`, `lifecycle_detail`, `next_run_at`, `waiting_since`, and-`running_since`; watch rows also include `process_alive`. For watches,-`process_alive: null` means no waiter runtime has ever been observed, while-`false` means an observed waiter has exited. The older `state` and task-`last_status` fields remain compatibility-only display fields and do not define-the lifecycle.+`lifecycle_state` is the lifecycle, with `lifecycle_detail` and+`lifecycle_finished_at` for a finished definition and `next_run_at`,+`waiting_since`, or `running_since` while it is in play. A row names an unnamed+definition by `message_preview` or `command_preview` and carries `last_error`+and a non-zero `last_exit_code`. Rows and `show` print `health` (and a watch's+`processing_health`) only when the verdict is not `healthy`, and failure+counters only when non-zero. A watch row adds `process_alive: false`+only when an enabled watch's observed waiter has exited; `vibe watch show`+prints the observed `process_alive` and `runtime`, and omits both when no waiter+has ever been observed. Task and watch add, update, pause, and resume print the+same `definition` as `show`, plus `warnings` when there are any.`vibe task show` and `vibe watch show` also read a removed definition: the sameprojection with `lifecycle_state: "removed"` and `removed_at`. Lists never@@ -643,7 +665,9 @@ views while preserving existing run history in SQLite. Prefer `vibe watch`over ad-hoc `nohup` jobs when theuser wants a managed background task with a guaranteed follow-up message.`--timeout` defaults to 21600 seconds; an explicit `--timeout 0` disables the-per-cycle timeout, while any positive value is persisted unchanged.+per-cycle timeout, while any positive value is persisted unchanged. A waiter exit+listed in `--retry-exit-code` means "still waiting": the watch records it as+`last_exit_code` and keeps `last_error` for real failures.### `vibe version`diff --git a/docs/CLI_ZH.md b/docs/CLI_ZH.mdindex eec5249e0..666898735 100644--- a/docs/CLI_ZH.md+++ b/docs/CLI_ZH.md@@ -23,6 +23,10 @@ list/marks、`vibe data query`、`vibe task list` 和 `vibe watch list`。默认绕过。使用 `pagination.next_command` 继续翻页;完整记录详情通过对应的 `show`或 `get` 命令获取。+列表行只携带决定下一步所需的字段,并省略 null、空值和零值字段,因此缺失的字段即表示+未设置。`vibe task show`、`vibe watch show`、`vibe runs show`、`vibe session get`+和 `vibe agent show` 输出完整记录;加上 `--brief` 则只输出对应 list 命令打印的那一行。+### Session 归属的列表`vibe harness status`、`vibe runs list`、`vibe task list`、`vibe watch list`@@ -345,7 +349,7 @@ vibe session update --title 'Release review' # 在 Avibe Agent s列出和查看 Agent run 记录。```bash-vibe runs list --brief # 在 Avibe Agent shell 内查看调用方 Session 的 run+vibe runs list # 在 Avibe Agent shell 内查看调用方 Session 的 runvibe runs list --global --definition-id <task-or-watch-id> # 跨每次运行各自的 Session 查看全部触发vibe runs show run_abc123vibe runs show run_abc123 --brief # 只看状态、时间、错误和回调字段@@ -384,8 +388,8 @@ vibe task remove <task-id>当 `vibe task add` 运行在 Avibe 已注入 caller context 的 Agent shell 内时,可以省略 `--session-id`。Avibe 会把任务目标默认到 `AVIBE_SESSION_ID`-对应的调用方 Session,并在命令输出里报告这次默认。显式 `--session-id`、-session creation 参数和 delivery 参数仍然优先。+对应的调用方 Session;输出的 definition 中的 `session_id` 就是解析后的目标。+显式 `--session-id`、session creation 参数和 delivery 参数仍然优先。纯命令任务(`--on-failure none`,即默认值)不会套用上面这条调用方 Session 默认,也不接受 session、scope 或 agent 相关参数。执行成功时完全静默;执行失败会记录一条@@ -450,6 +454,11 @@ Session、`--create-session` 或 fork)设置模型,该 Session 之后的轮会被拒绝;claude 和 codex 的未知值只给出警告,因为它们内置的目录可能落后于新版本。`vibe agent models <agent>` 会列出可用的值。+命令输出一个 `run` 对象:它的 `id`、`status`、`run_type`、`agent_name`,以及 Avibe+为它解析出的 `session_id`、`scope_id`、`visibility` 和 `callback_session_id`。+`--sync` 会用结束后的 run 记录替换它。只有当 run 落在调用方自己的 Session、+结果已直接回到那里因而不再回调时,才会附带 `callback_notice`。+异步 run 需要明确 callback 策略,除非命令运行在 Avibe 已注入 caller context的 Agent 环境内。当最终结果文本需要回到调用方 Session 时,使用`--callback-session-id`;当你有意不自动回调、后续会通过 `vibe runs show`@@ -498,15 +507,23 @@ vibe watch remove <watch-id>`vibe task list` 和 `vibe watch list` 默认读取调用方 Session(见[Session 归属的列表](#session-归属的列表)),每页返回 20 条定义;还有下一页时,-响应会包含 `pagination.next_command`。默认隐藏成功结束的一次性定义;使用+响应会包含 `pagination.next_command`。已启用的定义排在前面,每组内按最近活动时间倒序。+`--q <text>` 搜索与 Workbench 搜索相同的文本字段(id、名称、Agent、Session、message+和命令),并会带进 `next_command`。默认隐藏成功结束的一次性定义;使用`--include-finished` 分页查看历史。列表输出始终有上限,不提供无分页的 `--all` 模式。task 和 watch 命令用 `definition` 表示单条记录、用 `definitions` 表示列表,不会再通过命令专属别名重复输出同一份记录。-list 和 show 与 Workbench 读取同一份 Harness 投影:`lifecycle_state`、-`lifecycle_detail`、`next_run_at`、`waiting_since` 和 `running_since`;-watch 还会返回 `process_alive`。对 watch 来说,`process_alive: null`-表示从未观测到 waiter runtime,`false` 表示曾观测到的 waiter 已退出。-旧的 `state` 和 task 的 `last_status` 仅作为兼容展示字段保留,不定义 lifecycle。++list 和 show 与 Workbench 读取同一份 Harness 投影:`lifecycle_state` 就是 lifecycle;+已结束的定义带 `lifecycle_detail` 和 `lifecycle_finished_at`,仍在进行的定义带+`next_run_at`、`waiting_since` 或 `running_since`。列表行用 `message_preview` 或+`command_preview` 标识未命名的定义,并携带 `last_error` 和非零的 `last_exit_code`。+列表行和 `show` 只有当结论不是 `healthy` 时才输出 `health`(watch 还有+`processing_health`),失败计数只在非零时输出。+只有已启用 watch 的已观测 waiter 退出时,watch 行才会附带 `process_alive: false`;+`vibe watch show` 输出观测到的 `process_alive` 和 `runtime`,从未观测到 waiter 时两者都省略。+task 和 watch 的 add、update、pause、resume 输出与 `show` 相同的 `definition`,+有警告时再附带 `warnings`。`vibe task show` 和 `vibe watch show` 也能读取已删除的 definition:返回同一份投影,其中 `lifecycle_state: "removed"`,并带有 `removed_at`。列表从不包含已删除的@@ -522,7 +539,8 @@ watch 与 `vibe task`、`vibe agent run` 共用 `--session-id`、`--create-sessi只属于 `vibe task` 和 `vibe watch` 这类 stored definitions。需要可管理、可暂停、可查看的后台等待任务时,优先使用 `vibe watch`,不要随手起 `nohup`。`--timeout` 默认是 21600 秒;显式传入 `--timeout 0` 会关闭单次 cycle 的-超时限制,任何正数值都会原样持久化。+超时限制,任何正数值都会原样持久化。waiter 以 `--retry-exit-code` 中的退出码退出+表示“仍在等待”:watch 把它记录为 `last_exit_code`,`last_error` 只留给真正的失败。### `vibe version`diff --git a/docs/COMMANDS.md b/docs/COMMANDS.mdindex 328a19021..49117abea 100644--- a/docs/COMMANDS.md+++ b/docs/COMMANDS.md@@ -526,7 +526,9 @@ The `vibe` executable controls the local service and async automation features.All Agent-facing collection commands use `--page` / `--limit`, default to 20compact rows, and cap each page at 100. They never expose an unpaginated `--all`mode. Continue with `pagination.next_command`; inspect one record with its-`show` or `get` command.+`show` or `get` command. List rows omit null, empty, and zero-valued fields;+`--brief` on `vibe task show`, `vibe watch show`, `vibe runs show`,+`vibe session get`, and `vibe agent show` prints exactly the list row.## 5.1 Top-level CLI commands@@ -853,21 +855,22 @@ exists.### `vibe task list````bash-vibe task list [--session-id <id> | --global] [--include-finished] [--page N] [--limit N]+vibe task list [--session-id <id> | --global] [--include-finished] [--q <text>] [--page N] [--limit N]```Lists the caller Session's tasks inside an Avibe Agent shell; pass `--session-id`for another Session or `--global` for every Session (required outside an Agent-shell). Returns compact rows, 20 per page by default and at most 100. Use-`pagination.next_command` to continue; use `vibe task show <task_id>` for detail.-List and show expose the Workbench lifecycle projection. Watch rows additionally-include tri-state `process_alive`; compatibility `state` / `last_status` fields-do not define lifecycle.+shell). Returns compact rows, 20 per page by default and at most 100, enabled+tasks first and each group newest activity first. `--q` searches task text+fields. Use `pagination.next_command` to continue; use `vibe task show <task_id>`+for detail. List and show expose the Workbench lifecycle projection:+`lifecycle_state` is the lifecycle, and `health` appears only when it is not+`healthy`. `vibe watch list` follows the same contract.### `vibe task show````bash-vibe task show <task_id>+vibe task show <task_id> [--brief]```A removed task still reads here, with `lifecycle_state: "removed"` and@@ -910,7 +913,7 @@ creation; description, model, reasoning effort, and system prompt can be edited.| Subcommand | Purpose || --- | --- || `vibe agent list` | List Agents |-| `vibe agent show <name>` | Show one Agent |+| `vibe agent show <name> [--brief]` | Show one Agent || `vibe agent models [<name>]` | List available models + reasoning efforts for an Agent or backend || `vibe agent create` | Create an Agent || `vibe agent update <name>` | Edit mutable Agent fields |@@ -964,9 +967,9 @@ Important options:If neither `--session-id` nor a creation policy is provided, the run uses aprivate no-delivery session and is best suited for sub-agent style calls.-Runs are asynchronous by default: the command queues the run, returns a payload-with `run_id` / `session_id`, and uses the callback policy to deliver the final-result later. Use `--sync` only when the terminal should wait for completion.+Runs are asynchronous by default: the command queues the run, prints one `run`+object with its `id` and `session_id`, and uses the callback policy to deliver+the final result later. Use `--sync` only when the terminal should wait for completion.`--async` is still accepted for older scripts but is no longer required.`--close-after` applies to a new or forked Session. It releases that Agent@@ -1008,7 +1011,7 @@ direct Agent Run calls.| Subcommand | Purpose || --- | --- || `vibe runs list` | List the caller Session's recent runs; `--session-id <id>` for another Session, `--global` for every Session |-| `vibe runs show <run_id>` | Show one run |+| `vibe runs show <run_id> [--brief]` | Show one run || `vibe runs cancel <run_id>` | Request cancellation; once the run's input reached the live Session turn, this stops that turn like Session Stop, including other runs sharing it |## 6. Recommended Mental Modeldiff --git a/docs/COMMANDS_ZH.md b/docs/COMMANDS_ZH.mdindex 29371cbc2..11a079949 100644--- a/docs/COMMANDS_ZH.md+++ b/docs/COMMANDS_ZH.md@@ -504,6 +504,8 @@ bind vr-a3x9k2所有面向 Agent 的集合命令都使用 `--page` / `--limit`,默认返回 20 条紧凑记录,单页最多 100 条,并且不提供无分页的 `--all` 模式。按`pagination.next_command` 继续翻页;单条完整详情通过对应的 `show` 或 `get` 命令获取。+列表行省略 null、空值和零值字段;`vibe task show`、`vibe watch show`、`vibe runs show`、+`vibe session get` 和 `vibe agent show` 加上 `--brief` 时只输出对应的列表行。## 5.1 顶层 CLI 命令@@ -789,19 +791,20 @@ vibe task update <task_id> [options]### `vibe task list````bash-vibe task list [--session-id <id> | --global] [--include-finished] [--page N] [--limit N]+vibe task list [--session-id <id> | --global] [--include-finished] [--q <text>] [--page N] [--limit N]```在 Avibe Agent shell 内列出调用方 Session 的任务;用 `--session-id` 查看其他-Session,用 `--global` 查看所有 Session(在 Agent shell 之外必须二选一)。默认每页返回 20 条紧凑记录,单页最多 100 条。按 `pagination.next_command`-继续翻页;需要完整详情时使用 `vibe task show <task_id>`。-list 和 show 会返回与 Workbench 相同的 lifecycle 投影。watch 还包含三态的-`process_alive`;兼容字段 `state` / `last_status` 不定义 lifecycle。+Session,用 `--global` 查看所有 Session(在 Agent shell 之外必须二选一)。默认每页返回 20 条紧凑记录,单页最多 100 条,+已启用的任务排在前面,每组内按最近活动时间倒序。`--q` 搜索任务的文本字段。按+`pagination.next_command` 继续翻页;需要完整详情时使用 `vibe task show <task_id>`。+list 和 show 会返回与 Workbench 相同的 lifecycle 投影:`lifecycle_state` 就是 lifecycle,+只有结论不是 `healthy` 时才输出 `health`。`vibe watch list` 遵循同一契约。### `vibe task show````bash-vibe task show <task_id>+vibe task show <task_id> [--brief]```已删除的 task 仍可在这里读取,返回 `lifecycle_state: "removed"` 和 `removed_at`。@@ -843,7 +846,7 @@ model、reasoning effort、system prompt 可以编辑。| 子命令 | 作用 || --- | --- || `vibe agent list` | 列出 Agent |-| `vibe agent show <name>` | 查看单个 Agent |+| `vibe agent show <name> [--brief]` | 查看单个 Agent || `vibe agent models [<name>]` | 列出某个 Agent 或后端可用的模型与推理强度 || `vibe agent create` | 创建 Agent || `vibe agent update <name>` | 修改可编辑字段 |@@ -894,8 +897,8 @@ vibe agent run (--session-id <session_id> | --create-session | --fork-session <s如果不传 `--session-id` 或创建策略,run 会使用 privateno-delivery session,更适合 sub-agent 调用。-Run 默认异步:命令会队列化 run,立即返回包含 `run_id` / `session_id` 的-payload,并按 callback 策略稍后投递最终结果。只有终端需要等待完成时才使用+Run 默认异步:命令会队列化 run,立即输出一个带 `id` 和 `session_id` 的 `run`+对象,并按 callback 策略稍后投递最终结果。只有终端需要等待完成时才使用`--sync`。`--async` 仍兼容旧脚本,但不再需要显式传入。`--close-after` 适用于新建或 fork 的 Session。Run 结束后它会释放该 Agent@@ -931,7 +934,7 @@ Session、`--create-session` 或 fork)设置模型,该 Session 会沿用它| 子命令 | 作用 || --- | --- || `vibe runs list` | 列出调用方 Session 最近的 run;`--session-id <id>` 查看其他 Session,`--global` 查看所有 Session |-| `vibe runs show <run_id>` | 查看单个 run |+| `vibe runs show <run_id> [--brief]` | 查看单个 run || `vibe runs cancel <run_id>` | 请求取消 run;若该 run 的输入已进入正在运行的 Session turn,会像 Session Stop 一样停止整个 turn,同一 turn 中的其他 run 也会一起停止 |## 6. 推荐心智模型diff --git a/docs/plans/agent-run-callback-session.md b/docs/plans/agent-run-callback-session.mdindex eb05cb338..bf9645bd3 100644--- a/docs/plans/agent-run-callback-session.md+++ b/docs/plans/agent-run-callback-session.md@@ -99,17 +99,20 @@ Validation:- `--callback-session-id` is orthogonal to target Session selection and scopeplacement.-Output payload should include:+The accept payload is one `run` object, and the callback route lives on it:```json{- "callback_session_id": "ses...","run": {"callback_session_id": "ses..."}}```+`callback_notice` appears only when the route is not what the caller's flags+imply: a run on the caller's own Session, which gets no callback because the+result already lands there.+### Internal/API PayloadCarry `callback_session_id` through the same run-spec path as `session_id` anddiff --git a/docs/plans/agent-run-harness.md b/docs/plans/agent-run-harness.mdindex cea2d7183..1eea4bdca 100644--- a/docs/plans/agent-run-harness.md+++ b/docs/plans/agent-run-harness.md@@ -628,6 +628,8 @@ General rules:- `kind` identifies the returned object type, such as `agent_run`,`run_definition`, or `agent_runs`.- Human output may be shorter, but `--json` output should be stable.+- Records omit null, empty, and zero-valued fields; a Run is one `run` object,+ with no top-level copies of its fields.Synchronous Agent Run success:@@ -652,7 +654,6 @@ Asynchronous Agent Run accepted, or a synchronous run converted to async after{"schema_version": 1,"ok": true,- "accepted": true,"kind": "agent_run","run": {"id": "run123",@@ -678,8 +679,7 @@ Task/Watch definition creation success:"session_id": "sesnew12345","scope_id": "slack::channel::C123","next_run_at": "2026-06-01T09:00:00+08:00"- },- "warnings": []+ }}```@@ -690,10 +690,6 @@ Task/Watch definition creation success:"schema_version": 1,"ok": true,"kind": "agent_run",- "definition": {- "id": "def123",- "definition_type": "scheduled"- },"run": {"id": "run123","status": "queued",@@ -718,12 +714,8 @@ Task/Watch definition creation success:"source_kind": "cli","agent_name": "release-reviewer","session_id": "sesnew12345",- "definition_id": null,"created_at": "2026-05-21T17:00:00Z",- "started_at": "2026-05-21T17:00:03Z",- "completed_at": null,- "result_text": null,- "error": null+ "started_at": "2026-05-21T17:00:03Z"}}```@@ -742,7 +734,6 @@ Task/Watch definition creation success:"status": "running","agent_name": "release-reviewer","session_id": "sesnew12345",- "definition_id": null,"created_at": "2026-05-21T17:00:00Z"}]diff --git a/docs/plans/agent-run-harness.zh.md b/docs/plans/agent-run-harness.zh.mdindex 0e2398bf6..df780fb29 100644--- a/docs/plans/agent-run-harness.zh.md+++ b/docs/plans/agent-run-harness.zh.md@@ -596,6 +596,7 @@ JSON 输出应作为 agents 和 scripts 的稳定契约。- 顶层必须有 `schema_version`、`ok`、`kind`。- `kind` 表达返回对象类型,例如 `agent_run`、`run_definition`、`agent_runs`。- 人类可读输出可以更短,但 `--json` 输出必须稳定。+- 记录省略 null、空值和零值字段;一个 Run 就是一个 `run` 对象,顶层不再重复它的字段。同步 Agent Run 成功:@@ -619,7 +620,6 @@ JSON 输出应作为 agents 和 scripts 的稳定契约。{"schema_version": 1,"ok": true,- "accepted": true,"kind": "agent_run","run": {"id": "run123",@@ -645,8 +645,7 @@ Task/Watch definition 创建成功:"session_id": "sesnew12345","scope_id": "slack::channel::C123","next_run_at": "2026-06-01T09:00:00+08:00"- },- "warnings": []+ }}```@@ -657,10 +656,6 @@ Task/Watch definition 创建成功:"schema_version": 1,"ok": true,"kind": "agent_run",- "definition": {- "id": "def123",- "definition_type": "scheduled"- },"run": {"id": "run123","status": "queued",@@ -685,12 +680,8 @@ Task/Watch definition 创建成功:"source_kind": "cli","agent_name": "release-reviewer","session_id": "sesnew12345",- "definition_id": null,"created_at": "2026-05-21T17:00:00Z",- "started_at": "2026-05-21T17:00:03Z",- "completed_at": null,- "result_text": null,- "error": null+ "started_at": "2026-05-21T17:00:03Z"}}```@@ -709,7 +700,6 @@ Task/Watch definition 创建成功:"status": "running","agent_name": "release-reviewer","session_id": "sesnew12345",- "definition_id": null,"created_at": "2026-05-21T17:00:00Z"}]diff --git a/docs/plans/cli-query-pagination.md b/docs/plans/cli-query-pagination.mdindex 66d3ee167..5323f6af2 100644--- a/docs/plans/cli-query-pagination.md+++ b/docs/plans/cli-query-pagination.md@@ -41,7 +41,16 @@ All list/query commands should return:- `pagination.next_page`- `pagination.next_command`-Text output should append a concise "more records" hint when `has_more` is true.+`pagination.next_command` is the only continuation: no top-level prose repeats+it. A page whose command cannot be replayed (SQL piped on stdin, which has no+`next_command`) adds one `message` telling the caller to add `--page`.++### Task and Watch Lists++`vibe task list` and `vibe watch list` take `--q` with the same substring+semantics as `vibe runs list --q`, searching the store's definition text fields+(the Workbench search), and carry it into `next_command`. Enabled definitions+come first, each group ordered by most recent activity.### Runs Listdiff --git a/scripts/terminal_bench/runner.py b/scripts/terminal_bench/runner.pyindex 530d53ffd..29d1f36cb 100644--- a/scripts/terminal_bench/runner.py+++ b/scripts/terminal_bench/runner.py@@ -340,7 +340,7 @@ class FullRuntimeTrial:# Expiry of a CLI waiter does not cancel an Agent turn.accepted = self._call("cli", "agent", "run", "--agent", "vibey", "--cwd", str(self.workdir),"--message-file", str(instruction_path), "--no-callback")- run_id, session_id = accepted["run_id"], accepted["session_id"]+ run_id, session_id = accepted["run"]["id"], accepted["run"]["session_id"]self._result.update(run_id=run_id, session_id=session_id)deadline = time.monotonic() + self.profile.wall_secondsterminal_row = Nonediff --git a/skills/use-avibe-harness/SKILL.md b/skills/use-avibe-harness/SKILL.mdindex da4182cd0..9838ffe9d 100644--- a/skills/use-avibe-harness/SKILL.md+++ b/skills/use-avibe-harness/SKILL.md@@ -77,7 +77,7 @@ Use `vibe session update --visible|--hidden` (`--visibility foreground|backgrounFor tasks, use `--message "..."` or `--message-file <path>` as the stored message. For watches, use `--message "..."` or `--message-file <path>` as the follow-up instruction template sent with waiter output. Prefer `--same-scope` or `--scope-id <scopes.id>` for new Session placement.-Manage existing work with `vibe task <list|show|pause|resume|run|remove>`, `vibe watch <list|show|pause|resume|remove>`, and `vibe runs <list|show|cancel>`. Use `vibe harness status` for one unified live/anomaly snapshot. These lists cover this Session unless you pass `--session-id <id>` or `--global`. `vibe runs show` can default to the current Run from the injected environment; `vibe runs cancel` still requires an explicit run id; once that run's input reached the live Session turn, it stops the whole turn like Session Stop, including other runs sharing it.+Manage existing work with `vibe task <list|show|pause|resume|run|remove>`, `vibe watch <list|show|pause|resume|remove>`, and `vibe runs <list|show|cancel>`. Use `vibe harness status` for one unified live/anomaly snapshot. These lists cover this Session unless you pass `--session-id <id>` or `--global`. List rows carry only the fields needed to decide the next step and omit unset ones; find a definition by text with `vibe watch list --q <text>` (for example a PR number) instead of filtering output yourself, and add `--brief` to a `show` command for just its list row. `vibe agent run` prints one `run` object, so read its id from `run.id`. `vibe runs show` can default to the current Run from the injected environment; `vibe runs cancel` still requires an explicit run id; once that run's input reached the live Session turn, it stops the whole turn like Session Stop, including other runs sharing it.The CLI exposes more options than this prompt lists. Before creating or changing Harness state, or whenever syntax/runtime effects are uncertain, read the relevant help: `vibe <command> --help` or `vibe <command> <subcommand> --help`.diff --git a/skills/use-avibe/references/harness.md b/skills/use-avibe/references/harness.mdindex aedf4b7c7..cdddfba28 100644--- a/skills/use-avibe/references/harness.md+++ b/skills/use-avibe/references/harness.md@@ -30,7 +30,7 @@ Preferred CLI shape:- managed background watch for this conversation: `vibe watch add --message '...' -- <cmd>` (or `--shell '<cmd>'` to pass a single shell string)- watch that creates a visible sibling Session: `vibe watch add --create-session --same-scope --message '...' -- <cmd>`- update a watch: `vibe watch update <id> --name '...' --timeout 1200`-- inspect a run: `vibe runs show <run-id>`; add `--brief` for only its status, timing, error, and callback fields+- inspect a run: `vibe runs show <run-id>`; add `--brief` to print only its `vibe runs list` row- cancel a run: `vibe runs cancel <run-id>`Targeting and callbacks:@@ -62,6 +62,10 @@ Operational guidance:- use `vibe task update <id>` to keep the same task ID while changing name, schedule, message, agent, or target- use `vibe watch update <id> ...` when you must rename, retarget, or change the waiter/options- Agent-facing collection commands return 20 compact rows per page, cap `--limit` at 100, and have no unpaginated `--all` mode; follow `pagination.next_command` when more rows exist+- list rows omit null, empty, and zero-valued fields, so a missing key means unset; `--brief` on `vibe task show`, `vibe watch show`, `vibe runs show`, `vibe session get`, or `vibe agent show` prints exactly the list row+- find a task or watch by text with `vibe task list --q <text>` or `vibe watch list --q <text>`; enabled definitions come first, newest activity first+- `vibe agent run` and `vibe task run` print one `run` object; read the Run id from `run.id`+- read lifecycle from `lifecycle_state`; `health` appears only when it is not `healthy`, and a watch's configured retry exit shows as `last_exit_code` with no `last_error`- read task/watch records from `definition` for detail commands and `definitions` for list commands; command-specific duplicate aliases are not emitted- use `--include-finished` for paginated task/watch one-shot history- both list commands hide successful one-shot definitions by default while failures stay visible; use `--include-finished` and follow `pagination.next_command` for bounded historydiff --git a/storage/background.py b/storage/background.pyindex b09195f28..3c5fc4963 100644--- a/storage/background.py+++ b/storage/background.py@@ -3452,10 +3452,12 @@ class SQLiteBackgroundTaskStore:"",)if enabled_first:- # Offset pagination needs a persisted ordering key. Lifecycle can- # change when the clock crosses run_at between page requests.+ # Enabled rows lead, each group newest activity first, so the rows an+ # Agent most likely means sit on page 1. Both keys are stored columns:+ # lifecycle is derived and can change when the clock crosses run_at+ # between page requests.enabled_rank = case((run_definitions.c.enabled != 0, 0), else_=1)- stmt = stmt.order_by(enabled_rank, run_definitions.c.created_at, run_definitions.c.id)+ stmt = stmt.order_by(enabled_rank, activity.desc(), run_definitions.c.id.desc())elif newest_first:stmt = stmt.order_by(activity.desc(), run_definitions.c.id.desc())else:@@ -3719,10 +3721,12 @@ class SQLiteBackgroundTaskStore:"",)if enabled_first:- # Runtime and execution state may change between pages; the stored- # switch keeps the list order stable while those facts are enriched.+ # Enabled rows lead, each group newest activity first, so the rows an+ # Agent most likely means sit on page 1. Both keys are stored columns:+ # lifecycle is derived and can change when the clock crosses run_at+ # between page requests.enabled_rank = case((run_definitions.c.enabled != 0, 0), else_=1)- stmt = stmt.order_by(enabled_rank, run_definitions.c.created_at, run_definitions.c.id)+ stmt = stmt.order_by(enabled_rank, activity.desc(), run_definitions.c.id.desc())elif newest_first:stmt = stmt.order_by(activity.desc(), run_definitions.c.id.desc())else:diff --git a/tests/test_cli_agent_run_schema.py b/tests/test_cli_agent_run_schema.pyindex ffdd39afa..6dc07ca51 100644--- a/tests/test_cli_agent_run_schema.py+++ b/tests/test_cli_agent_run_schema.py@@ -1,11 +1,9 @@"""Snapshot test for ``vibe agent run --json`` output schema.-C2 of the services-layer refactor moves CLI's session reservation off-``storage.sessions_service.SQLiteSessionsService`` and onto-``core.services.sessions``. The CLI's JSON output shape is the public-contract callers (and scheduled tasks, watch hooks, downstream tools)-depend on — Q8 in the design doc commits to keeping it byte-stable-through the refactor.+The accept payload is one ``run`` object: what Avibe resolved for the caller+(the Run id, its Session, scope, visibility and callback route). Anything the+caller's own flags already decided stays out, and ``callback_notice`` appears+only when the callback route is not what those flags imply.This test pins the **keys** in the ``agent_run`` envelope. Values likerun ids and session ids are non-deterministic so we check key presence /@@ -44,27 +42,7 @@ def _clear_caller_env(monkeypatch):monkeypatch.delenv(key, raising=False)-_EXPECTED_KEYS = {- "schema_version",- "ok",- "kind",- "accepted",- "request_type",- "run_id",- "execution_id",- "agent",- "session_policy",- "session_id",- "deliver_key",- "scope_id",- "visibility",- "callback_session_id",- "caller_context",- "callback_notice",- "close_after",- "async",- "run",-}+_EXPECTED_KEYS = {"schema_version", "ok", "kind", "run"}_EXPECTED_RUN_KEYS_QUEUED = {"id",@@ -72,13 +50,7 @@ _EXPECTED_RUN_KEYS_QUEUED = {"run_type","agent_name","session_id",- "scope_id","visibility",- "callback_session_id",- "source_kind",- "source_actor",- "parent_run_id",- "close_after",}@@ -114,11 +86,6 @@ def test_agent_run_default_async_envelope_schema(tmp_path: Path, capsys) -> Noneassert payload["schema_version"] == 1assert payload["ok"] is Trueassert payload["kind"] == "agent_run"- assert payload["async"] is True- assert payload["request_type"] == "agent_run"- assert payload["callback_session_id"] is None- assert payload["caller_context"] is None- assert payload["callback_notice"]["code"] == "async_run_without_callback"run = payload["run"]assert set(run.keys()) == _EXPECTED_RUN_KEYS_QUEUED, (@@ -127,12 +94,8 @@ def test_agent_run_default_async_envelope_schema(tmp_path: Path, capsys) -> Noneassert run["status"] == "queued"assert run["run_type"] == "agent_run"assert run["agent_name"] == "worker"- assert run["id"] == payload["run_id"]- assert run["source_kind"] == "cli"- assert run["source_actor"] is None- assert run["parent_run_id"] is None- assert payload["close_after"] is False- assert run["close_after"] is False+ stored = request_store.get_run(run["id"])+ assert stored is not None and stored["source_kind"] == "cli"def test_agent_run_close_after_is_persisted_for_new_session(@@ -157,9 +120,7 @@ def test_agent_run_close_after_is_persisted_for_new_session(assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["close_after"] is True- assert payload["run"]["close_after"] is True- stored = request_store.get_run(payload["run_id"])+ stored = request_store.get_run(payload["run"]["id"])assert stored is not Noneassert stored["metadata"]["close_after"] is True@@ -260,7 +221,6 @@ def test_agent_run_explicit_async_flag_remains_compatible(tmp_path: Path, capsysassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["async"] is Trueassert payload["run"]["status"] == "queued"@@ -332,9 +292,9 @@ def test_agent_run_async_accepts_callback_session_id(tmp_path: Path, capsys) ->assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["callback_session_id"] == callback_session["id"]assert payload["run"]["callback_session_id"] == callback_session["id"]- stored = request_store.get_run(payload["run_id"])+ assert payload["run"]["callback_session_id"] == callback_session["id"]+ stored = request_store.get_run(payload["run"]["id"])assert stored is not Noneassert stored["callback_session_id"] == callback_session["id"]assert stored["callback_status"] == "pending"@@ -444,19 +404,10 @@ def test_agent_run_async_defaults_callback_from_caller_env(tmp_path: Path, capsyassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["callback_session_id"] == caller_session["id"]- assert payload["caller_context"] == {- "session_id": caller_session["id"],- "run_id": "run-parent",- "source": "agent_run",- "backend": "codex",- "native_session_id": "thread-caller",- }- assert payload["callback_notice"]["code"] == "callback_defaulted_to_caller_session"- assert payload["run"]["source_kind"] == "agent"- assert payload["run"]["source_actor"] == caller_session["id"]- assert payload["run"]["parent_run_id"] == "run-parent"- stored = request_store.get_run(payload["run_id"])+ assert payload["run"]["callback_session_id"] == caller_session["id"]+ # run.callback_session_id already says the result returns here.+ assert "callback_notice" not in payload+ stored = request_store.get_run(payload["run"]["id"])assert stored is not Noneassert stored["callback_session_id"] == caller_session["id"]assert stored["source_kind"] == "agent"@@ -535,9 +486,7 @@ def test_agent_run_send_now_is_explicit_p1_on_an_existing_session(assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["delivery_intent"] == "steer"- assert payload["run"]["delivery_intent"] == "steer"- stored = request_store.get_run(payload["run_id"])+ stored = request_store.get_run(payload["run"]["id"])assert stored is not Noneassert stored["session_id"] == session_idassert stored["metadata"]["delivery_intent"] == "steer"@@ -633,9 +582,7 @@ def test_agent_run_queue_persists_explicit_p3_intent(assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["delivery_intent"] == "queue"- assert payload["run"]["delivery_intent"] == "queue"- stored = request_store.get_run(payload["run_id"])+ stored = request_store.get_run(payload["run"]["id"])assert stored is not Noneassert stored["metadata"]["delivery_intent"] == "queue"@@ -712,9 +659,8 @@ def test_agent_run_send_now_accepts_an_im_backed_session(assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["session_id"] == session["id"]- assert payload["delivery_intent"] == "steer"- stored = request_store.get_run(payload["run_id"])+ assert payload["run"]["session_id"] == session["id"]+ stored = request_store.get_run(payload["run"]["id"])assert stored is not Noneassert stored["metadata"]["delivery_intent"] == "steer"@@ -788,9 +734,9 @@ def test_agent_run_async_self_target_defaults_to_no_callback(assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["callback_session_id"] is None+ assert "callback_session_id" not in payload["run"]assert payload["callback_notice"]["code"] == "async_self_run_without_callback"- stored = request_store.get_run(payload["run_id"])+ stored = request_store.get_run(payload["run"]["id"])assert stored is not Noneassert stored["callback_session_id"] is Noneassert stored["callback_status"] is None@@ -862,8 +808,8 @@ def test_agent_run_sync_self_target_detach_defaults_to_no_callback(patch("vibe.cli.paths.get_sqlite_state_path", return_value=db_path),patch("vibe.cli._wait_for_run_result",- return_value={- "id": "still-running",+ side_effect=lambda _store, run_id, **_kwargs: {+ "id": run_id,"status": "running","wait_state": "detached","handoff_reason": "wait_limit_reached",@@ -874,10 +820,10 @@ def test_agent_run_sync_self_target_detach_defaults_to_no_callback(assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["callback_session_id"] is None+ assert "callback_session_id" not in payload["run"]assert payload["callback_notice"]["code"] == "async_self_run_without_callback"assert payload["run"].get("callback_status") is None- stored = request_store.get_run(payload["run_id"])+ stored = request_store.get_run(payload["run"]["id"])assert stored is not Noneassert stored["callback_session_id"] is Noneassert stored["callback_status"] is None@@ -937,15 +883,17 @@ def test_agent_run_callback_session_records_sync_route(tmp_path: Path, capsys) -patch("vibe.cli._task_request_store", return_value=request_store),patch("vibe.cli.paths.get_sqlite_state_path", return_value=db_path),patch("vibe.cli._primary_platform", return_value="slack"),- patch("vibe.cli._wait_for_run_result", return_value={"id": "done", "status": "succeeded"}),+ patch(+ "vibe.cli._wait_for_run_result",+ side_effect=lambda _store, run_id, **_kwargs: {"id": run_id, "status": "succeeded"},+ ),):result = cli.cmd_agent_run(args)assert result == 0captured = capsys.readouterr()payload = json.loads(captured.out)- assert payload["callback_session_id"] == callback_session["id"]- stored = request_store.get_run(payload["run_id"])+ stored = request_store.get_run(payload["run"]["id"])assert stored is not Noneassert stored["callback_session_id"] == callback_session["id"]assert stored["callback_status"] is None@@ -975,9 +923,9 @@ def test_agent_run_sync_waits_for_run_result(tmp_path: Path, capsys) -> None:assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["async"] is Falseassert payload["run"] == {"id": "done", "status": "succeeded"}- assert wait_calls == [(payload["run_id"], None)]+ assert len(wait_calls) == 1 and wait_calls[0][1] is None+ assert request_store.get_run(wait_calls[0][0]) is not Nonedef test_agent_run_sync_wait_timeout_is_passed_to_waiter(tmp_path: Path, capsys) -> None:@@ -1004,8 +952,6 @@ def test_agent_run_sync_wait_timeout_is_passed_to_waiter(tmp_path: Path, capsys)result = cli.cmd_agent_run(args)assert result == 0- payload = json.loads(capsys.readouterr().out)- assert payload["async"] is Falseassert wait_timeouts == [2.5]@@ -1065,7 +1011,10 @@ def test_agent_run_callback_session_records_sync_route_in_sqlite_store(tmp_path:patch("vibe.cli.paths.get_sqlite_state_path", return_value=db_path),patch("vibe.cli.paths.get_state_dir", return_value=state_home / "state"),patch("vibe.cli._primary_platform", return_value="slack"),- patch("vibe.cli._wait_for_run_result", return_value={"id": "done", "status": "succeeded"}),+ patch(+ "vibe.cli._wait_for_run_result",+ side_effect=lambda _store, run_id, **_kwargs: {"id": run_id, "status": "succeeded"},+ ),):result = cli.cmd_agent_run(args)@@ -1074,7 +1023,7 @@ def test_agent_run_callback_session_records_sync_route_in_sqlite_store(tmp_path:with create_sqlite_engine(db_path).connect() as conn:row = conn.execute(select(agent_runs.c.callback_session_id, agent_runs.c.callback_status)- .where(agent_runs.c.id == payload["run_id"])+ .where(agent_runs.c.id == payload["run"]["id"]).limit(1)).mappings().one()assert row["callback_session_id"] == callback_session["id"]@@ -1140,8 +1089,8 @@ def test_agent_run_sync_detach_marks_callback_pending(tmp_path: Path, capsys) ->patch("vibe.cli._primary_platform", return_value="slack"),patch("vibe.cli._wait_for_run_result",- return_value={- "id": "still-running",+ side_effect=lambda _store, run_id, **_kwargs: {+ "id": run_id,"status": "running","wait_state": "detached","handoff_reason": "wait_limit_reached",@@ -1156,7 +1105,7 @@ def test_agent_run_sync_detach_marks_callback_pending(tmp_path: Path, capsys) ->with create_sqlite_engine(db_path).connect() as conn:row = conn.execute(select(agent_runs.c.callback_status, agent_runs.c.callback_completed_at)- .where(agent_runs.c.id == payload["run_id"])+ .where(agent_runs.c.id == payload["run"]["id"]).limit(1)).mappings().one()assert row["callback_status"] == "pending"@@ -1313,11 +1262,9 @@ def test_agent_run_fork_session_reserves_new_session_and_persists_metadata(tmp_passert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["session_policy"] == "fork"- assert payload["forked_from_session_id"] == source_session_id- assert payload["session_id"] != source_session_id+ assert payload["run"]["session_id"] != source_session_id- run = request_store.get_run(payload["run_id"])+ run = request_store.get_run(payload["run"]["id"])assert run is not Noneassert run["metadata"]["session_fork"]["source_native_session_id"] == "thread-source"assert run["model"] == "gpt-5.2"@@ -1327,7 +1274,7 @@ def test_agent_run_fork_session_reserves_new_session_and_persists_metadata(tmp_ptry:with engine.connect() as conn:row = conn.execute(- select(agent_sessions).where(agent_sessions.c.id == payload["session_id"])+ select(agent_sessions).where(agent_sessions.c.id == payload["run"]["session_id"])).mappings().one()finally:engine.dispose()@@ -1337,7 +1284,7 @@ def test_agent_run_fork_session_reserves_new_session_and_persists_metadata(tmp_passert row["model"] == "gpt-5.2"assert row["reasoning_effort"] == "low"assert row["scope_id"] == "avibe::project::proj_fork_cli"- assert row["session_anchor"] == payload["session_id"]+ assert row["session_anchor"] == payload["run"]["session_id"]def test_agent_run_fork_self_uses_caller_session_and_inherits_scope(tmp_path: Path, capsys) -> None:@@ -1377,14 +1324,13 @@ def test_agent_run_fork_self_uses_caller_session_and_inherits_scope(tmp_path: Paassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["forked_from_session_id"] == source_session_id- assert payload["scope_id"] == "avibe::project::proj_fork_cli"+ assert payload["run"]["scope_id"] == "avibe::project::proj_fork_cli"engine = create_sqlite_engine(db_path)try:with engine.connect() as conn:row = conn.execute(- select(agent_sessions).where(agent_sessions.c.id == payload["session_id"])+ select(agent_sessions).where(agent_sessions.c.id == payload["run"]["session_id"])).mappings().one()finally:engine.dispose()@@ -1422,13 +1368,13 @@ def test_agent_run_create_same_scope_snapshots_scope_workdir(tmp_path: Path, capassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["scope_id"] == "avibe::project::proj_fork_cli"+ assert payload["run"]["scope_id"] == "avibe::project::proj_fork_cli"engine = create_sqlite_engine(db_path)try:with engine.connect() as conn:row = conn.execute(- select(agent_sessions).where(agent_sessions.c.id == payload["session_id"])+ select(agent_sessions).where(agent_sessions.c.id == payload["run"]["session_id"])).mappings().one()finally:engine.dispose()@@ -1571,13 +1517,13 @@ def test_agent_run_create_scope_id_snapshots_scope_workdir(tmp_path: Path, capsyassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["scope_id"] == "avibe::project::proj_fork_cli"+ assert payload["run"]["scope_id"] == "avibe::project::proj_fork_cli"engine = create_sqlite_engine(db_path)try:with engine.connect() as conn:row = conn.execute(- select(agent_sessions).where(agent_sessions.c.id == payload["session_id"])+ select(agent_sessions).where(agent_sessions.c.id == payload["run"]["session_id"])).mappings().one()finally:engine.dispose()@@ -1765,8 +1711,6 @@ def test_only_fork_self_is_the_agents_own_fork(tmp_path: Path, capsys, flags, seresult = cli.cmd_agent_run(args)assert result == 0- payload = json.loads(capsys.readouterr().out)- assert payload["forked_from_session_id"] == source_session_idassert reserve.call_args.kwargs["self_fork"] is self_fork@@ -1832,8 +1776,8 @@ def test_agent_run_callerless_session_workdir_uses_show_workspace(tmp_path: Pathassert result == 0payload = json.loads(capsys.readouterr().out)- expected = state_home / "show" / payload["session_id"]- assert _read_session_workdir(db_path, payload["session_id"]) == str(expected)+ expected = state_home / "show" / payload["run"]["session_id"]+ assert _read_session_workdir(db_path, payload["run"]["session_id"]) == str(expected)assert expected.is_dir()@@ -1866,7 +1810,7 @@ def test_agent_run_explicit_cwd_wins(tmp_path: Path, capsys, monkeypatch) -> Nonassert result == 0payload = json.loads(capsys.readouterr().out)- assert _read_session_workdir(db_path, payload["session_id"]) == str(picked_dir)+ assert _read_session_workdir(db_path, payload["run"]["session_id"]) == str(picked_dir)def test_agent_run_cwd_must_exist(tmp_path: Path, capsys) -> None:diff --git a/tests/test_cli_definition_read_projection.py b/tests/test_cli_definition_read_projection.pyindex 89d301cc7..27fed0d57 100644--- a/tests/test_cli_definition_read_projection.py+++ b/tests/test_cli_definition_read_projection.py@@ -1,9 +1,11 @@from __future__ import annotationsimport json+import sysfrom datetime import datetime, timedelta, timezonefrom types import SimpleNamespace+import pytestfrom sqlalchemy import select, updatefrom storage.background import (@@ -180,23 +182,22 @@ def test_cli_and_workbench_share_the_definition_read_projection(capsys) -> None:)assert _canonical(cli_task_detail) == _canonical(api_tasks["queued-disabled"])assert cli_tasks["queued-disabled"]["lifecycle_state"] == "running"- assert cli_tasks["queued-disabled"]["running_since"] is None- assert cli_tasks["queued-disabled"]["state"] == "active"+ assert "running_since" not in cli_tasks["queued-disabled"]for watch_id in api_watches:- assert _canonical(cli_watches[watch_id], watch=True) == _canonical(- api_watches[watch_id], watch=True- )+ assert _canonical(cli_watches[watch_id]) == _canonical(api_watches[watch_id])assert _canonical(cli_watch_detail, watch=True) == _canonical(api_watches["waiting-live"], watch=True)assert cli_watch_detail["runtime"]["pid"] == 1234- assert cli_unknown_watch_detail["process_alive"] is None- assert cli_unknown_watch_detail["runtime"] == {}+ # Never observed: neither liveness nor a heartbeat to print.+ assert {"process_alive", "runtime"}.isdisjoint(cli_unknown_watch_detail)assert api_watches["waiting-never"]["runtime"] == {}+ # A list row names liveness only when it needs attention: an enabled+ # watch whose observed waiter exited.expected = {- "waiting-live": ("waiting", None, True),+ "waiting-live": ("waiting", None, None),"waiting-dead": ("waiting", None, False),"waiting-never": ("waiting", None, None),"paused": ("paused", None, None),@@ -207,21 +208,14 @@ def test_cli_and_workbench_share_the_definition_read_projection(capsys) -> None:actual = {watch_id: (row["lifecycle_state"],- row["lifecycle_detail"],- row["process_alive"],+ row.get("lifecycle_detail"),+ row.get("process_alive"),)for watch_id, row in cli_watches.items()}assert actual == expected- assert cli_watches["waiting-live"]["state"] == "running"- assert cli_watches["waiting-live"]["waiting_since"] == NOW- assert cli_watches["waiting-dead"]["state"] == "pending"- assert cli_watches["waiting-dead"]["waiting_since"] == NOW- assert cli_watches["waiting-never"]["state"] == "pending"- assert cli_watches["waiting-never"]["waiting_since"] == NOW- assert cli_watches["finished-normal"]["state"] == "completed"- assert cli_watches["finished-timeout"]["state"] == "failed"- assert cli_watches["finished-error"]["state"] == "failed"+ for watch_id in ("waiting-live", "waiting-dead", "waiting-never"):+ assert cli_watches[watch_id]["waiting_since"] == NOWassert _rows(store, run_definitions) == before_definitionsassert _rows(store, agent_runs) == before_runs@@ -268,6 +262,7 @@ def test_task_list_pagination_is_stable_across_run_at_boundary(capsys) -> None:cron=None,run_at=FUTURE,created_at="2026-07-27T12:00:00+00:00",+ updated_at="2026-07-27T12:01:00+00:00",)_task(store, "still-waiting", created_at="2026-07-27T12:01:00+00:00")@@ -377,16 +372,14 @@ def test_task_list_and_show_keep_unverifiable_retirements_unknown(capsys) -> Nonassert by_id["manual-run"]["lifecycle_state"] == "waiting"for task_id in ("legacy-ownerless", "consumed-owner-missing"):assert by_id[task_id]["lifecycle_state"] == "finished"- assert by_id[task_id]["lifecycle_detail"] is None- assert by_id[task_id]["state"] == "unknown"+ assert "lifecycle_detail" not in by_id[task_id]assert cli.cmd_task_show(task_id) == 0shown = json.loads(capsys.readouterr().out)["definition"]- assert (shown["lifecycle_detail"], shown["state"]) == (None, "unknown")+ assert (shown["lifecycle_state"], "lifecycle_detail" in shown) == ("finished", False)assert by_id["consumed-owner-success"]["lifecycle_detail"] == "normal"- assert by_id["consumed-owner-success"]["state"] == "completed"assert cli.cmd_task_show("consumed-owner-success") == 0shown = json.loads(capsys.readouterr().out)["definition"]- assert (shown["lifecycle_detail"], shown["state"]) == ("normal", "completed")+ assert shown["lifecycle_detail"] == "normal"finally:store.close()@@ -489,9 +482,76 @@ def test_public_metadata_nonobjects_degrade_without_rewriting_rows(capsys):assert response.status_code == 200assert response.get_json()[plural][0]["metadata"] == {}assert command(identifier) == 0- assert json.loads(capsys.readouterr().out)[field]["metadata"] == {}+ assert "metadata" not in json.loads(capsys.readouterr().out)[field]with store.engine.connect() as conn:assert conn.execute(select(run_definitions.c.metadata_json)).scalars().all() == [encoded, encoded]assert conn.execute(select(agent_runs.c.metadata_json)).scalar_one() == encodedfinally:store.close()++[email protected]("kind", ["task", "watch"])+def test_definition_list_q_searches_and_carries_into_next_command(kind, capsys, monkeypatch) -> None:+ """Agents find a definition by its text instead of filtering pages themselves."""++ add = _task if kind == "task" else _watch+ store = SQLiteBackgroundTaskStore()+ try:+ for index in range(3):+ add(store, f"{kind}-pr-{index}", name=f"Watch PR 2961 round {index}")+ add(store, f"{kind}-other", name="Nightly sync")+ finally:+ store.close()++ monkeypatch.setattr(sys, "argv", ["vibe", kind, "list", "--global", "--q", "2961", "--limit", "2"])+ with pytest.raises(SystemExit) as exc:+ cli.main()++ assert exc.value.code == 0+ payload = json.loads(capsys.readouterr().out)+ assert [row["name"] for row in payload["definitions"]] == [+ "Watch PR 2961 round 2",+ "Watch PR 2961 round 1",+ ]+ assert payload["pagination"]["next_command"] == (+ f"vibe {kind} list --global --q 2961 --page 2 --limit 2"+ )++[email protected]("kind", ["task", "watch"])+def test_definition_show_brief_is_the_list_row_and_show_drops_legacy_keys(kind, capsys) -> None:+ add = _task if kind == "task" else _watch+ store = SQLiteBackgroundTaskStore()+ try:+ add(+ store,+ f"{kind}-legacy",+ message="Report the result.",+ session_key="slack::channel::C123",+ post_to="channel",+ deliver_key="slack::channel::C123",+ )+ finally:+ store.close()+ list_command = cli.cmd_task_list if kind == "task" else cli.cmd_watch_list+ show_command = cli.cmd_task_show if kind == "task" else cli.cmd_watch_show++ assert list_command(scope=cli.SessionListScope()) == 0+ row = json.loads(capsys.readouterr().out)["definitions"][0]+ assert show_command(f"{kind}-legacy", brief=True) == 0+ assert json.loads(capsys.readouterr().out)["definition"] == row++ assert show_command(f"{kind}-legacy") == 0+ shown = json.loads(capsys.readouterr().out)["definition"]+ assert shown["message"] == "Report the result."+ assert {+ "state",+ "last_status",+ "display_name",+ "prompt",+ "prefix",+ "session_key",+ "post_to",+ "deliver_key",+ "session_platform",+ }.isdisjoint(shown)diff --git a/tests/test_cli_pagination.py b/tests/test_cli_pagination.pyindex d6dd312ad..d09b273aa 100644--- a/tests/test_cli_pagination.py+++ b/tests/test_cli_pagination.py@@ -1,6 +1,8 @@from __future__ import annotationsimport argparse+import contextlib+import ioimport jsonimport reimport shlex@@ -170,6 +172,31 @@ def test_managed_harness_session_queue_commands_name_real_subcommands() -> None:assert path == expected_path+ ("argv", "accepted"),+ [+ (["task", "show", "t1", "--brief"], True),+ (["watch", "show", "w1", "--brief"], True),+ (["runs", "show", "r1", "--brief"], True),+ (["session", "get", "--brief"], True),+ (["agent", "show", "worker", "--brief"], True),+ (["task", "list", "--brief"], False),+ (["watch", "list", "--brief"], False),+ (["runs", "list", "--brief"], False),+ (["agent", "list", "--brief"], False),+ ],+)+def test_brief_selects_the_list_row_on_show_and_is_not_a_list_flag(argv, accepted) -> None:+ """``--brief`` means "print this record's list row"; a list is already rows."""++ parser = cli.build_parser()+ if accepted:+ assert parser.parse_args(argv).brief is True+ return+ with pytest.raises(SystemExit), contextlib.redirect_stderr(io.StringIO()):+ parser.parse_args(argv)++def test_runs_list_cli_defaults_to_first_page(monkeypatch, tmp_path, capsys) -> None:monkeypatch.setenv("AVIBE_HOME", str(tmp_path))paths.ensure_data_dirs()@@ -192,7 +219,7 @@ def test_runs_list_cli_defaults_to_first_page(monkeypatch, tmp_path, capsys) ->finally:store.close()- args = cli.build_parser().parse_args(["runs", "list", "--global", "--brief"])+ args = cli.build_parser().parse_args(["runs", "list", "--global"])assert cli.cmd_runs_list(args) == 0payload = json.loads(capsys.readouterr().out)@@ -200,8 +227,9 @@ def test_runs_list_cli_defaults_to_first_page(monkeypatch, tmp_path, capsys) ->assert len(payload["runs"]) == 20assert payload["runs"][0]["id"] == "run-24"assert payload["pagination"]["has_more"] is True- assert payload["pagination"]["next_command"] == "vibe runs list --global --brief --page 2 --limit 20"- assert "More records are available" in payload["message"]+ assert payload["pagination"]["next_command"] == "vibe runs list --global --page 2 --limit 20"+ # The continuation is next_command alone: no prose repeats it.+ assert "message" not in payloaddef test_runs_list_cli_filters_status_and_query(monkeypatch, tmp_path, capsys) -> None:@@ -238,7 +266,7 @@ def test_runs_list_cli_filters_status_and_query(monkeypatch, tmp_path, capsys) -finally:store.close()- args = cli.build_parser().parse_args(["runs", "list", "--global", "--status", "succeeded", "--q", "weekly", "--brief"])+ args = cli.build_parser().parse_args(["runs", "list", "--global", "--status", "succeeded", "--q", "weekly"])assert cli.cmd_runs_list(args) == 0payload = json.loads(capsys.readouterr().out)@@ -272,7 +300,7 @@ def test_runs_list_cli_normalizes_offset_time_filters(monkeypatch, tmp_path, capfinally:store.close()- args = cli.build_parser().parse_args(["runs", "list", "--global", "--created-after", "2026-05-25T10:00:00+08:00", "--brief"])+ args = cli.build_parser().parse_args(["runs", "list", "--global", "--created-after", "2026-05-25T10:00:00+08:00"])assert cli.cmd_runs_list(args) == 0payload = json.loads(capsys.readouterr().out)diff --git a/tests/test_cli_task_command.py b/tests/test_cli_task_command.pyindex b7e2f0cd7..ca497baa7 100644--- a/tests/test_cli_task_command.py+++ b/tests/test_cli_task_command.py@@ -77,7 +77,7 @@ def test_agent_enable_disable_cli_toggles_enabled_state(tmp_path: Path, capsys,disabled_payload = json.loads(capsys.readouterr().out)assert disabled_payload["agent"]["enabled"] is False- assert cli.cmd_agent_list(_parse_agent(["list", "--brief"])) == 0+ assert cli.cmd_agent_list(_parse_agent(["list"])) == 0assert json.loads(capsys.readouterr().out)["agents"] == []assert cli.cmd_agent_list(_parse_agent(["list", "--include-disabled"])) == 0@@ -870,9 +870,8 @@ def test_removed_task_reads_as_removed_and_refuses_mutations(capsys) -> None:assert definition["id"] == task.idassert definition["name"] == "Hourly summary"assert definition["lifecycle_state"] == "removed"- assert definition["state"] == "removed"# The removed row keeps ``enabled``, but it will never fire again.- assert definition["next_run_at"] is None+ assert "next_run_at" not in definitionremoved_at = definition["removed_at"]assert removed_at@@ -1006,8 +1005,8 @@ def test_task_add_create_per_run_scope_id_records_session_scope_metadata(tmp_patassert result == 0payload = json.loads(capsys.readouterr().out)assert payload["definition"]["session_policy"] == "create_per_run"- assert payload["definition"]["deliver_key"] is None- assert payload["definition"]["cwd"] is None+ assert store.get_task(payload["definition"]["id"]).deliver_key is None+ assert "cwd" not in payload["definition"]assert payload["definition"]["metadata"]["session_scope_id"] == "avibe::project::proj-scope-task"assert "session_workdir" not in payload["definition"]["metadata"]assert payload["definition"]["agent_name"] == "project-agent"@@ -1040,11 +1039,10 @@ def test_task_add_create_per_run_without_scope_records_standalone_definition(tmpassert result == 0task = json.loads(capsys.readouterr().out)["definition"]assert task["session_policy"] == "create_per_run"- assert task["session_id"] is None- assert task["deliver_key"] is None- assert task["cwd"] is None- assert "session_scope_id" not in task["metadata"]- assert "session_workdir" not in task["metadata"]+ assert {"session_id", "cwd"}.isdisjoint(task)+ assert store.get_task(task["id"]).deliver_key is None+ assert "session_scope_id" not in task.get("metadata", {})+ assert "session_workdir" not in task.get("metadata", {})def test_task_add_create_session_scope_id_supports_project_scope(tmp_path: Path, capsys, sqlite_schema_db_factory) -> None:@@ -1111,7 +1109,7 @@ def test_task_add_create_session_scope_id_supports_project_scope(tmp_path: Path,assert target.visibility == "foreground"assert target.suppress_delivery is Falseassert target.workdir == str(tmp_path)- assert payload["definition"]["cwd"] is None+ assert "cwd" not in payload["definition"]assert payload["definition"]["metadata"]["session_scope_id"] == "avibe::project::proj-once-task"assert "session_workdir" not in payload["definition"]["metadata"]@@ -1292,11 +1290,8 @@ def test_task_add_defaults_target_to_caller_session(tmp_path: Path, capsys, sqlipayload = json.loads(capsys.readouterr().out)assert payload["definition"]["session_id"] == "sesCaller"assert payload["definition"]["session_policy"] == "existing"- assert payload["session_default_notice"] == {- "code": "session_defaulted_to_caller",- "message": "Task target Session defaulted to this Agent Session.",- "session_id": "sesCaller",- }+ # The defaulted target is the definition's session_id; no notice repeats it.+ assert set(payload) == {"schema_version", "ok", "kind", "definition"}def test_task_add_rejects_scope_without_session_creation() -> None:@@ -1406,12 +1401,15 @@ def test_task_list_hides_completed_one_shots_by_default(tmp_path: Path, capsys)ids = [item["id"] for item in payload["definitions"]]assert done.id not in idsassert failed.id in ids- assert next(item for item in payload["definitions"] if item["id"] == failed.id)["state"] == "failed"+ failed_row = next(item for item in payload["definitions"] if item["id"] == failed.id)+ assert (failed_row["lifecycle_state"], failed_row["last_error"]) == ("finished", "delivery failed")++def test_task_list_row_carries_only_decision_fields(tmp_path: Path, capsys) -> None:+ """A list row is the compact projection: no nulls, zero counters, healthy verdicts or legacy keys."""-def test_task_list_brief_returns_scheduling_focused_view(tmp_path: Path, capsys) -> None:store = cli.ScheduledTaskStore()- task = store.add_task(+ named = store.add_task(name="Hourly summary",session_key="slack::channel::C123",prompt="recurring summary prompt",@@ -1419,26 +1417,14 @@ def test_task_list_brief_returns_scheduling_focused_view(tmp_path: Path, capsys)cron="0 * * * *",timezone_name="Asia/Shanghai",)-- with patch("vibe.cli._task_store", return_value=store):- result = cli.cmd_task_list(scope=cli.SessionListScope(), brief=True)-- assert result == 0- payload = json.loads(capsys.readouterr().out)- entry = payload["definitions"][0]- assert entry["id"] == task.id- assert entry["display_name"] == "Hourly summary"- assert "prompt" not in entry- assert entry["next_run_at"] is not None- assert entry["state"] == "active"---def test_paused_recurring_task_keeps_failed_run_in_last_status(- tmp_path: Path,- capsys,-) -> None:- store = cli.ScheduledTaskStore()- task = store.add_task(+ unnamed = store.add_task(+ session_key="slack::channel::C123",+ prompt="Share the nightly\nsummary.",+ schedule_type="cron",+ cron="0 3 * * *",+ timezone_name="UTC",+ )+ paused = store.add_task(name="Paused after failure",session_key="slack::channel::C123",prompt="recurring",@@ -1446,15 +1432,26 @@ def test_paused_recurring_task_keeps_failed_run_in_last_status(cron="0 * * * *",timezone_name="UTC",)- store.mark_task_result(task.id, error="delivery failed")- store.set_enabled(task.id, False)+ store.mark_task_result(paused.id, error="delivery failed")+ store.set_enabled(paused.id, False)with patch("vibe.cli._task_store", return_value=store):- assert cli.cmd_task_list(scope=cli.SessionListScope(), brief=True) == 0+ assert cli.cmd_task_list(scope=cli.SessionListScope()) == 0- payload = json.loads(capsys.readouterr().out)- assert payload["definitions"][0]["state"] == "paused"- assert payload["definitions"][0]["last_status"] == "failed"+ rows = {row["id"]: row for row in json.loads(capsys.readouterr().out)["definitions"]}+ assert set(rows[named.id]) == {"id", "name", "kind", "schedule_summary", "lifecycle_state", "next_run_at"}+ assert (rows[named.id]["name"], rows[named.id]["kind"], rows[named.id]["schedule_summary"]) == (+ "Hourly summary",+ "message",+ "cron:0 * * * *",+ )+ assert rows[named.id]["lifecycle_state"] == "waiting"+ # An unnamed task is labelled by what it does.+ assert "name" not in rows[unnamed.id]+ assert rows[unnamed.id]["message_preview"] == "Share the nightly summary."+ assert rows[paused.id]["lifecycle_state"] == "paused"+ assert rows[paused.id]["last_error"] == "delivery failed"+ assert "next_run_at" not in rows[paused.id]def test_task_list_defaults_to_first_page(tmp_path: Path, capsys) -> None:@@ -1470,7 +1467,7 @@ def test_task_list_defaults_to_first_page(tmp_path: Path, capsys) -> None:)with patch("vibe.cli._task_store", return_value=store):- result = cli.cmd_task_list(scope=cli.SessionListScope(), brief=True)+ result = cli.cmd_task_list(scope=cli.SessionListScope())assert result == 0payload = json.loads(capsys.readouterr().out)@@ -1484,14 +1481,22 @@ def test_task_list_defaults_to_first_page(tmp_path: Path, capsys) -> None:"next_page": 2,"next_command": "vibe task list --global --page 2 --limit 20",}- assert payload["message"].endswith("vibe task list --global --page 2 --limit 20")+ assert "message" not in payload-def test_task_list_keeps_enabled_tasks_ahead_of_paused_history(+def test_task_list_orders_enabled_rows_first_then_newest_activity(tmp_path: Path,capsys,) -> None:store = cli.ScheduledTaskStore()+ older = store.add_task(+ name="Older active",+ session_key="slack::channel::C123",+ prompt="older",+ schedule_type="cron",+ cron="0 * * * *",+ timezone_name="UTC",+ )for index in range(21):paused = store.add_task(name=f"Paused {index:02d}",@@ -1502,22 +1507,23 @@ def test_task_list_keeps_enabled_tasks_ahead_of_paused_history(timezone_name="UTC",)store.set_enabled(paused.id, False)- active = store.add_task(- name="Active",+ newer = store.add_task(+ name="Newer active",session_key="slack::channel::C123",- prompt="active",+ prompt="newer",schedule_type="cron",cron="0 * * * *",timezone_name="UTC",)with patch("vibe.cli._task_store", return_value=store):- assert cli.cmd_task_list(scope=cli.SessionListScope(), brief=True) == 0+ assert cli.cmd_task_list(scope=cli.SessionListScope()) == 0payload = json.loads(capsys.readouterr().out)- assert payload["definitions"][0]["id"] == active.id- assert payload["definitions"][0]["state"] == "active"+ names = [row["name"] for row in payload["definitions"]]+ assert names[:3] == ["Newer active", "Older active", "Paused 20"]assert payload["pagination"]["has_more"] is True+ assert {row["id"] for row in payload["definitions"][:2]} == {older.id, newer.id}def test_task_list_cli_dispatches_pagination_flags(@@ -1580,7 +1586,7 @@ def test_task_list_order_is_stable_across_cron_boundaries()with patch("vibe.cli._task_store", return_value=store):- assert cli.cmd_task_list(scope=cli.SessionListScope(), brief=True) == 0+ assert cli.cmd_task_list(scope=cli.SessionListScope()) == 0first_ids = [item["id"] for item in json.loads(capsys.readouterr().out)["definitions"]]@@ -1593,10 +1599,11 @@ def test_task_list_order_is_stable_across_cron_boundaries(lambda **kwargs: second_next_runs[str(kwargs["timezone_name"])],)with patch("vibe.cli._task_store", return_value=store):- assert cli.cmd_task_list(scope=cli.SessionListScope(), brief=True) == 0+ assert cli.cmd_task_list(scope=cli.SessionListScope()) == 0second_ids = [item["id"] for item in json.loads(capsys.readouterr().out)["definitions"]]- assert second_ids == first_ids == [later.id, earlier.id]+ # Newest activity first -- ``earlier`` was written last -- whatever the next fire times say.+ assert second_ids == first_ids == [earlier.id, later.id]def test_task_show_includes_derived_schedule_fields(tmp_path: Path, capsys) -> None:@@ -1615,11 +1622,14 @@ def test_task_show_includes_derived_schedule_fields(tmp_path: Path, capsys) -> Nassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["definition"]["display_name"] == "Hourly summary"- assert payload["definition"]["message_preview"] == "recurring summary prompt"+ assert payload["definition"]["name"] == "Hourly summary"+ assert payload["definition"]["message"] == "recurring summary prompt"assert payload["definition"]["next_run_at"] is not None- assert payload["definition"]["state"] == "active"- assert payload["definition"]["last_status"] == "never_run"+ assert payload["definition"]["lifecycle_state"] == "waiting"+ # Compatibility spellings and legacy duplicates are not printed.+ assert {"state", "last_status", "display_name", "prompt", "session_key", "post_to", "deliver_key"}.isdisjoint(+ payload["definition"]+ )def test_task_list_include_finished_includes_completed_one_shots(tmp_path: Path, capsys) -> None:@@ -1659,7 +1669,6 @@ def test_task_list_include_finished_keeps_history_paginated(tmp_path: Path, capsresult = cli.cmd_task_list(scope=cli.SessionListScope(),include_finished=True,- brief=True,page_request=cli.PageRequest(page=1, limit=2),)@@ -1693,8 +1702,9 @@ def test_task_run_enqueues_request(tmp_path: Path, capsys) -> None:assert result == 0payload = json.loads(capsys.readouterr().out)assert payload["ok"] is True- assert payload["task_id"] == task.id- assert (request_root / "pending" / f"{payload['execution_id']}.json").exists()+ assert set(payload) == {"schema_version", "ok", "kind", "run"}+ assert payload["run"]["definition_id"] == task.id+ assert (request_root / "pending" / f"{payload['run']['id']}.json").exists()def test_task_run_enqueues_manual_rerun_for_retired_one_shot(@@ -1731,7 +1741,7 @@ def test_task_run_enqueues_manual_rerun_for_retired_one_shot(assert result == 0payload = json.loads(capsys.readouterr().out)- manual = requests.get_run(payload["execution_id"])+ manual = requests.get_run(payload["run"]["id"])assert manual is not None and manual["source_kind"] == "cli"assert "task_schedule_consumed" not in manual["metadata"]current = cli.ScheduledTaskStore().get_task(task.id)@@ -1788,7 +1798,7 @@ def test_task_update_modifies_existing_task_without_changing_id(tmp_path: Path,assert payload["definition"]["id"] == task.idassert payload["definition"]["name"] == "Morning summary"assert payload["definition"]["cron"] == "*/30 * * * *"- assert payload["definition"]["prompt"] == "updated"+ assert payload["definition"]["message"] == "updated"def test_task_update_rejects_agent_together_with_clear_agent(tmp_path: Path, sqlite_schema_db_factory) -> None:@@ -2440,8 +2450,8 @@ def test_task_update_session_key_clears_previous_session_id(tmp_path: Path, capsassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["definition"]["session_id"] is None- assert payload["definition"]["session_key"] == "slack::channel::C456"+ assert payload["definition"].get("session_id") is None+ assert store.get_task(task.id).session_key == "slack::channel::C456"def test_task_update_replaces_post_to_with_deliver_key(tmp_path: Path, capsys) -> None:@@ -2467,8 +2477,8 @@ def test_task_update_replaces_post_to_with_deliver_key(tmp_path: Path, capsys) -assert result == 0payload = json.loads(capsys.readouterr().out)assert payload["definition"]["id"] == task.id- assert payload["definition"]["post_to"] is None- assert payload["definition"]["deliver_key"] == "slack::channel::C999"+ stored = store.get_task(task.id)+ assert (stored.post_to, stored.deliver_key) == (None, "slack::channel::C999")def test_task_update_reset_delivery_preserves_creation_scope_metadata(tmp_path: Path, capsys) -> None:@@ -2502,8 +2512,8 @@ def test_task_update_reset_delivery_preserves_creation_scope_metadata(tmp_path:assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["definition"]["post_to"] is None- assert payload["definition"]["deliver_key"] is None+ assert payload["definition"].get("post_to") is None+ assert payload["definition"].get("deliver_key") is Noneassert payload["definition"]["metadata"]["session_scope_id"] == "avibe::project::proj-reset-task"@@ -3032,7 +3042,7 @@ def test_hook_send_allows_unresolved_legacy_scope_backend(tmp_path: Path, capsysassert result == 0payload = json.loads(capsys.readouterr().out)- queued = json.loads((request_store.pending_dir / f"{payload['run_id']}.json").read_text())+ queued = json.loads((request_store.pending_dir / f"{payload['run']['id']}.json").read_text())assert queued["session_key"] == "slack::channel::C123"assert queued["agent_name"] == default_agent.name@@ -3081,20 +3091,19 @@ def test_agent_run_standalone_async_reserves_background_session(tmp_path: Path,assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["session_id"].startswith("ses")- assert payload["session_policy"] == "none"- assert payload["agent"] == agent.name- queued = json.loads((request_store.pending_dir / f"{payload['run_id']}.json").read_text())+ assert payload["run"]["session_id"].startswith("ses")+ assert payload["run"]["agent_name"] == agent.name+ queued = json.loads((request_store.pending_dir / f"{payload['run']['id']}.json").read_text())assert queued["request_type"] == "agent_run"- assert queued["session_id"] == payload["session_id"]+ assert queued["session_id"] == payload["run"]["session_id"]assert queued["agent_name"] == "worker"with sqlite3.connect(db_path) as conn:row = conn.execute("select scope_id, visibility, workdir from agent_sessions where id = ?",- (payload["session_id"],),+ (payload["run"]["session_id"],),).fetchone()- assert row == (None, "background", str(tmp_path / "show" / payload["session_id"]))- assert (tmp_path / "show" / payload["session_id"]).is_dir()+ assert row == (None, "background", str(tmp_path / "show" / payload["run"]["session_id"]))+ assert (tmp_path / "show" / payload["run"]["session_id"]).is_dir()def test_agent_run_caller_scope_default_keeps_caller_cwd_and_same_scope_uses_scope_cwd(@@ -3183,21 +3192,21 @@ def test_agent_run_caller_scope_default_keeps_caller_cwd_and_same_scope_uses_scoagent_sessions.c.workdir,).where(agent_sessions.c.id.in_(- [implicit["session_id"], explicit["session_id"], visible["session_id"]]+ [implicit["run"]["session_id"], explicit["run"]["session_id"], visible["run"]["session_id"]])))}- assert rows[implicit["session_id"]].scope_id == scope_id- assert rows[implicit["session_id"]].visibility == "background"- assert rows[implicit["session_id"]].workdir == str(invocation_cwd)- assert rows[explicit["session_id"]].scope_id == scope_id- assert rows[explicit["session_id"]].visibility == "background"- assert rows[explicit["session_id"]].workdir == str(scope_cwd)- assert rows[visible["session_id"]].scope_id == scope_id- assert rows[visible["session_id"]].visibility == "foreground"- assert rows[visible["session_id"]].workdir == str(invocation_cwd)+ assert rows[implicit["run"]["session_id"]].scope_id == scope_id+ assert rows[implicit["run"]["session_id"]].visibility == "background"+ assert rows[implicit["run"]["session_id"]].workdir == str(invocation_cwd)+ assert rows[explicit["run"]["session_id"]].scope_id == scope_id+ assert rows[explicit["run"]["session_id"]].visibility == "background"+ assert rows[explicit["run"]["session_id"]].workdir == str(scope_cwd)+ assert rows[visible["run"]["session_id"]].scope_id == scope_id+ assert rows[visible["run"]["session_id"]].visibility == "foreground"+ assert rows[visible["run"]["session_id"]].workdir == str(invocation_cwd)def test_agent_run_create_session_uses_scope_anchor_for_channel_deliver_key(tmp_path: Path, capsys, sqlite_schema_db_factory) -> None:@@ -3229,7 +3238,7 @@ def test_agent_run_create_session_uses_scope_anchor_for_channel_deliver_key(tmp_assert result == 0payload = json.loads(capsys.readouterr().out)- target = cli.resolve_session_id_target(payload["session_id"], db_path=db_path)+ target = cli.resolve_session_id_target(payload["run"]["session_id"], db_path=db_path)assert target.session_key.to_key() == "slack::channel::C123"assert target.session_key.thread_id is Noneassert target.session_anchor.startswith("slack_C123:run_")@@ -3264,12 +3273,11 @@ def test_agent_run_create_session_preserves_legacy_thread_deliver_key(tmp_path:assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["deliver_key"] == "slack::channel::C123::thread::171717.123"- target = cli.resolve_session_id_target(payload["session_id"], db_path=db_path)+ target = cli.resolve_session_id_target(payload["run"]["session_id"], db_path=db_path)assert target.session_key.to_key() == "slack::channel::C123::thread::171717.123"assert target.session_key.thread_id == "171717.123"assert target.session_anchor.startswith("slack_171717.123:run_")- queued = request_store.get_run(payload["run_id"])+ queued = request_store.get_run(payload["run"]["id"])assert queued is not Noneassert queued["deliver_key"] == "slack::channel::C123::thread::171717.123"@@ -3348,7 +3356,7 @@ def test_agent_run_create_session_scope_id_uses_unique_project_anchors(tmp_path:).mappings())- assert {payload["session_id"] for payload in payloads} == {row["id"] for row in rows}+ assert {payload["run"]["session_id"] for payload in payloads} == {row["id"] for row in rows}anchors = {row["session_anchor"] for row in rows}assert len(anchors) == 2assert all(anchor.startswith("avibe_proj_unique:run_") for anchor in anchors)@@ -3377,7 +3385,7 @@ def test_agent_run_standalone_does_not_create_platform_pseudo_scope(tmp_path: Pawith sqlite3.connect(db_path) as conn:row = conn.execute("select scope_id, visibility from agent_sessions where id = ?",- (payload["session_id"],),+ (payload["run"]["session_id"],),).fetchone()assert row == (None, "background")@@ -3477,8 +3485,8 @@ def test_agent_run_existing_session_allows_matching_agent_hint(tmp_path: Path, cassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["session_id"] == session_id- assert payload["agent"] == "codex-worker"+ assert payload["run"]["session_id"] == session_id+ assert payload["run"]["agent_name"] == "codex-worker"def test_agent_run_rejects_different_same_backend_agent_for_existing_session(tmp_path: Path, sqlite_schema_db_factory) -> None:@@ -3641,8 +3649,8 @@ def test_agent_run_existing_session_uses_session_agent_when_agent_omitted(tmp_paassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["agent"] == "worker"- queued = json.loads((request_store.pending_dir / f"{payload['run_id']}.json").read_text())+ assert payload["run"]["agent_name"] == "worker"+ queued = json.loads((request_store.pending_dir / f"{payload['run']['id']}.json").read_text())assert queued["agent_name"] == "worker"@@ -5003,10 +5011,9 @@ def test_task_add_pure_command_task_ignores_caller_session_default(assert result == 0payload = json.loads(capsys.readouterr().out)definition = payload["definition"]- assert definition["session_id"] is None- assert definition["session_policy"] is None- assert definition["session_key"] == ""- assert definition["agent_name"] is None+ assert definition.get("session_id") is None+ assert definition.get("session_policy") is None+ assert definition.get("agent_name") is Noneassert "session_default_notice" not in payload# The caller is still RECORDED, just not bound: creation origin survives.assert definition["metadata"]["created_by"]["caller"]["session_id"] == "sesCaller"@@ -5045,10 +5052,10 @@ def test_task_add_escalating_command_task_binds_caller_session(assert definition["session_id"] == "sesCaller"assert definition["session_policy"] == "existing"assert definition["shell_command"] == "./scripts/sync.sh"- assert definition["prompt"] == "The nightly sync failed. Diagnose it."+ assert definition["message"] == "The nightly sync failed. Diagnose it."assert definition["metadata"]["on_failure"] == "agent"assert definition["kind"] == "command"- assert payload["session_default_notice"]["code"] == "session_defaulted_to_caller"+ assert "session_default_notice" not in payloaddef test_task_add_escalating_command_task_accepts_an_explicit_cwd(@@ -5265,9 +5272,9 @@ def test_task_add_pure_shell_command_persists_command_fields(payload = json.loads(capsys.readouterr().out)definition = payload["definition"]assert definition["shell_command"] == "./scripts/sync.sh"- assert definition["command"] is None+ assert definition.get("command") is Noneassert definition["timeout_seconds"] == 0- assert definition["prompt"] == ""+ assert "message" not in definitionassert definition["cwd"] == str(tmp_path)assert definition["metadata"]["on_failure"] == "none"assert "session_workdir" not in definition["metadata"]@@ -5294,10 +5301,8 @@ def test_task_add_command_argv_persists_the_argv_list(assert result == 0definition = json.loads(capsys.readouterr().out)["definition"]assert definition["command"] == ["python3", "sync.py", "--target", "prod"]- assert definition["shell_command"] is None- assert definition["timeout_seconds"] is None- assert definition["command_preview"] == "python3 sync.py --target prod"- assert definition["display_name"] == "python3 sync.py --target prod"+ assert definition.get("shell_command") is None+ assert definition.get("timeout_seconds") is Nonedef test_task_add_message_task_stores_no_command_fields(@@ -5319,13 +5324,13 @@ def test_task_add_message_task_stores_no_command_fields(assert result == 0definition = json.loads(capsys.readouterr().out)["definition"]- assert definition["prompt"] == "morning briefing"- assert definition["shell_command"] is None- assert definition["command"] is None- assert definition["timeout_seconds"] is None+ assert definition["message"] == "morning briefing"+ assert definition.get("shell_command") is None+ assert definition.get("command") is None+ assert definition.get("timeout_seconds") is Noneassert definition["kind"] == "message"assert definition["on_failure"] == "none"- assert "on_failure" not in definition["metadata"]+ assert "on_failure" not in definition.get("metadata", {})# --- update ---------------------------------------------------------------@@ -5362,8 +5367,8 @@ def test_task_update_replaces_pure_command_task_shell(tmp_path: Path, capsys, mo# ``update_command_fields`` is all-or-nothing, so an unnamed column must survive.assert definition["timeout_seconds"] == 60assert definition["cwd"] == str(tmp_path)- assert definition["session_policy"] is None- assert definition["session_id"] is None+ assert definition.get("session_policy") is None+ assert definition.get("session_id") is Nonedef test_task_update_timeout_only_preserves_stored_command(@@ -5385,7 +5390,7 @@ def test_task_update_timeout_only_preserves_stored_command(assert result == 0definition = json.loads(capsys.readouterr().out)["definition"]assert definition["command"] == ["python3", "sync.py"]- assert definition["shell_command"] is None+ assert definition.get("shell_command") is Noneassert definition["timeout_seconds"] == 900@@ -5434,7 +5439,7 @@ def test_task_update_rewords_escalation_guidance_on_an_agent_command_task(assert result == 0definition = json.loads(capsys.readouterr().out)["definition"]- assert definition["prompt"] == "Check the upstream API first."+ assert definition["message"] == "Check the upstream API first."assert definition["shell_command"] == "./scripts/old.sh"assert definition["timeout_seconds"] == 60assert definition["on_failure"] == "agent"@@ -5501,14 +5506,16 @@ def test_task_payload_renders_command_kind_and_preview(tmp_path: Path) -> None:task = _stored_command_task(store, name=None, shell_command="./scripts/sync.sh --verbose")task.last_exit_code = 2- payload = cli._task_payload(task)- brief = cli._task_payload(task, brief=True)+ projected = cli._task_fallback_projection(task)+ payload = cli._task_projection_payload(projected)+ brief = cli._task_projection_payload(projected, brief=True)assert payload["kind"] == "command"assert payload["on_failure"] == "none"- assert payload["command_preview"] == "./scripts/sync.sh --verbose"- assert payload["display_name"] == "./scripts/sync.sh --verbose"+ assert payload["shell_command"] == "./scripts/sync.sh --verbose"assert brief["kind"] == "command"+ # An unnamed command task is labelled by its command.+ assert brief["command_preview"] == "./scripts/sync.sh --verbose"assert brief["last_exit_code"] == 2@@ -5522,12 +5529,11 @@ def test_task_payload_renders_message_kind_for_message_tasks(tmp_path: Path) ->timezone_name="UTC",)- payload = cli._task_payload(task)+ brief = cli._task_projection_payload(cli._task_fallback_projection(task), brief=True)- assert payload["kind"] == "message"- assert payload["command_preview"] == ""- assert payload["display_name"] == "morning briefing"- assert cli._task_payload(task, brief=True)["last_exit_code"] is None+ assert brief["kind"] == "message"+ assert brief["message_preview"] == "morning briefing"+ assert {"command_preview", "last_exit_code"}.isdisjoint(brief)# --- documented examples --------------------------------------------------@@ -5656,9 +5662,9 @@ def test_agent_run_starts_a_new_session_on_a_chosen_model_that_its_later_turns_k)assert result == 0, payload- session_id = payload["session_id"]+ session_id = payload["run"]["session_id"]assert bool(payload.get("warnings")) is warned- queued = json.loads((request_store.pending_dir / f"{payload['run_id']}.json").read_text())+ queued = json.loads((request_store.pending_dir / f"{payload['run']['id']}.json").read_text())assert (queued["model"], queued["reasoning_effort"]) == (model, effort)with sqlite3.connect(db_path) as conn:row = conn.execute("select model, reasoning_effort from agent_sessions where id = ?", (session_id,)).fetchone()@@ -5749,13 +5755,13 @@ def test_agent_run_refuses_a_fork_onto_a_vibey_model_its_menu_does_not_offer(with sqlite3.connect(db_path) as conn:conn.execute("update agent_sessions set native_session_id = ? where id = ?",- (f"vibey:{payload['session_id']}", payload["session_id"]),+ (f"vibey:{payload['run']['session_id']}", payload["run"]["session_id"]),)with patch("core.scheduled_tasks.paths.get_sqlite_state_path", return_value=db_path):result, payload = _run_on_new_session(tmp_path, capsys, db_path, agent_store, request_store,- ["--fork-session", payload["session_id"], "--model", "claude-opus-9", "--message", "branch"],+ ["--fork-session", payload["run"]["session_id"], "--model", "claude-opus-9", "--message", "branch"],)assert result == 1diff --git a/tests/test_cli_watch_command.py b/tests/test_cli_watch_command.pyindex f32f7cbc0..2f445a918 100644--- a/tests/test_cli_watch_command.py+++ b/tests/test_cli_watch_command.py@@ -444,7 +444,7 @@ def test_watch_add_creates_shell_watch(tmp_path: Path, capsys) -> None:assert "watch" not in payloadassert payload["definition"]["name"] == "Wait for export"assert payload["definition"]["shell_command"] == "python3 scripts/wait.py"- assert payload["definition"]["command"] == []+ assert "command" not in payload["definition"]assert payload["definition"]["mode"] == "once"assert payload["definition"]["retry_exit_codes"] == [75]@@ -574,7 +574,7 @@ def test_watch_add_create_per_run_scope_id_records_session_scope_metadata(tmp_paassert result == 0payload = json.loads(capsys.readouterr().out)assert payload["definition"]["session_policy"] == "create_per_run"- assert payload["definition"]["deliver_key"] is None+ assert payload["definition"].get("deliver_key") is Noneassert payload["definition"]["cwd"] == str(invoke_dir)assert payload["definition"]["metadata"]["session_scope_id"] == "avibe::project::proj-scope-watch"assert "session_workdir" not in payload["definition"]["metadata"]@@ -612,8 +612,8 @@ def test_watch_add_create_per_run_without_scope_records_standalone_definition(tmassert result == 0watch = json.loads(capsys.readouterr().out)["definition"]assert watch["session_policy"] == "create_per_run"- assert watch["session_id"] is None- assert watch["deliver_key"] is None+ assert watch.get("session_id") is None+ assert watch.get("deliver_key") is Noneassert "session_scope_id" not in watch["metadata"]assert "session_workdir" not in watch["metadata"]@@ -731,11 +731,8 @@ def test_watch_add_defaults_target_to_caller_session(tmp_path: Path, capsys) ->payload = json.loads(capsys.readouterr().out)assert payload["definition"]["session_id"] == "sesCaller"assert payload["definition"]["session_policy"] == "existing"- assert payload["session_default_notice"] == {- "code": "session_defaulted_to_caller",- "message": "Watch target Session defaulted to this Agent Session.",- "session_id": "sesCaller",- }+ # The defaulted target is the definition's session_id; no notice repeats it.+ assert set(payload) == {"schema_version", "ok", "kind", "definition"}def test_watch_add_accepts_message_template(tmp_path: Path, capsys) -> None:@@ -763,7 +760,7 @@ def test_watch_add_accepts_message_template(tmp_path: Path, capsys) -> None:assert result == 0payload = json.loads(capsys.readouterr().out)assert payload["definition"]["message"] == "Summarize the waiter output."- assert payload["definition"]["prefix"] is None+ assert payload["definition"].get("prefix") is Nonedef test_watch_add_creates_exec_watch_with_retry_codes(tmp_path: Path, capsys) -> None:@@ -1065,17 +1062,21 @@ def test_wait_for_watch_startup_rejects_watch_that_fails_before_stable_window(tmassert exc.value.code == "watch_startup_failed"-def test_watch_list_brief_includes_runtime_state(tmp_path: Path, capsys) -> None:+def test_watch_list_row_carries_only_decision_fields(tmp_path: Path, capsys) -> None:+ """A list row is the compact projection: what an Agent decides its next step from."""+store = ManagedWatchStore()runtime_store = WatchRuntimeStateStore()- watch = store.add_watch(- name="Watch CI",+ retrying = _add_test_watch(store, name="Watch CI", mode="forever")+ dead = _add_test_watch(store, name="Dead waiter", mode="forever")+ unnamed = store.add_watch(+ name=None,session_key="slack::channel::C123",- command=["python3", "wait.py"],+ command=["python3", "wait.py", "--pr", "7"],shell_command=None,prefix=None,cwd=None,- mode="forever",+ mode="once",timeout_seconds=600,lifetime_timeout_seconds=0,retry_exit_codes=[75],@@ -1083,15 +1084,24 @@ def test_watch_list_brief_includes_runtime_state(tmp_path: Path, capsys) -> Nonepost_to=None,deliver_key=None,)+ # A configured retry exit: the waiter is healthy and still waiting.+ assert store.mark_cycle_start(retrying.id)+ assert store.mark_cycle_result(retrying.id, exit_code=75, error=None)runtime_store.write({"watches": {- watch.id: {+ retrying.id: {"running": True,"pid": 1234,"started_at": "2026-04-02T00:00:00+00:00","updated_at": "2026-04-02T00:00:00+00:00",- }+ },+ dead.id: {+ "running": False,+ "pid": 2345,+ "started_at": "2026-04-02T00:00:00+00:00",+ "updated_at": "2026-04-02T00:00:00+00:00",+ },}})@@ -1100,12 +1110,23 @@ def test_watch_list_brief_includes_runtime_state(tmp_path: Path, capsys) -> Nonepatch("vibe.cli._watch_store", return_value=store),patch("vibe.cli._watch_runtime_store", return_value=runtime_store),):- result = cli.cmd_watch_list(scope=cli.SessionListScope(), brief=True)+ result = cli.cmd_watch_list(scope=cli.SessionListScope())assert result == 0- payload = json.loads(capsys.readouterr().out)- assert payload["definitions"][0]["state"] == "running"- assert payload["definitions"][0]["mode"] == "forever"+ rows = {row["id"]: row for row in json.loads(capsys.readouterr().out)["definitions"]}+ assert set(rows[retrying.id]) == {+ "id",+ "name",+ "mode",+ "lifecycle_state",+ "waiting_since",+ "last_exit_code",+ }+ assert (rows[retrying.id]["lifecycle_state"], rows[retrying.id]["last_exit_code"]) == ("waiting", 75)+ # An enabled watch whose observed waiter exited is the one liveness worth naming.+ assert rows[dead.id]["process_alive"] is False+ assert "name" not in rows[unnamed.id]+ assert rows[unnamed.id]["command_preview"] == "python3 wait.py --pr 7"def test_watch_list_hides_finished_one_shots_by_default(tmp_path: Path, capsys) -> None:@@ -1125,14 +1146,15 @@ def test_watch_list_hides_finished_one_shots_by_default(tmp_path: Path, capsys)patch("vibe.cli._watch_store", return_value=store),patch("vibe.cli._watch_runtime_store", return_value=runtime_store),):- result = cli.cmd_watch_list(scope=cli.SessionListScope(), brief=True)+ result = cli.cmd_watch_list(scope=cli.SessionListScope())assert result == 0payload = json.loads(capsys.readouterr().out)ids = {item["id"] for item in payload["definitions"]}assert ids == {active.id, failed.id, paused.id, failed_forever.id}assert completed.id not in ids- assert next(item for item in payload["definitions"] if item["id"] == failed.id)["state"] == "failed"+ failed_row = next(item for item in payload["definitions"] if item["id"] == failed.id)+ assert (failed_row["lifecycle_state"], failed_row["lifecycle_detail"]) == ("finished", "error")def test_resumed_then_paused_one_shot_remains_in_default_list(tmp_path: Path, capsys) -> None:@@ -1152,7 +1174,7 @@ def test_resumed_then_paused_one_shot_remains_in_default_list(tmp_path: Path, capayload = json.loads(capsys.readouterr().out)assert [item["id"] for item in payload["definitions"]] == [watch.id]- assert payload["definitions"][0]["state"] == "paused"+ assert payload["definitions"][0]["lifecycle_state"] == "paused"def test_paused_forever_watch_changed_to_once_starts_new_lifecycle(@@ -1191,7 +1213,7 @@ def test_paused_forever_watch_changed_to_once_starts_new_lifecycle(payload = json.loads(capsys.readouterr().out)assert [item["id"] for item in payload["definitions"]] == [watch.id]- assert payload["definitions"][0]["state"] == "paused"+ assert payload["definitions"][0]["lifecycle_state"] == "paused"def test_watch_list_defaults_to_first_page(tmp_path: Path, capsys) -> None:@@ -1204,7 +1226,7 @@ def test_watch_list_defaults_to_first_page(tmp_path: Path, capsys) -> None:patch("vibe.cli._watch_store", return_value=store),patch("vibe.cli._watch_runtime_store", return_value=runtime_store),):- result = cli.cmd_watch_list(scope=cli.SessionListScope(), brief=True)+ result = cli.cmd_watch_list(scope=cli.SessionListScope())assert result == 0payload = json.loads(capsys.readouterr().out)@@ -1258,7 +1280,6 @@ def test_watch_list_include_finished_keeps_history_paginated(tmp_path: Path, capresult = cli.cmd_watch_list(scope=cli.SessionListScope(),include_finished=True,- brief=True,page_request=cli.PageRequest(page=1, limit=2),)@@ -1290,9 +1311,11 @@ def test_removed_watch_reads_as_removed_and_refuses_mutations(capsys) -> None:assert definition["id"] == watch.idassert definition["name"] == "Watch CI"assert definition["lifecycle_state"] == "removed"- assert definition["state"] == "removed"removed_at = definition["removed_at"]assert removed_at+ assert cli.cmd_watch_show(watch.id, brief=True) == 0+ row = json.loads(capsys.readouterr().out)["definition"]+ assert (row["lifecycle_state"], row["removed_at"]) == ("removed", removed_at)mutations = [(cli.cmd_watch_set_enabled, (watch.id, False)),@@ -1399,9 +1422,10 @@ def test_watch_update_renames_and_retargets_watch(tmp_path: Path, capsys) -> Nonpayload = json.loads(capsys.readouterr().out)assert payload["definition"]["id"] == watch.idassert payload["definition"]["name"] == "Watch deploy"- assert payload["definition"]["session_key"] == "slack::channel::C456"- assert payload["definition"]["post_to"] == "channel"- assert payload["definition"]["prefix"] == "Deploy finished."+ assert payload["definition"]["message"] == "Deploy finished."+ assert {"session_key", "post_to", "deliver_key", "prefix"}.isdisjoint(payload["definition"])+ stored = store.get_watch(watch.id)+ assert (stored.session_key, stored.post_to) == ("slack::channel::C456", "channel")assert payload["definition"]["mode"] == "forever"assert payload["definition"]["timeout_seconds"] == 1200assert payload["definition"]["lifetime_timeout_seconds"] == 7200@@ -1473,8 +1497,8 @@ def test_watch_update_session_key_clears_previous_session_id(tmp_path: Path, capassert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["definition"]["session_id"] is None- assert payload["definition"]["session_key"] == "slack::channel::C456"+ assert payload["definition"].get("session_id") is None+ assert store.get_watch(watch.id).session_key == "slack::channel::C456"def test_watch_update_reset_delivery_preserves_creation_scope_metadata(tmp_path: Path, capsys) -> None:@@ -1515,8 +1539,8 @@ def test_watch_update_reset_delivery_preserves_creation_scope_metadata(tmp_path:assert result == 0payload = json.loads(capsys.readouterr().out)- assert payload["definition"]["post_to"] is None- assert payload["definition"]["deliver_key"] is None+ assert payload["definition"].get("post_to") is None+ assert payload["definition"].get("deliver_key") is Noneassert payload["definition"]["metadata"]["session_scope_id"] == "avibe::project::proj-reset-watch"assert payload["definition"]["metadata"]["session_workdir"] == str(tmp_path)@@ -1551,7 +1575,7 @@ def test_watch_update_replaces_argv_command(tmp_path: Path, capsys) -> None:assert result == 0payload = json.loads(capsys.readouterr().out)assert payload["definition"]["command"] == ["python3", "wait_deploy.py", "--flag", "value"]- assert payload["definition"]["shell_command"] is None+ assert payload["definition"].get("shell_command") is Nonedef test_watch_update_no_changes_returns_structured_error(tmp_path: Path) -> None:diff --git a/tests/test_harness_failure_visibility.py b/tests/test_harness_failure_visibility.pyindex 8e57800bd..44f9ceb84 100644--- a/tests/test_harness_failure_visibility.py+++ b/tests/test_harness_failure_visibility.py@@ -9186,8 +9186,8 @@ def test_definition_health_reaches_the_cli_list_after_a_success(capsys) -> None:entry = json.loads(capsys.readouterr().out)["definitions"][0]assert entry["recent_failures"] == 3, "a success downgrades, it does not erase"assert entry["health"] == "degraded"- # And the demoted compatibility field keeps #1061's three-valued vocabulary.- assert entry["last_status"] in {"failed", "succeeded", "never_run"}+ # The compatibility field is gone from the CLI; health is the only answer.+ assert "last_status" not in entrydef test_brief_task_payload_carries_last_error(capsys) -> None:@@ -9258,7 +9258,7 @@ def test_a_watch_reports_processing_health_separately_from_waiter_health(capsys)entry = json.loads(capsys.readouterr().out)["definitions"][0]assert entry["health"] == "unknown", "a never-run waiter has no success evidence"- assert entry["consecutive_failures"] == 0+ assert "consecutive_failures" not in entry, "a zero counter is not printed"assert entry["processing_health"] == "failing"assert entry["processing_consecutive_failures"] == 1@@ -12208,7 +12208,8 @@ def test_a_watch_that_outlives_its_delivery_target_dies_visibly(# ``vibe watch list`` for an unrelated reason. The two must agree.assert cli.cmd_watch_show(watch.id) == 0shown = json.loads(capsys.readouterr().out)["definition"]- assert (shown["health"], shown["processing_health"], shown["lifecycle_state"]) == (+ # The CLI prints a verdict only when it is not ``healthy``: absent means healthy.+ assert (shown.get("health", "healthy"), shown["processing_health"], shown["lifecycle_state"]) == ("healthy","failing","finished",@@ -12532,10 +12533,11 @@ def test_a_forever_watch_repeating_the_field_failure_notifies_once(canonical notice rather than one message per event — the streak lane, which isonly reachable because ``delivery_target_missing`` stays OUT of``RUN_INTERRUPTION_REASONS``;- * and the definition's ``last_error`` legitimately holds the sentinel string for- its last cycle, so the notice must not present that as the failure's cause.- This is #1060's first complaint in its exact shape: the sentinel is a true fact- about the waiter and a false explanation of the death.+ * and the retry cycle records only its exit code: ``last_error`` stays empty for+ a waiter that is merely still waiting, so neither the row nor the notice can+ present the sentinel as a failure. This is #1060's first complaint in its exact+ shape: the sentinel is a true fact about the waiter and a false explanation of+ the death.The waiter is a real subprocess whose exit code walks a marker file: 75 first,then 0 twice (two events, two follow-up deliveries, two failures), then 75 again@@ -12637,7 +12639,7 @@ def test_a_forever_watch_repeating_the_field_failure_notifies_once(def _last_completed_cycle_is_retry() -> bool:row = watch_store.get_watch(watch.id)- return row is not None and row.last_cycle_outcome == (75, sentinel)+ return row is not None and row.last_cycle_outcome == (75, None)service = ManagedWatchService(controller=SimpleNamespace(),@@ -12665,8 +12667,9 @@ def test_a_forever_watch_repeating_the_field_failure_notifies_once(assert saved.retired_at is None and saved.last_finished_at is None, (f"nor stamp a retirement on a watch that is still running: {saved}")- assert saved.last_error == sentinel and saved.last_exit_code == 75, (- f"the premise for the last assertion below — the last cycle was a retry: {saved}"+ assert saved.last_exit_code == 75 and saved.last_error is None, (+ "the last cycle was a configured retry, which records its exit code and no "+ f"error: {saved}")for hook in hooks:diff --git a/tests/test_show_pages.py b/tests/test_show_pages.pyindex 50949867f..f320f125d 100644--- a/tests/test_show_pages.py+++ b/tests/test_show_pages.py@@ -2855,7 +2855,12 @@ def test_show_list_cli_json_reports_pagination(monkeypatch, tmp_path, capsys):assert payload["pagination"]["has_more"] is Trueassert payload["pagination"]["next_page"] == 2assert "vibe show list --global --json --page 2 --limit 20" == payload["pagination"]["next_command"]- assert "More records are available" in payload["message"]+ assert "message" not in payload++ # Text output still tells a person how to continue, from the same next_command.+ args = cli.build_parser().parse_args(["show", "list", "--global"])+ assert cli.cmd_show_list(args) == 0+ assert "Continue with: vibe show list --global --page 2 --limit 20" in capsys.readouterr().outdef test_show_list_cli_next_command_uses_absolute_time_filters(monkeypatch, tmp_path, capsys):diff --git a/tests/test_terminal_bench_credential.py b/tests/test_terminal_bench_credential.pyindex efae1b4e3..e6f0dc0db 100644--- a/tests/test_terminal_bench_credential.py+++ b/tests/test_terminal_bench_credential.py@@ -115,7 +115,7 @@ def test_key_unlinked_before_service_and_delivered_only_to_bootstrap_stdin(tmp_passert kwargs["input"] == SENTINELresult = {"source_id": "fixture-source"}elif "agent" in argv and "run" in argv:- result = {"run_id": "fixture-run", "session_id": "fixture-session"}+ result = {"run": {"id": "fixture-run", "session_id": "fixture-session"}}elif "runs" in argv:result = {"run": {"status": "succeeded", "result_text": SENTINEL}}elif "harness" in argv:diff --git a/tests/test_terminal_bench_full_runtime.py b/tests/test_terminal_bench_full_runtime.pyindex 2d664e73f..9e101473e 100644--- a/tests/test_terminal_bench_full_runtime.py+++ b/tests/test_terminal_bench_full_runtime.py@@ -259,7 +259,7 @@ def test_failure_report_preserves_only_wrapper_codes(tmp_path, monkeypatch, capsraise ValueError(private)body = {"run": {"status": "succeeded", "result_text": "fixture"}}elif "agent" in argv and "run" in argv:- body = {"run_id": "fixture-run", "session_id": "fixture-session"}+ body = {"run": {"id": "fixture-run", "session_id": "fixture-session"}}elif "harness" in argv:body = {"controller": {"available": False}}else:diff --git a/tests/test_vault_cli.py b/tests/test_vault_cli.pyindex 3b63ec62b..13cef546a 100644--- a/tests/test_vault_cli.py+++ b/tests/test_vault_cli.py@@ -495,7 +495,7 @@ def test_find_reports_value_free_capabilities(tmp_path, capfd, monkeypatch):assert "sk-" not in json.dumps(payload)-def test_list_paginates_and_points_agents_to_find(capfd):+def test_list_paginates_through_next_command_alone(capfd):for index in range(25):_create_standard_secret(f"KEY_{index:02d}")@@ -507,8 +507,8 @@ def test_list_paginates_and_points_agents_to_find(capfd):assert payload["secrets"][0]["name"] == "KEY_00"assert payload["pagination"]["has_more"] is Trueassert payload["pagination"]["next_command"] == "vibe vault list --page 2 --limit 20"- assert "vibe vault find --q <keyword>" in payload["message"]- assert "Use pagination.next_command" in payload["next_steps"][0]+ # next_command is the continuation; no fixed prose or next_steps repeat it.+ assert set(payload) == {"schema_version", "ok", "kind", "secrets", "pagination"}def test_find_filters_by_query_and_multiple_tags(capfd):diff --git a/tests/test_watch_job_target.py b/tests/test_watch_job_target.pyindex 0f26090f3..272e3ed52 100644--- a/tests/test_watch_job_target.py+++ b/tests/test_watch_job_target.py@@ -756,10 +756,10 @@ def test_a_job_watch_reads_as_its_command_and_stores_no_waiter(tmp_path: Path) -sqlite = SQLiteBackgroundTaskStore()shown = cli._watch_projection_payload(sqlite.get_watch(watch_id))+ row = cli._watch_projection_payload(sqlite.get_watch(watch_id), brief=True)listed = sqlite.list_watches_page(page_request=None, query="test_slow").items- assert shown["command_preview"] == command- assert shown["display_name"] == commandassert shown["shell_command"] == command+ assert row["command_preview"] == commandassert [row["id"] for row in listed] == [watch_id]# Nothing a reader without job targets could run.assert _sql("SELECT command_json, shell_command FROM run_definitions WHERE id = ?", watch_id) == [("[]", None)]diff --git a/vibe/cli.py b/vibe/cli.pyindex c91b791ed..7fedb23cb 100644--- a/vibe/cli.py+++ b/vibe/cli.py@@ -114,8 +114,8 @@ from storage.db import create_sqlite_enginefrom storage.lock import MigrationLockTimeoutfrom storage.background import (DefinitionWriteConflict,+ HEALTH_HEALTHY,SQLiteBackgroundTaskStore,- TASK_RETIREMENT_SCHEDULE_MISSED,JobWatchResumeRefused,TaskResumeBlocked,TaskScheduleRetired,@@ -1008,6 +1008,14 @@ def _add_pagination_args(parser, *, help_command: str) -> None:parser.error_help_command = help_command+def _add_brief_arg(parser, *, list_command: str) -> None:+ parser.add_argument(+ "--brief",+ action="store_true",+ help=i18n_t("harness.cli.help.brief", _configured_cli_language(), list_command=list_command),+ )++def _add_vault_approval_wait_args(parser, *, default_seconds: int = DEFAULT_VAULT_APPROVAL_WAIT_SECONDS) -> None:parser.add_argument("--approval-wait",@@ -1047,27 +1055,30 @@ def _next_command(parts: list[str], page_result) -> str | None:return shlex.join(command)-def _pagination_message(page_payload: dict) -> str | None:- if not page_payload.get("has_more"):- return None- next_command = page_payload.get("next_command")- if next_command:- return f"More records are available. Continue with: {next_command}"- return "More records are available. Add --page to continue."--def _paginated_fields(page_result, *, command: list[str], include_next_command: bool = True) -> dict:page_payload = pagination_payload(page_result,next_command=_next_command(command, page_result) if include_next_command else None,)fields = {"pagination": page_payload}- message = _pagination_message(page_payload)- if message:- fields["message"] = message+ # ``next_command`` is the continuation whenever the command can be replayed;+ # only a page it cannot name (SQL piped on stdin) needs telling how to go on.+ if page_payload["has_more"] and "next_command" not in page_payload:+ fields["message"] = i18n_t("common.moreRecordsAddPage", _configured_cli_language())return fields+def _text_page_continuation(payload: Mapping[str, object]) -> Optional[str]:+ """How a text printer tells a person to continue; JSON carries ``pagination.next_command``."""++ pagination = payload.get("pagination")+ next_command = pagination.get("next_command") if isinstance(pagination, Mapping) else None+ if next_command:+ return i18n_t("common.moreRecordsContinueWith", _configured_cli_language(), command=next_command)+ message = payload.get("message")+ return str(message) if message else None++def _print_definition_list_payload(page_result,*,@@ -1084,8 +1095,8 @@ def _print_definition_list_payload()-def _print_definition_payload(definition, **fields) -> None:- _print_cli_payload("run_definition", definition=definition, **fields)+def _print_definition_payload(definition, *, warnings: Optional[list[dict]] = None) -> None:+ _print_cli_payload("run_definition", definition=definition, **({"warnings": warnings} if warnings else {}))def _parse_cli_time_filter(value: str | None, *, field_name: str, help_command: str) -> str | None:@@ -2571,40 +2582,6 @@ def _task_command_preview(task) -> str:return command_line_preview(shell_command, command)-def _task_display_name(task) -> str:- # A command task stores no message, so the command itself is the only human-readable- # label the list has; without this fallback those rows rendered with an empty name.- return task.name or _task_message_preview(task.prompt) or _task_command_preview(task)---def _task_state(task) -> str:- if _is_failed_one_shot(task):- return "failed"- if _is_completed_one_shot(task):- return "completed"- if task.enabled:- return "active"- return "paused"---def _task_last_status(task) -> str:- """Historical compatibility field; never used to determine lifecycle.-- Deliberately three-valued and identical to ``_task_projection_last_status``.- An earlier revision of this change added a fourth value, ``degraded``, here —- before #1061 demoted the field. Keeping that would have put new semantics on a- field declared compatibility-only AND made the two spellings of ``last_status``- disagree about their own vocabulary. Health is reported in its own fields,- computed once in ``_enrich_definitions`` and read back by everything else.- """-- if task.last_run_at and task.last_error:- return "failed"- if task.last_run_at:- return "succeeded"- return "never_run"--def _task_next_run_at(task) -> Optional[str]:return compute_next_run_at(enabled=task.enabled,@@ -2631,173 +2608,147 @@ def _task_schedule_summary(task) -> str:return schedule_type-def _task_payload(task, *, brief: bool = False):- """The stored row alone, for the one case that has no projection to read.+def _present_fields(payload: Mapping[str, object]) -> dict:+ """``payload`` without the keys that say nothing: null, empty text, empty collections."""- Carries no health: derived health is a fact about ``agent_runs`` that only- ``_enrich_definitions`` computes, and a payload builder that answered it from- a second query of its own is how the CLI came to disagree with every other- surface. Callers reach this only when the read-back finds nothing — the- file-backed store has no run history at all — where degrading to the stored- fields beats inventing a badge.- """-- derived = {- "display_name": _task_display_name(task),- "message_preview": _task_message_preview(task.prompt),- "state": _task_state(task),- "last_status": _task_last_status(task),- "next_run_at": _task_next_run_at(task),- "schedule_summary": _task_schedule_summary(task),- # Command-task facts. ``kind`` is what every surface branches on, and- # ``on_failure`` is carried even for message tasks so the key never has to be- # probed for existence.- "kind": _task_kind(task),- "on_failure": _task_on_failure(task),- "command_preview": _task_command_preview(task),+ return {+ key: value+ for key, value in payload.items()+ if value is not None and value != "" and value != [] and value != {}}- if brief:- return {- "id": task.id,- "name": task.name,- "display_name": derived["display_name"],- "kind": derived["kind"],- "last_exit_code": task.last_exit_code,- "state": derived["state"],- "last_status": derived["last_status"],- # ``last_error`` used to be dropped here, which left the list a user- # actually runs unable to say WHY anything was failing.- "last_error": task.last_error,- "next_run_at": derived["next_run_at"],- "schedule_type": task.schedule_type,- "schedule_summary": derived["schedule_summary"],- "session_id": task.session_id,- "session_key": task.session_key,- "agent_name": task.agent_name,- "post_to": task.post_to,- "deliver_key": task.deliver_key,- "timezone": task.timezone,- "enabled": task.enabled,- }- payload = task.to_dict()- from storage.message_deliveries import public_message_metadata-- payload["metadata"] = public_message_metadata(payload.get("metadata") or {})- payload.update(derived)- return payload-_CANONICAL_DEFINITION_FIELDS = (- "lifecycle_state",- "lifecycle_detail",- "lifecycle_finished_at",- "next_run_at",- "waiting_since",- "running_since",+#: Legacy spellings no CLI payload prints: ``prompt`` repeats ``message``, and the+#: three delivery columns name the target Session the way ``session_id`` replaced.+_CLI_LEGACY_FIELDS = frozenset({"prompt", "session_key", "post_to", "deliver_key"})+#: How the Workbench renders a record's target Session; ``vibe session get``+#: reports the Session itself.+_WORKBENCH_SESSION_LABEL_FIELDS = frozenset(+ {+ "session_title",+ "session_platform",+ "session_scope_kind",+ "session_label",+ "session_project_name",+ "session_is_workbench",+ "session_openable",+ }+)+#: ``prefix`` is the legacy spelling of a watch's ``message``.+_CLI_OMITTED_DEFINITION_FIELDS = _CLI_LEGACY_FIELDS | _WORKBENCH_SESSION_LABEL_FIELDS | {"prefix"}+#: ``request_type`` repeats ``run_type`` and ``task_id`` repeats ``definition_id``;+#: ``callback_session`` and ``source_session`` are Workbench labels of two more Sessions.+_CLI_OMITTED_RUN_FIELDS = (+ _CLI_LEGACY_FIELDS+ | _WORKBENCH_SESSION_LABEL_FIELDS+ | {"request_type", "task_id", "callback_session", "source_session"})-#: Derived failure health, forwarded verbatim beside the canonical lifecycle-#: fields — NOT folded into ``lifecycle_state`` and NOT smuggled into-#: ``last_status``.-#:-#: Health and lifecycle are ORTHOGONAL axes. A cron that fails every night is-#: ``waiting`` between fires and ``failing`` the whole time; that combination is-#: precisely the case this exists to surface. Folding health into-#: ``lifecycle_state`` would need a fifth value in a closed four-value vocabulary-#: the Workbench switches on three ways (icon, pill class, i18n key), or would lose-#: one of the two axes.-#:-#: ``last_status`` is the other wrong home: it is explicitly a compatibility field-#: that never determines lifecycle, so putting new semantics there would leave the-#: canonical projection unable to see that a definition is broken — which is the-#: original defect one layer up.-#:-#: These ride the same store row as the canonical fields, because the health query-#: is computed in ``_enrich_definitions`` — the one chokepoint every list, show and-#: Workbench read already passes through.-_DEFINITION_FAILURE_FIELDS = (- "health",- "consecutive_failures",- "recent_failures",- # Watches keep waiter health above and expose their downstream Agent Run- # history independently. Tasks omit these keys.- "processing_health",- "processing_consecutive_failures",- "processing_recent_failures",- # The one field that says WHY, dropped from the brief list payload before.- "last_error",- "resume_blocked",++#: Each health verdict with its failure counters. Health and lifecycle are+#: orthogonal axes -- a nightly cron that fails every run is ``waiting`` between+#: fires and ``failing`` the whole time -- so the verdict rides beside+#: ``lifecycle_state`` rather than inside it. A watch keeps its waiter verdict in+#: ``health`` and the verdict on the Agent Runs its events started in+#: ``processing_health``; a task has only the first.+_DEFINITION_HEALTH_VERDICTS = (+ ("health", ("consecutive_failures", "recent_failures")),+ ("processing_health", ("processing_consecutive_failures", "processing_recent_failures")),+)+_DEFINITION_HEALTH_FIELDS = frozenset(+ field for verdict, counters in _DEFINITION_HEALTH_VERDICTS for field in (verdict, *counters))-def _task_projection_state(task: Mapping[str, object]) -> str:- """Compatibility ``state`` derived from the canonical lifecycle fields."""+def _definition_health_fields(row: Mapping[str, object]) -> dict:+ """Health on the CLI: a verdict only when it is not ``healthy``, counters only when set."""- lifecycle_state = task.get("lifecycle_state")- if lifecycle_state in {"waiting", "running"}:- return "active"- if lifecycle_state == "finished":- lifecycle_detail = task.get("lifecycle_detail")- if lifecycle_detail == "canceled":- return "canceled"- if lifecycle_detail in {"timeout", "error", "missed"}:- return "failed"- if lifecycle_detail == "normal":- return "completed"- return "unknown"- if lifecycle_state in {"paused", "removed"}:- return lifecycle_state- return "unknown"+ fields: dict[str, object] = {}+ for verdict, counters in _DEFINITION_HEALTH_VERDICTS:+ value = row.get(verdict)+ if value is None or value == HEALTH_HEALTHY:+ continue+ fields[verdict] = value+ fields.update({counter: row.get(counter) or None for counter in counters})+ return fields-def _task_projection_last_status(task: Mapping[str, object]) -> str:- """Historical compatibility field; never used to determine lifecycle."""+def _definition_detail_payload(row: Mapping[str, object], **derived: object) -> dict:+ """``vibe task show`` / ``vibe watch show``: every fact the projection holds, once."""- if task.get("last_run_at") and task.get("last_error"):- return "failed"- if task.get("last_run_at"):- return "succeeded"- return "never_run"+ payload = {+ key: value+ for key, value in row.items()+ if key not in _CLI_OMITTED_DEFINITION_FIELDS and key not in _DEFINITION_HEALTH_FIELDS+ }+ payload.update(_definition_health_fields(row))+ payload.update(derived)+ return _present_fields(payload)def _task_projection_payload(task: Mapping[str, object], *, brief: bool = False) -> dict:- prompt = str(task.get("prompt") or "")+ """One scheduled task for the CLI: the list row when ``brief``, else full detail.++ The row carries what an Agent decides its next step from; ``vibe task show``+ carries the rest. Both read the Harness projection the Workbench reads, so+ ``lifecycle_state`` stays the one lifecycle answer.+ """++ kind = _task_kind(task)+ if not brief:+ return _definition_detail_payload(task, kind=kind, on_failure=_task_on_failure(task))name = task.get("name")- command_preview = _task_command_preview(task)- derived = {- "display_name": str(name) if name else (_task_message_preview(prompt) or command_preview),- "message_preview": _task_message_preview(prompt),- "state": _task_projection_state(task),- "last_status": _task_projection_last_status(task),- "schedule_summary": _task_schedule_summary(task),- "kind": _task_kind(task),- "on_failure": _task_on_failure(task),- "command_preview": command_preview,- }- if brief:- payload = {+ # An unnamed task is labelled by what it does.+ preview = {}+ if not name:+ preview = (+ {"command_preview": _task_command_preview(task)}+ if kind == "command"+ else {"message_preview": _task_message_preview(str(task.get("message") or task.get("prompt") or ""))}+ )+ return _present_fields(+ {"id": task.get("id"),"name": name,- "display_name": derived["display_name"],- "kind": derived["kind"],- "last_exit_code": task.get("last_exit_code"),- "state": derived["state"],- "last_status": derived["last_status"],- "schedule_type": task.get("schedule_type"),- "schedule_summary": derived["schedule_summary"],+ **preview,+ "kind": kind,+ "schedule_summary": _task_schedule_summary(task),"session_id": task.get("session_id"),- "session_key": task.get("session_key"),"agent_name": task.get("agent_name"),- "post_to": task.get("post_to"),- "deliver_key": task.get("deliver_key"),- "timezone": task.get("timezone"),- "enabled": task.get("enabled"),+ "lifecycle_state": task.get("lifecycle_state"),+ "lifecycle_detail": task.get("lifecycle_detail"),+ "lifecycle_finished_at": task.get("lifecycle_finished_at"),+ # Only ``show --brief`` of a removed definition has one; lists never do.+ "removed_at": task.get("removed_at"),+ "next_run_at": task.get("next_run_at"),+ "waiting_since": task.get("waiting_since"),+ "running_since": task.get("running_since"),+ "last_run_at": task.get("last_run_at"),+ "last_exit_code": task.get("last_exit_code") or None,+ "last_error": task.get("last_error"),+ **_definition_health_fields(task),+ "resume_blocked": task.get("resume_blocked"),}- payload.update({field: task.get(field) for field in _CANONICAL_DEFINITION_FIELDS})- payload.update({field: task.get(field) for field in _DEFINITION_FAILURE_FIELDS})- return payload- payload = dict(task)- payload.update(derived)+ )+++def _task_fallback_projection(task) -> dict:+ """The stored row in projection form, for the one case that has no projection to read.++ Carries no health: derived health is a fact about ``agent_runs`` that only+ ``_enrich_definitions`` computes, and a payload builder that answered it from a+ second query of its own is how the CLI came to disagree with every other+ surface. Callers reach this only when the read-back finds nothing -- the+ file-backed store has no run history at all -- where degrading to the stored+ fields beats inventing a badge.+ """++ from storage.message_deliveries import public_message_metadata++ payload = task.to_dict()+ payload["message"] = task.prompt+ payload["metadata"] = public_message_metadata(payload.get("metadata") or {})+ payload["next_run_at"] = _task_next_run_at(task)return payload@@ -2883,7 +2834,7 @@ def _task_mutation_payload(task) -> dict:projected = _read_definition_projection(lambda store: store.get_scheduled_task(task.id))if projected is None:- return _task_payload(task)+ projected = _task_fallback_projection(task)return _task_projection_payload(projected)@@ -2938,27 +2889,6 @@ def _supported_task_platforms() -> set[str]:return platforms-def _is_completed_one_shot(task) -> bool:- return (- task.schedule_type == "at"- and bool(task.retired_at)- and bool(task.last_run_at)- and not task.last_error- and task.retirement_reason != TASK_RETIREMENT_SCHEDULE_MISSED- )---def _is_failed_one_shot(task) -> bool:- return (- task.schedule_type == "at"- and bool(task.retired_at)- and (- task.retirement_reason == TASK_RETIREMENT_SCHEDULE_MISSED- or (bool(task.last_run_at) and bool(task.last_error))- )- )--def _parse_validated_session_key(session_key: str,*,@@ -3997,117 +3927,44 @@ def _resolve_task_command(args, *, help_command: str) -> tuple[list[str], Optionreturn [], None, False-def _watch_command_preview(watch) -> str:- return command_line_preview(watch.shell_command, watch.command)---def _watch_display_name(watch) -> str:- return watch.name or _watch_command_preview(watch)---def _watch_state(watch, runtime_entry: Optional[dict[str, object]]) -> str:- if runtime_entry and runtime_entry.get("running"):- return "running"- if watch.enabled and watch.mode == "forever":- return "armed"- if watch.enabled:- return "pending"- if watch.last_error:- return "failed"- if watch.last_event_at:- return "completed"- return "paused"---def _watch_payload(watch, runtime_entry: Optional[dict[str, object]], *, brief: bool = False) -> dict:- derived = {- "display_name": _watch_display_name(watch),- "command_preview": _watch_command_preview(watch),- "state": _watch_state(watch, runtime_entry),- "runtime": runtime_entry or {},- }- if brief:- return {- "id": watch.id,- "name": watch.name,- "display_name": derived["display_name"],- "state": derived["state"],- "mode": watch.mode,- "session_id": watch.session_id,- "session_key": watch.session_key,- "agent_name": watch.agent_name,- "message_preview": _task_message_preview(getattr(watch, "message", None) or watch.prefix or ""),- "timeout_seconds": watch.timeout_seconds,- "lifetime_timeout_seconds": watch.lifetime_timeout_seconds,- "enabled": watch.enabled,- "last_event_at": watch.last_event_at,- "last_error": watch.last_error,- }- payload = watch.to_dict()- from storage.message_deliveries import public_message_metadata-- payload["metadata"] = public_message_metadata(payload.get("metadata") or {})- payload.update(derived)- return payload---def _watch_projection_state(watch: Mapping[str, object]) -> str:- """Compatibility ``state`` derived from canonical lifecycle and liveness."""-- lifecycle_state = watch.get("lifecycle_state")- if lifecycle_state == "running":- return "running"- if lifecycle_state == "waiting":- if watch.get("process_alive") is True:- return "running"- return "armed" if watch.get("mode") == "forever" else "pending"- if lifecycle_state == "finished":- return "failed" if watch.get("lifecycle_detail") in {"timeout", "error"} else "completed"- if lifecycle_state in {"paused", "removed"}:- return lifecycle_state- return "unknown"+def _watch_projection_payload(watch: Mapping[str, object], *, brief: bool = False) -> dict:+ """One watch for the CLI: the list row when ``brief``, else full detail.+ ``process_alive`` is a fact about the waiter process, deliberately not a state.+ The row carries it only as ``false`` on an enabled watch -- an observed waiter+ that exited while the row still claims to be armed, the case the Workbench+ marks dead. ``vibe watch show`` prints the observed value, and omits it when+ no waiter runtime has ever been observed.+ """-def _watch_projection_payload(watch: Mapping[str, object], *, brief: bool = False) -> dict:- shell_command = str(watch.get("shell_command") or "")- command = watch.get("command")- command_values = [str(value) for value in command] if isinstance(command, list) else []- command_preview = shell_command or shlex.join(command_values)+ if not brief:+ return _definition_detail_payload(watch)name = watch.get("name")- derived = {- "display_name": str(name) if name else _task_message_preview(command_preview, max_chars=120),- "command_preview": _task_message_preview(command_preview, max_chars=120),- "state": _watch_projection_state(watch),- }- if brief:- payload = {+ return _present_fields(+ {"id": watch.get("id"),"name": name,- "display_name": derived["display_name"],- "state": derived["state"],+ # An unnamed watch is labelled by the waiter it runs.+ "command_preview": None if name else _task_command_preview(watch),"mode": watch.get("mode"),"session_id": watch.get("session_id"),- "session_key": watch.get("session_key"),"agent_name": watch.get("agent_name"),- "message_preview": _task_message_preview(- str(watch.get("message") or watch.get("prefix") or "")- ),- "timeout_seconds": watch.get("timeout_seconds"),- "lifetime_timeout_seconds": watch.get("lifetime_timeout_seconds"),- "enabled": watch.get("enabled"),+ "lifecycle_state": watch.get("lifecycle_state"),+ "lifecycle_detail": watch.get("lifecycle_detail"),+ "lifecycle_finished_at": watch.get("lifecycle_finished_at"),+ # Only ``show --brief`` of a removed definition has one; lists never do.+ "removed_at": watch.get("removed_at"),+ "waiting_since": watch.get("waiting_since"),+ "running_since": watch.get("running_since"),"last_event_at": watch.get("last_event_at"),+ "last_exit_code": watch.get("last_exit_code") or None,"last_error": watch.get("last_error"),- "process_alive": watch.get("process_alive"),+ "process_alive": (+ False if watch.get("enabled") and watch.get("process_alive") is False else None+ ),+ **_definition_health_fields(watch),}- payload.update({field: watch.get(field) for field in _CANONICAL_DEFINITION_FIELDS})- # Watches get health on the same terms as tasks: ``_enrich_definitions``- # computes it for both, and a watch whose hook fails nightly is exactly as- # invisible as a task that does.- payload.update({field: watch.get(field) for field in _DEFINITION_FAILURE_FIELDS})- return payload- payload = dict(watch)- payload.update(derived)- return payload+ )def _watch_mutation_payload(watch, runtime_entry: Optional[dict[str, object]]) -> dict:@@ -4126,7 +3983,12 @@ def _watch_mutation_payload(watch, runtime_entry: Optional[dict[str, object]]) -projected = _read_definition_projection(lambda store: store.get_watch(watch.id))if projected is None:- return _watch_payload(watch, runtime_entry)+ from storage.message_deliveries import public_message_metadata++ projected = watch.to_dict()+ projected["message"] = watch.message or watch.prefix+ projected["metadata"] = public_message_metadata(projected.get("metadata") or {})+ projected["runtime"] = runtime_entry or {}return _watch_projection_payload(projected)@@ -4150,6 +4012,8 @@ def _agent_payload(agent, *, brief: bool = False) -> dict:def _run_payload(run: dict, *, brief: bool = False) -> dict:+ """One Run for the CLI: the ``vibe runs list`` row when ``brief``, else full detail."""+from storage.message_deliveries import public_message_metadatanormalized = dict(run)@@ -4161,29 +4025,32 @@ def _run_payload(run: dict, *, brief: bool = False) -> dict:else ("start" if activity_at else None))if brief:- return {- "id": normalized.get("id"),- "run_type": normalized.get("run_type") or normalized.get("request_type"),- "status": normalized.get("status"),- "agent_name": normalized.get("agent_name"),- "session_id": normalized.get("session_id"),- "definition_id": normalized.get("definition_id") or normalized.get("task_id"),- "created_at": normalized.get("created_at"),- "started_at": normalized.get("started_at"),- "last_activity_at": activity_at,- "activity_basis": activity_basis,- "activity_age_seconds": _seconds_since_iso(activity_at),- "completed_at": normalized.get("completed_at"),- "error": normalized.get("error"),- "callback_session_id": normalized.get("callback_session_id"),- "callback_status": normalized.get("callback_status"),- "callback_run_id": normalized.get("callback_run_id"),- }+ return _present_fields(+ {+ "id": normalized.get("id"),+ "run_type": normalized.get("run_type") or normalized.get("request_type"),+ "status": normalized.get("status"),+ "agent_name": normalized.get("agent_name"),+ "session_id": normalized.get("session_id"),+ "definition_id": normalized.get("definition_id") or normalized.get("task_id"),+ "created_at": normalized.get("created_at"),+ "started_at": normalized.get("started_at"),+ "last_activity_at": activity_at,+ "activity_basis": activity_basis,+ "activity_age_seconds": _seconds_since_iso(activity_at),+ "completed_at": normalized.get("completed_at"),+ "error": normalized.get("error"),+ "callback_session_id": normalized.get("callback_session_id"),+ "callback_status": normalized.get("callback_status"),+ "callback_run_id": normalized.get("callback_run_id"),+ }+ )normalized["metadata"] = public_message_metadata(normalized.get("metadata") or {})- # `prompt` is the legacy copy of `message`: every writer stores the same text in both, and the- # store already falls back to it for `message`, so the record carries that text once.- normalized.pop("prompt", None)- return normalized+ normalized["run_type"] = normalized.get("run_type") or normalized.get("request_type")+ normalized["definition_id"] = normalized.get("definition_id") or normalized.get("task_id")+ return _present_fields(+ {key: value for key, value in normalized.items() if key not in _CLI_OMITTED_RUN_FIELDS}+ )def cmd_harness_status(args) -> int:@@ -4551,7 +4418,6 @@ def cmd_task_add(args):# Deliberately BEFORE any caller default is applied: inside an Avibe Agent# shell ``AVIBE_SESSION_ID`` would otherwise bind this task to the calling# conversation, and a pure cron command could not be created from chat at all.- session_default_notice = Nonesession_policy = Nonesession_id = Nonesession_key = ""@@ -4575,7 +4441,8 @@ def cmd_task_add(args):)session_workdir = Noneelse:- session_default_notice = _apply_caller_session_default(+ # The defaulted target is the definition's ``session_id``; no notice repeats it.+ _apply_caller_session_default(args,caller_context,purpose="Task target Session",@@ -4759,12 +4626,7 @@ def cmd_task_add(args):reserved_session_id = Nonewarnings = _collect_target_warnings(session_target, delivery_target)task_payload = _task_mutation_payload(task)- payload_fields = {- "warnings": warnings,- }- if session_default_notice:- payload_fields["session_default_notice"] = session_default_notice- _print_definition_payload(task_payload, **payload_fields)+ _print_definition_payload(task_payload, warnings=warnings)return 0except Exception as exc:if reserved_session_id:@@ -4780,11 +4642,12 @@ def cmd_task_list(*,scope: SessionListScope,include_finished: bool = False,- brief: bool = True,+ query: Optional[str] = None,page_request: PageRequest = PageRequest(),):with _definition_read_store() as store:page_result = store.list_scheduled_tasks_page(+ query=query,session_id=scope.session_id,page_request=page_request,include_successful_finished=include_finished,@@ -4793,22 +4656,23 @@ def cmd_task_list(command = ["vibe", "task", "list", *scope.command_args()]if include_finished:command.append("--include-finished")+ _add_optional_arg(command, "--q", query)_print_definition_list_payload(page_result,- payload_for_item=lambda task: _task_projection_payload(task, brief=brief),+ payload_for_item=lambda task: _task_projection_payload(task, brief=True),command=command,scope=scope,)return 0-def cmd_task_show(task_id: str):+def cmd_task_show(task_id: str, *, brief: bool = False):with _definition_read_store() as store:task = store.get_scheduled_task(task_id, include_removed=True)if task is None:_print_task_error(_missing_definition_error("scheduled", task_id, action="show"))return 1- task_payload = _task_projection_payload(task)+ task_payload = _task_projection_payload(task, brief=brief)_print_definition_payload(task_payload)return 0@@ -5102,7 +4966,7 @@ def _cmd_task_update_pure_command(args, store, task) -> int:update_command_fields=True,metadata=metadata,)- _print_definition_payload(_task_mutation_payload(updated), warnings=[])+ _print_definition_payload(_task_mutation_payload(updated))return 0@@ -5601,23 +5465,19 @@ def cmd_task_run(task_id: str):_print_task_error(_missing_definition_error("scheduled", task_id, action="run"))return 1request = _task_request_store().enqueue_task_run(task.id, task=task)+ # The same one ``run`` object ``vibe agent run`` answers with._print_cli_payload("agent_run",- accepted=True,- execution_id=request.id,- run_id=request.id,- request_type=request.request_type,- task_id=task.id,- definition={"id": task.id, "definition_type": "scheduled"},- run={- "id": request.id,- "status": "queued",- "run_type": request.request_type,- "definition_id": task.id,- "agent_name": task.agent_name,- "session_id": task.session_id,- "session_policy": task.session_policy,- },+ run=_present_fields(+ {+ "id": request.id,+ "status": "queued",+ "run_type": request.request_type,+ "definition_id": task.id,+ "agent_name": task.agent_name,+ "session_id": task.session_id,+ }+ ),)return 0@@ -5794,7 +5654,7 @@ def cmd_agent_show(args):_print_task_error(TaskCliError(str(exc), code="agent_not_found", details={"agent": args.name}))return 1try:- _print_cli_payload("agent", agent=_agent_payload(agent))+ _print_cli_payload("agent", agent=_agent_payload(agent, brief=bool(getattr(args, "brief", False))))return 0except Exception as exc:_print_task_error(TaskCliError(str(exc), code="agent_not_found", details={"agent": args.name}))@@ -6862,35 +6722,20 @@ def _agent_run_is_async(args) -> bool:def _resolve_callback_session_id(args, caller_context, *, target_session_id: Optional[str] = None):+ """The Session a Run's result returns to, plus a notice only when the caller's flags do not imply it.++ An explicit ``--callback-session-id`` or ``--no-callback``, and the caller-Session+ default inside an Agent shell, all leave ``run.callback_session_id`` saying what+ happened. The one surprise is a run on the caller's own Session, which gets no+ callback because the result already lands there.+ """+explicit_callback = (getattr(args, "callback_session_id", None) or "").strip() or None- no_callback = bool(getattr(args, "no_callback", False))is_async = _agent_run_is_async(args)if explicit_callback:- return explicit_callback, {- "code": "callback_explicit",- "message": (- "Callback route recorded for this Agent Run."- if not is_async- else "Async callback will be sent to the explicit Session."- ),- "callback_session_id": explicit_callback,- }- if no_callback:- message = (- "Started async Agent Run without a callback. This run will not post its final result back into a "- "Session automatically. Track it with `vibe runs show <run-id> --brief` or by polling/listing runs for the "- "target Session. To receive a follow-up message next time, use `--callback-session-id <session-id>` "- "or run from a resolved caller context so Avibe can default the callback to the current Session."- )- if not is_async:- message = (- "Recorded an explicit no-callback policy. This synchronous run will not send a callback if it later "- "detaches into an asynchronous background run."- )- return None, {- "code": "async_run_without_callback",- "message": message,- }+ return explicit_callback, None+ if bool(getattr(args, "no_callback", False)):+ return None, Noneif caller_context is not None:caller_session_id = caller_context.session_idif target_session_id and target_session_id == caller_session_id:@@ -6901,15 +6746,7 @@ def _resolve_callback_session_id(args, caller_context, *, target_session_id: Opt"The target Session will receive the run result directly, so Avibe did not create a duplicate callback turn."),}- return caller_context.session_id, {- "code": "callback_defaulted_to_caller_session",- "message": (- "Async callback defaulted to this conversation."- if is_async- else "Callback route defaulted to this conversation."- ),- "callback_session_id": caller_session_id,- }+ return caller_session_id, Noneif not is_async:return None, Noneraise TaskCliError(@@ -7376,45 +7213,26 @@ def cmd_agent_run(args):expected_enabled_agent_id=(agent.id if agent is not None and bool(agent_name) else None),)reserved_session_id = None- resolved_scope_id = _scope_id_payload_from_session(session_id)+ # One ``run`` object. Everything the caller's own flags already decided --+ # session policy, delivery intent, fork source, close-after, sync/async --+ # stays out; what Avibe resolved for it (the Session, its scope and+ # visibility, the callback route) stays in.payload = {- "accepted": True,- "request_type": request.request_type,- "run_id": request.id,- "execution_id": request.id,- "agent": agent.name if agent else None,- "session_policy": session_policy,- "session_id": session_id,- "scope_id": resolved_scope_id,- "visibility": target.visibility if session_id else visibility,- "deliver_key": legacy_deliver_key,- "callback_session_id": callback_session_id,- "close_after": close_after,- "async": run_async,- "caller_context": caller_context.to_metadata() if caller_context else None,- "callback_notice": callback_notice,- "run": {- "id": request.id,- "status": "queued",- "run_type": request.request_type,- "agent_name": agent.name if agent else None,- "session_id": session_id,- "scope_id": resolved_scope_id,- "visibility": target.visibility if session_id else visibility,- "callback_session_id": callback_session_id,- "source_kind": source_kind,- "source_actor": source_actor,- "parent_run_id": parent_run_id,- "close_after": close_after,- },+ "run": _present_fields(+ {+ "id": request.id,+ "status": "queued",+ "run_type": request.request_type,+ "agent_name": agent.name if agent else None,+ "session_id": session_id,+ "scope_id": _scope_id_payload_from_session(session_id),+ "visibility": target.visibility if session_id else visibility,+ "callback_session_id": callback_session_id,+ }+ ),}- if bool(getattr(args, "send_now", False)) or delivery_intent != AGENT_RUN_DELIVERY_STEER:- payload["delivery_intent"] = delivery_intent- payload["run"]["delivery_intent"] = delivery_intent- if fork_result:- payload["forked_from_session_id"] = fork_result.fork.source_session_id- if fork_result:- payload["run"]["forked_from_session_id"] = fork_result.fork.source_session_id+ if callback_notice:+ payload["callback_notice"] = callback_noticeif not run_async:run_payload = _wait_for_run_result(request_store, request.id, wait_timeout=args.wait_timeout)if callback_session_id and _sync_run_detached(run_payload):@@ -7446,8 +7264,6 @@ def _wait_for_run_result(store: TaskExecutionStore, run_id: str, *, wait_timeoutrun["wait_state"] = "detached"run["handoff_reason"] = "wait_limit_reached"run["wait_elapsed_seconds"] = round(elapsed, 3)- run["accepted"] = True- run["async"] = Truereturn _run_payload(run)time.sleep(0.25)@@ -7488,8 +7304,6 @@ def cmd_runs_list(args):_add_optional_arg(command, "--created-after", created_after)_add_optional_arg(command, "--created-before", created_before)_add_optional_arg(command, "--q", getattr(args, "query", None))- if getattr(args, "brief", False):- command.append("--brief")payload = {**scope.payload(),"runs": [_run_payload(run, brief=True) for run in result.items],@@ -7516,7 +7330,10 @@ def cmd_runs_show(args):if run is None:_print_task_error(TaskCliError(f"run '{run_id}' not found", code="run_not_found", details={"run_id": run_id}))return 1- run_payload = _run_payload(run, brief=getattr(args, "brief", False))+ if getattr(args, "brief", False):+ _print_cli_payload("agent_run", run=_run_payload(run, brief=True))+ return 0+ run_payload = _run_payload(run)session_runtime = _live_session_runtime_for_run(run_payload)if session_runtime is not None:run_payload["session_runtime"] = session_runtime@@ -8085,16 +7902,11 @@ def cmd_session_list(args):)command = ["vibe", "session", "list"]_add_optional_arg(command, "--type", platform)- page_fields = _paginated_fields(result, command=command)- pagination_message = page_fields.pop("message", None)- message = _session_list_hint()- if pagination_message:- message = f"{pagination_message} {message}"_print_cli_payload("agent_sessions",sessions=[_session_row(row, brief=True) for row in result.items],- **page_fields,- message=message,+ **_paginated_fields(result, command=command),+ message=_session_list_hint(),)return 0except Exception as exc:@@ -8127,6 +7939,9 @@ def cmd_session_get(args):except Exception as exc:_print_task_error(exc, help_command="vibe session get --help")return 1+ if getattr(args, "brief", False):+ _print_cli_payload("agent_session", session=_session_row(payload, brief=True))+ return 0_print_cli_payload("agent_session",session=_session_row(payload, brief=False),@@ -8777,21 +8592,10 @@ def _vault_page_payload(args,help_command: str,command: list[str],-) -> tuple[list[dict], dict, str | None]:+) -> tuple[list[dict], dict]:page_request = _page_request_from_args(args, help_command=help_command)result = page_sequence(items, page_request)- fields = _paginated_fields(result, command=command)- return result.items, fields["pagination"], fields.get("message")---def _vault_lookup_next_steps(*, has_more: bool, has_filters: bool) -> list[str]:- steps: list[str] = []- if has_more:- steps.append("Use pagination.next_command to fetch the next page.")- if not has_filters:- steps.append("Use `vibe vault find --q <keyword>` or filter by --tag/--kind/--protection to narrow results.")- steps.append("Use `vibe vault tags` to inspect available tags.")- return steps+ return result.items, _paginated_fields(result, command=command)["pagination"]def _vault_capability_payload(secret: dict) -> dict:@@ -8833,7 +8637,7 @@ def cmd_vault_list(args):_add_optional_arg(command, "--q", query)_add_optional_arg(command, "--kind", getattr(args, "kind", None))_add_optional_arg(command, "--protection", getattr(args, "protection", None))- page_items, page_payload, message = _vault_page_payload(+ page_items, page_payload = _vault_page_payload(items=secrets,args=args,help_command=help_command,@@ -8842,14 +8646,8 @@ def cmd_vault_list(args):payload = {"secrets": page_items,"pagination": page_payload,- "next_steps": _vault_lookup_next_steps(- has_more=bool(page_payload.get("has_more")),- has_filters=bool(tags or query or getattr(args, "kind", None) or getattr(args, "protection", None)),- ),}- if message:- payload["message"] = f"{message} To narrow results instead, use `vibe vault find --q <keyword>`."- elif not page_items:+ if not page_items:payload["message"] = "No Vault secrets matched. Try `vibe vault find --q <keyword>` or ask the user to add one with `vibe vault request NAME --reason ...`."_print_cli_payload("vault_secrets", **payload)return 0@@ -8886,7 +8684,7 @@ def cmd_vault_find(args):_add_optional_arg(command, "--kind", getattr(args, "kind", None))_add_optional_arg(command, "--protection", getattr(args, "protection", None))capabilities = [_vault_capability_payload(secret) for secret in secrets]- page_items, page_payload, message = _vault_page_payload(+ page_items, page_payload = _vault_page_payload(items=capabilities,args=args,help_command=help_command,@@ -8895,14 +8693,8 @@ def cmd_vault_find(args):payload = {"secrets": page_items,"pagination": page_payload,- "next_steps": _vault_lookup_next_steps(- has_more=bool(page_payload.get("has_more")),- has_filters=bool(tags or query or getattr(args, "kind", None) or getattr(args, "protection", None)),- ),}- if message:- payload["message"] = message- elif not page_items:+ if not page_items:payload["message"] = "No Vault capabilities matched. Try a broader keyword, inspect `vibe vault tags`, or request a missing static secret with `vibe vault request NAME --reason ...`."_print_cli_payload("vault_find", **payload)return 0@@ -8928,7 +8720,7 @@ def cmd_vault_tags(args):command.append(getattr(args, "query"))_add_optional_arg(command, "--q", getattr(args, "query_filter", None))_add_optional_arg(command, "--type", getattr(args, "type", None))- page_items, page_payload, message = _vault_page_payload(+ page_items, page_payload = _vault_page_payload(items=tags,args=args,help_command=help_command,@@ -8937,14 +8729,8 @@ def cmd_vault_tags(args):payload = {"tags": page_items,"pagination": page_payload,- "next_steps": [- "Use `vibe vault find --tag <tag>` to inspect secrets under a tag.",- "Use `vibe vault edit NAME --tag <tag>` or `--skill <skill>` to update secret tags.",- ],}- if message:- payload["message"] = message- elif not page_items:+ if not page_items:payload["message"] = "No Vault tags matched. Add tags with `vibe vault edit NAME --tag <tag>` or request a new secret with tags in --spec-json."_print_cli_payload("vault_tags", **payload)return 0@@ -9187,10 +8973,6 @@ def cmd_vault_edit(args):"vault_secret",secret=secret,message="Vault metadata updated. Secret value, kind, protection tier, and existing grant member snapshots were not changed.",- next_steps=[- "Use `vibe vault list --q <keyword>` or `vibe vault find --tag <tag>` to verify the metadata.",- "Use `vibe vault run` / `fetch` / `sign` according to the secret kind when continuing the task.",- ],)return 0except vault_service.SecretNotFoundError:@@ -11531,7 +11313,8 @@ def cmd_watch_add(args):try:caller_context = caller_context_from_env()caller_user_context = caller_resource_user_context(caller_context)- session_default_notice = _apply_caller_session_default(+ # The defaulted target is the definition's ``session_id``; no notice repeats it.+ _apply_caller_session_default(args,caller_context,purpose="Watch target Session",@@ -11653,12 +11436,7 @@ def cmd_watch_add(args):watch, runtime_entry = _wait_for_watch_startup(store, runtime_store, watch.id)warnings = _collect_target_warnings(session_target, delivery_target)watch_payload = _watch_mutation_payload(watch, runtime_entry)- payload_fields = {- "warnings": warnings,- }- if session_default_notice:- payload_fields["session_default_notice"] = session_default_notice- _print_definition_payload(watch_payload, **payload_fields)+ _print_definition_payload(watch_payload, warnings=warnings)return 0except Exception as exc:if reserved_session_id:@@ -11674,11 +11452,12 @@ def cmd_watch_list(*,scope: SessionListScope,include_finished: bool = False,- brief: bool = True,+ query: Optional[str] = None,page_request: PageRequest = PageRequest(),):with _definition_read_store() as store:page_result = store.list_watches_page(+ query=query,session_id=scope.session_id,page_request=page_request,include_successful_finished=include_finished,@@ -11687,22 +11466,23 @@ def cmd_watch_list(command = ["vibe", "watch", "list", *scope.command_args()]if include_finished:command.append("--include-finished")+ _add_optional_arg(command, "--q", query)_print_definition_list_payload(page_result,- payload_for_item=lambda watch: _watch_projection_payload(watch, brief=brief),+ payload_for_item=lambda watch: _watch_projection_payload(watch, brief=True),command=command,scope=scope,)return 0-def cmd_watch_show(watch_id: str):+def cmd_watch_show(watch_id: str, *, brief: bool = False):with _definition_read_store() as store:watch = store.get_watch(watch_id, include_removed=True)if watch is None:_print_task_error(_missing_definition_error("watch", watch_id, action="show"))return 1- watch_payload = _watch_projection_payload(watch)+ watch_payload = _watch_projection_payload(watch, brief=brief)_print_definition_payload(watch_payload)return 0@@ -15303,9 +15083,10 @@ def _print_show_page_list(payload: dict) -> None:print(f" URL: {page.get('active_url') or 'none'}")print(f" Visibility: {page.get('visibility')}")print(f" Updated: {page.get('updated_at')}")- if payload.get("message"):+ continuation = _text_page_continuation(payload)+ if continuation:print("")- print(payload["message"])+ print(continuation)print("")print("Use it:")print(" - Open a page: vibe show status --session-id <session-id>")@@ -16143,9 +15924,10 @@ def cmd_show_marks(args):print(f"- {mark['id']} {mark['kind']} {mark['read_state']}")print(f" Target: {mark['target']}")print(f" Body: {mark['body_head']}")- if result.get("message"):+ continuation = _text_page_continuation(result)+ if continuation:print("")- print(result["message"])+ print(continuation)return 0except Exception as exc:_print_show_page_error(exc)@@ -18004,7 +17786,6 @@ def build_parser():agent_subparsers.required = Trueagent_list_parser = agent_subparsers.add_parser("list", help="List Avibe Agents")- agent_list_parser.add_argument("--brief", action="store_true", help=argparse.SUPPRESS)agent_list_parser.add_argument("--backend", choices=AGENT_BACKENDS, help="Filter by backend")agent_list_parser.add_argument("--include-disabled",@@ -18017,6 +17798,7 @@ def build_parser():agent_show_parser = agent_subparsers.add_parser("show", help="Show one Avibe Agent")agent_show_parser.add_argument("name", help="Agent name")+ _add_brief_arg(agent_show_parser, list_command="vibe agent list")_add_json_noop(agent_show_parser)agent_default_parser = agent_subparsers.add_parser("default", help="Set the default Avibe Agent")@@ -18212,16 +17994,11 @@ def build_parser():runs_list_parser.add_argument("--created-after", help="Filter by created_at >= timestamp, or relative value such as 6h or 7d")runs_list_parser.add_argument("--created-before", help="Filter by created_at <= timestamp, or relative value such as 6h or 7d")runs_list_parser.add_argument("--q", dest="query", help="Search common run text fields")- runs_list_parser.add_argument("--brief", action="store_true", help=argparse.SUPPRESS)_add_pagination_args(runs_list_parser, help_command="vibe runs list --help")_add_json_noop(runs_list_parser)runs_show_parser = runs_subparsers.add_parser("show", help="Show one Agent run")runs_show_parser.add_argument("run_id", nargs="?")- runs_show_parser.add_argument(- "--brief",- action="store_true",- help=i18n_t("harness.run.cli.help.showBrief", _configured_cli_language()),- )+ _add_brief_arg(runs_show_parser, list_command="vibe runs list")_add_json_noop(runs_show_parser)runs_cancel_parser = runs_subparsers.add_parser("cancel",@@ -18293,6 +18070,7 @@ def build_parser():error_help_command="vibe session get --help",)session_get_parser.add_argument("session_id", nargs="?", help="Agent Session ID")+ _add_brief_arg(session_get_parser, list_command="vibe session list")_add_json_noop(session_get_parser)session_send_now_parser = session_subparsers.add_parser("send-now",@@ -19160,9 +18938,9 @@ def build_parser():help="Include successful one-shot task history while keeping pagination",)task_list_parser.add_argument(- "--brief",- action="store_true",- help=argparse.SUPPRESS,+ "--q",+ dest="query",+ help=i18n_t("harness.cli.help.query", _configured_cli_language(), items="task"),)_add_pagination_args(task_list_parser, help_command="vibe task list --help")_add_json_noop(task_list_parser)@@ -19177,6 +18955,7 @@ def build_parser():error_help_command="vibe task show --help",)task_show_parser.add_argument("task_id", help="Task ID from 'vibe task list'")+ _add_brief_arg(task_show_parser, list_command="vibe task list")_add_json_noop(task_show_parser)task_pause_parser = task_subparsers.add_parser(@@ -19463,9 +19242,9 @@ def build_parser():help="Include successful one-shot watch history while keeping pagination",)watch_list_parser.add_argument(- "--brief",- action="store_true",- help=argparse.SUPPRESS,+ "--q",+ dest="query",+ help=i18n_t("harness.cli.help.query", _configured_cli_language(), items="watch"),)_add_pagination_args(watch_list_parser, help_command="vibe watch list --help")_add_json_noop(watch_list_parser)@@ -19480,6 +19259,7 @@ def build_parser():error_help_command="vibe watch show --help",)watch_show_parser.add_argument("watch_id", help="Watch ID from 'vibe watch list'")+ _add_brief_arg(watch_show_parser, list_command="vibe watch list")_add_json_noop(watch_show_parser)watch_pause_parser = watch_subparsers.add_parser(@@ -20152,12 +19932,12 @@ def _dispatch_parsed_command(parser: argparse.ArgumentParser, args) -> None:cmd_task_list(scope=scope,include_finished=getattr(args, "include_finished", False),- brief=True,+ query=getattr(args, "query", None),page_request=page_request,))if args.task_command == "show":- sys.exit(cmd_task_show(args.task_id))+ sys.exit(cmd_task_show(args.task_id, brief=args.brief))if args.task_command == "pause":sys.exit(cmd_task_set_enabled(args.task_id, False))if args.task_command == "resume":@@ -20191,12 +19971,12 @@ def _dispatch_parsed_command(parser: argparse.ArgumentParser, args) -> None:cmd_watch_list(scope=scope,include_finished=getattr(args, "include_finished", False),- brief=True,+ query=getattr(args, "query", None),page_request=page_request,))if args.watch_command == "show":- sys.exit(cmd_watch_show(args.watch_id))+ sys.exit(cmd_watch_show(args.watch_id, brief=args.brief))if args.watch_command == "pause":sys.exit(cmd_watch_set_enabled(args.watch_id, False))if args.watch_command == "resume":diff --git a/vibe/i18n/en.json b/vibe/i18n/en.jsonindex d2184cf44..01b73bf7d 100644--- a/vibe/i18n/en.json+++ b/vibe/i18n/en.json@@ -110,7 +110,9 @@"command": "Inspect unified Harness live state and anomalies","description": "Inspect active Runs, armed Watches, upcoming Tasks, and live anomalies.","status": "Show the bounded live/anomaly snapshot",- "statusDescription": "Show live Runs, armed Watches, upcoming Tasks, and anomalies for the caller Session. Use --session-id for another Session or --global for every Session."+ "statusDescription": "Show live Runs, armed Watches, upcoming Tasks, and anomalies for the caller Session. Use --session-id for another Session or --global for every Session.",+ "brief": "Print only the compact row that '{list_command}' prints for this record",+ "query": "Search common {items} text fields"},"error": {"sqliteRequired": "Harness status requires the SQLite task store.",@@ -206,8 +208,7 @@"bindingUnresolvedPaused": "paused: pinned agent session {session} cannot accept a turn. This definition would fail on every run. Re-point it with: vibe task update {id} --session-id <id>; then resume it with: vibe task resume {id}.","cli": {"help": {- "cancel": "Request best-effort cancellation for one run; a run already in the live Session turn stops that whole turn, like Session Stop",- "showBrief": "Show only status, timing, error, and callback fields, as in vibe runs list"+ "cancel": "Request best-effort cancellation for one run; a run already in the live Session turn stops that whole turn, like Session Stop"},"canceledBeforeLiveTurn": "Run was canceled before its input reached the live Session turn."}@@ -293,7 +294,9 @@"selectOne": "Select one","selectOneOrMore": "Select one or more","processing": "Processing `/{command}`...",- "submitted": "Submitted"+ "submitted": "Submitted",+ "moreRecordsAddPage": "More records are available. Add --page to continue.",+ "moreRecordsContinueWith": "More records are available. Continue with: {command}"},"dependencies": {"askill": {diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.jsonindex 8dcc17ee4..5caf79542 100644--- a/vibe/i18n/zh.json+++ b/vibe/i18n/zh.json@@ -110,7 +110,9 @@"command": "检查统一的 Harness 实时状态和异常","description": "检查活跃 Run、已启用 Watch、即将触发的 Task 和实时异常。","status": "显示有界的实时状态与异常快照",- "statusDescription": "显示调用方 Session 的活跃 Run、已启用 Watch、即将触发的 Task 和实时异常。用 --session-id 查看其他 Session,用 --global 查看所有 Session。"+ "statusDescription": "显示调用方 Session 的活跃 Run、已启用 Watch、即将触发的 Task 和实时异常。用 --session-id 查看其他 Session,用 --global 查看所有 Session。",+ "brief": "只输出 '{list_command}' 为这条记录打印的那一行精简记录",+ "query": "搜索常见的 {items} 文本字段"},"error": {"sqliteRequired": "Harness 状态需要 SQLite Task 存储。",@@ -206,8 +208,7 @@"bindingUnresolvedPaused": "已暂停:绑定的 Agent 会话 {session} 无法接收请求,该定义继续运行只会反复失败。请用以下命令重新绑定:vibe task update {id} --session-id <id>;然后恢复:vibe task resume {id}。","cli": {"help": {- "cancel": "\u8bf7\u6c42\u5c3d\u529b\u53d6\u6d88\u4e00\u4e2a run\uff1b\u82e5\u8be5 run \u5df2\u8fdb\u5165\u6b63\u5728\u8fd0\u884c\u7684 Session turn\uff0c\u4f1a\u50cf Session Stop \u4e00\u6837\u505c\u6b62\u6574\u4e2a turn",- "showBrief": "只显示状态、时间、错误和回调字段,与 vibe runs list 相同"+ "cancel": "\u8bf7\u6c42\u5c3d\u529b\u53d6\u6d88\u4e00\u4e2a run\uff1b\u82e5\u8be5 run \u5df2\u8fdb\u5165\u6b63\u5728\u8fd0\u884c\u7684 Session turn\uff0c\u4f1a\u50cf Session Stop \u4e00\u6837\u505c\u6b62\u6574\u4e2a turn"},"canceledBeforeLiveTurn": "\u8be5 run \u5728\u5176\u8f93\u5165\u8fdb\u5165\u6b63\u5728\u8fd0\u884c\u7684 Session turn \u4e4b\u524d\u5df2\u88ab\u53d6\u6d88\u3002"}@@ -293,7 +294,9 @@"selectOne": "选择一个","selectOneOrMore": "选择一个或多个","processing": "正在处理 `/{command}`...",- "submitted": "已提交"+ "submitted": "已提交",+ "moreRecordsAddPage": "还有更多记录。加上 --page 继续翻页。",+ "moreRecordsContinueWith": "还有更多记录。继续翻页:{command}"},"dependencies": {"askill": {