Repository navigation
fix(codex): 状态栏会话 ID 识别兼容同段 warning 后缀 - #1768
Merged
Merged
Conversation
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 9, 2026 10:32
#1635 引入的 adopt 身份识别要求 thread-id 是状态栏里一个独立的空白分隔 token。但部分 Codex 版本/状态下右侧的 `⚠ N warnings · f2 to view` 提示 以空格右对齐填充(不是用 ` · ` 连接),会和 thread-id 落在同一物理行的 同一分段,严格的整段 UUID 判定失败 → refresh 恒 unavailable,共享后台 adopt 会话每条消息都被拒写(v3.34.0 引入,v3.37.0 仍在)。 修法(保留全部既有归属校验): - 分段后只接受「UUID 在段首、且其后紧跟空白或段结束」的段:前导仅允许 空白与 braille spinner,后缀允许空格分隔的装饰(spinner、右对齐 warning)。用「下一个字符必须是空白」的正断言替代原来的 `(?![\\w-])`,使 `/tmp/<uuid>`(UUID 不在段首)以及 `<id>.json`、 `<id>/sub`、`<id>:x`、`<id>,foo` 这类路径/扩展/冒号粘连都不绑定。 - 后缀中若再出现一个完整 UUID 视为歧义丢弃该段;整个 footer 带仍要求 恰好一个 ID;截断 ID 不匹配。 - 第二行 footer 白名单按 codex warning_notice.rs 的宽度降级形态放宽为 认 `⚠ N` 前缀(full `⚠ N warnings · f2 to view` / compact `⚠ N · f2` / minimal `⚠ N`,兼容可选 U+FE0F)。该白名单只校验行 形态,不参与 ID 提取。 验证:真机 codex 0.160 + tmux 抓的原生 warning 文案,生产模块 15 例 正反矩阵全过(同段 warning 绑定、compact/minimal 第二行绑定、cwd 独占 段拒绝、cwd+真 ID 同帧只认真 ID、.json//sub/:x/,foo/-x 粘连拒绝、同段 双 UUID fail-closed、截断拒绝);新增 8 正例 6 反例;bun 原生 57 项、 vitest codex/adopt 全套绿、bun run build 通过;变异 6 组均红。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
force-pushed
the
fix/1635-warning-suffix
branch
from
October 9, 2026 11:22
91af864 to
27e6da5
Compare
|
🚀 Released in v3.39.0 |
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.
背景
#1635(v3.34.0 首发)为共享后台 tmux adopt 增加了「发消息前先从终端状态栏确认当前 thread-id,否则拒写」的校验。有同学反馈升级后 adopt 的 Codex 会话消息被拒写,版本比对确认是 v3.34.0 引入、v3.37.0 仍在的回归(≤ v3.33 无此检查)。
根因
身份识别要求 thread-id 是状态栏里一个独立的空白分隔 token(按
·拆段后整段全等 UUID)。但部分 Codex 版本/状态下,右侧的⚠ N warnings · f2 to view提示是右对齐、用空格填充拼到状态行,而不是用·与 thread-id 连接——UUID 与 warning 落在同一物理行的同一分段(01a1…4476 ⚠ 1 warning · f2 to view),严格全等判定失败,refresh恒为unavailable,该 adopt 会话每条飞书消息都被拒写。busy spinner 此前已靠剥首尾 braille 兼容,warning 后缀漏了。修法(保留全部既有归属校验)
(?:\s…)?$)而非仅排除词字符,使/tmp/<uuid>(UUID 不在段首)以及<id>.json、<id>/sub、<id>:x、<id>,foo这类路径/扩展/冒号/逗号粘连都不绑定。warning_notice.rs的宽度降级形态放宽为认⚠ N前缀:full⚠ N warnings · f2 to view→ compact⚠ N · f2→ minimal⚠ N,并兼容可选 U+FE0F emoji 表现形。该白名单只校验第二行形态,不参与 ID 提取。影响面
仅
codex-terminal-session.ts的状态栏解析(codex adopt 共享后台分支);旧版/托管 TUI(持有 rollout fd)、explicit app-server、非 tmux、其它 CLI 路径不变。验证
.json//sub/:x/,foo/-x粘连拒绝、同段双 UUID fail-closed、截断/无 ID 拒绝。bun test原生codex-terminal-session57 项全绿(write-input 157、statusline-config 30 亦绿);vitest 相关 5 文件 255 绿;bun run build通过。(?![\w-])(.json等误绑,4 红)、warning 白名单退回要求warnings词(compact/minimal 不识别,4 红)、删后缀第二 UUID 歧义检查(1 红)、删 warning 第二行白名单(1 红)、去段首锚改任意位置搜索导致/tmp/<uuid>误绑(4 红)、回退整段全等(2 红)。边界
完整「飞书发消息→真机 adopt 会话收到回复」daemon 级端到端仍建议部署后补一次验收(与 #1635 遗留验收项一致)。
🤖 Generated with Claude Code