Repository navigation
Report only the sessions a user is driving, not the ones inside them - #7
Closed
CaffreySun wants to merge 1 commit into
Closed
CaffreySun wants to merge 1 commit into
CaffreySun wants to merge 1 commit into
Conversation
A session spawned inside a session drew a row of its own, so a prompt that fanned out drew as many rows as it had children (user report, 2026-09-24); and `omp -p` drew one for the few seconds the run lasted, then took it away again. The discriminator is `ctx.mode`, not the session tree. omp builds a subagent's extension runner with `initialize(actions, contextActions)` — two arguments, no mode — so `ctx.mode` takes the runner's default `"print"` whatever the parent is: measured inside a real interactive TUI session, the parent's context reads `mode: "tui"` and the child's `mode: "print"`. A subagent is therefore the same shape as `omp -p`, and one test decides both. `send()` now returns before it spawns when the mode is `"print"` or `"json"`. `send`, not the handlers: `report()` and `reportContext()` are its only callers, so a handler added later cannot reach the shim unguarded. The silent modes are named rather than the loud ones listed, so a mode this file has never heard of still reports — an extra row is visible, while a silent session is not. Two costs, both recorded in §8.8: - While a child works, nothing shows work. Measured with an async spawn (`async.enabled` defaults true): the parent's `agent_end` lands at t=11.7s, the child's last tool at t=15.76s, and the parent resumes only at t=15.76s — about four seconds in which the parent row reads "completed". The same mis-signal this project already records for Claude Code; suppressing it needs omp to send `background_tasks`, which its profile does not carry. - An install used only through `-p` never sets `lastEventAt`, which reads as `.degraded` on the manager card. `docs/ARCHITECTURE.md:1156` is the section's own verification recipe and told the reader to prove the integration with `omp -p`; that command now yields zero envelopes, so it points at an interactive run instead. The same warning is added for §6.7b's Pi recipe, which is also headless. `ExtensionTemplate.swift:9` and the §8.8 table are one table in two copies and were naming different Pi versions; §6.7b's dated 0.85.1 entry stays, since it records what was checked that day, and a note says the header's 0.87 is the installed distribution's claim rather than a behavioural re-test. Measured against a listening UDS: `omp -p` went from five envelopes to zero; an interactive run carrying one subagent went from two session ids to one, with the parent's eight events unchanged. Checks: 585 tests in 88 suites, `--status` exit 0. The assertions were checked by mutating the generator three ways — `&&` to `||`, a `|| "print"` default, and a `typeof` guard ahead of the return — each failed two tests. Co-Authored-By: Claude Code <[email protected]>
Owner
|
合并为 复核时在合并后的树上核对,两处描述与树不符(代码本身没问题):
判据在另一侧独立核对过(omp 18.3.5 源码): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
做了什么
面板上只显示用户自己启动的会话:
omp进交互界面omp -p/--mode json为什么一条规则就够
判据是扩展上下文里的
ctx.mode,不是子父关系。omp 给子代理建扩展运行时用的是
initialize(actions, contextActions)—— 只有两个参数,没有 mode,于是子代理的ctx.mode取运行时的默认值"print",即使它的父会话是交互式 TUI(实测 omp 18.3.0,pty 里真跑的一次:父mode: "tui",子mode: "print")。所以在 mode 这根轴上,子代理和
omp -p是同一种东西。一个判断同时管住两件事:两个设计选择:
send()里,不放某个 handler 里。report()和reportContext()是它仅有的两个调用者,将来新加的 handler 不可能绕过去拿到 shim。实测
对着一个监听中的 UDS 跑:
omp -p:5 个信封 → 0 个两个代价(已写进 §8.8)
async.enabled默认 true):父会话 t=11.7s 发agent_end,子代理最后的工具在 t=15.76s,父会话到 t=15.76s 才重新agent_start—— 中间约 4 秒父行显示"已完成"。这和本项目为 Claude Code 记下的是同一类误报。要修得让 omp 侧发出background_tasks信号,它的 profile 目前不带这个字段。omp -p的装机,管理窗口的卡片会显示 Degraded。 因为lastEventAt一直是 nil。进一次交互界面就变绿。顺带修正的文档问题
docs/ARCHITECTURE.md§8.8 的真机验证配方原本让读者用omp -p证明集成可用 —— 现在那条命令一个信封都不发,照着跑会把好装机判成坏的。改成指向交互式运行,并给 §6.7b 的 Pi 配方(同样是 headless)加了同样警告。§Claude Code 的 Stop 后台任务抑制那样写连说一连 numbering —— 全文其余 70 处§都带编号,改成§5.1b。background_tasks「只有 Grok 有」是错的:Claude Code 靠默认字段名background_tasks走同一条抑制路径,Grok 只是显式声明了backgroundTasks。--json这个 flag —— 它不存在,实测omp --json报Error: unknown flag。正确写法是--mode json。ExtensionTemplate.swift:9与 §8.8 表格是同一张表的两份副本,之前分别写着 Pi 0.85 与 0.87。§6.7b 那条带日期的 0.85.1 保留原样(它记的是当天核查的版本),另加一句说明表头的 0.87 是装机发行物的口径、不是行为重测。测试
585 tests / 88 suites 全绿(原 583 + 新增 2)。
新增的两条测试用变异验证过:把生成器分别改成
&&→||、给 mode 加|| "print"默认值、在 return 前插typeof守卫 —— 三种各让 2 条测试失败,改回后通过。(第一版的断言只查了两个 mode 名子串,对||也成立,等于把闸门改成失效而测试仍绿;这条是审查时发现的,已修。)生效方式
改的是生成模板。要让已装应用用上,需对 omp(和 Pi)重新执行一次 Configure —— 扩展在会话启动时加载,还要新起一个会话。