Repository navigation
增强可观测性与归因:session_recreated、双轨看门狗、路径归因 (PR-3) - #31
Merged
Fei2411 merged 7 commits intoOct 6, 2026
Merged
Conversation
- session/load 失败静默回退改走 pending_warnings + session_recreated 转录事件(H-05) - WORKER_ACTIVITY_TYPES 白名单:仅 worker 输出事件重置活跃钟;新增 turn_timeout_sec 硬上限(H-16) - SKIP_DIR_NAMES 补 .agent-bridge/.codex/.claude;快照跳过 junction;逃逸路径进 files_outside_cwd(H-06/E2/E3) - transcript.forget_session 挂到会话淘汰,清缓存+删转录(H-02) - stdout readline 超限转译为带数值的 RuntimeError(H-10)
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
- _classify_path 未解析回退:先判 ../ 再 lstrip——原顺序 lstrip 会先吃掉 ../,逃逸路径被折回 cwd 内 - session_recreated 事件与 pending_warning 移到 session/new 成功之后;fallback 失败即任务失败,不再虚报已重建 - _ignored_rel 拆分 reported/snapshot 两级:磁盘快照仍跳过 .codex/.claude(churn 控制),worker 显式报告的该目录路径作为有意项目配置修改予以保留
- _classify_path ../回退:返回 normpath(root/path) 的词法绝对路径——files_outside_cwd 契约是绝对路径,原样返回 '../x' 违约 - ensure_session:session/new 成功后立即落地 native_session_id,再做 append_event 等可失败簿记——转录写失败不再把已拒绝的旧 id 留在会话上
项目 cwd 内的 .codex/.claude 是合法项目配置(如 .codex/config.toml),快照跳过会让 worker 的真实配置修改从 files_changed 消失;worker 自身状态目录位于其 home、不在 cwd 内,不受影响。SKIP_DIR_NAMES 只保留 .agent-bridge(bridge 簿记目录),随之回收 _REPORTED_SKIP 拆分
DirEntry.is_junction 是 3.12 新增;3.11 上回落恒 False 导致 junction 被遍历(CI windows-3.11 挂)。改用 st_file_attributes & FILE_ATTRIBUTE_REPARSE_POINT——跨版本可用的重解析点检测
REPARSE_POINT 属性会连 OneDrive 云目录等非 junction 一起跳过,丢失其下真实改动。改用 os.path.ismount——仅匹配 IO_REPARSE_TAG_MOUNT_POINT(junction/卷挂载),云重解析目录照常遍历;全版本可用
os.path.ismount 对目录 junction 返回 False(只认卷挂载),且 POSIX 上误伤真实挂载目录。改用 DirEntry.is_junction(3.12+)或 realpath(entry) vs realpath(dirname)/name 比对:junction 解析到别处,普通目录/云重解析目录/POSIX 挂载解析为自身、照常遍历
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.
Summary
看门狗语义与工作区归因的修复。
session/load失败的静默session/new回退现在产生pending_warnings→task.warnings,并落session_recreated转录事件(旧 session id + 消毒原因)。AcpUnavailableError(auth/断连/进程退出)仍响亮传播。WORKER_ACTIVITY_TYPES= {message_chunk, thought_chunk, tool_call, tool_call_update, plan, raw},只有 worker 真实输出重置活跃钟——此前 bridge 自写事件(prompt_sent/turn_end/error/permission)也续命,心跳型 worker 永不 stall;新增AgentConfig.turn_timeout_sec(默认 0=禁用)硬上限,stop_reason分stalled/timed_out。SKIP_DIR_NAMES+=.agent-bridge/.codex/.claude;快照 DFS 跳过 Windows junction;_classify_path返回(inside_rel, outside_abs),逃逸路径进新字段files_outside_cwd(绝对 posix)——..\x不再折叠成内部x。files_changed语义收窄为 cwd 内。transcript.forget_session挂到_prune_sessions,会话淘汰时清缓存并删转录文件;end_session保留转录作调试证据。readline()超 16 MiB 转译为带数值的 RuntimeError;stderr 排空警告明示上限。注意:与 PR-2 都在
AgentConfig相邻区加字段——先合者无碍,后合者在config.py有一处两行文本冲突,语义兼容。测试:+9 用例(session_recreated 端到端、活跃钟白名单、turn_timeout 硬 cap、inside/outside 拆分、junction 等),全套 630 passed / 1 skipped。
Link to Devin session: https://app.devin.ai/sessions/b270264aa3634bc5934cad9bcec9f9ae
Open in Devin Desktop: https://app.devin.ai/desktop/session/b270264aa3634bc5934cad9bcec9f9ae?variant=devin
Requested by: @FeiZhuLulu