Repository navigation
fix(agents): 避免重复记录附件准备的权限异常 - #1219
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
简介
关联 #1189。已接收附件的项目目录可以由用户恢复。复核时,在主干连续执行两轮恢复扫描,PostgreSQL 中原 Input 保持 pending,MinIO 中的原文件仍可读。重建同一路径后,原 Input 创建了 Run,写回的文件字节与上传一致。相同用例在 #1189 的
7304f58d1得到 cancelled,恢复目录也失去了继续处理原消息的机会。另一个问题可在主干稳定复现。让 linked 项目目录可打开但不可写,提交和随后两次恢复会为同一个 Input 打印三份 PermissionError 异常栈,调用方只看到通用准备失败。此修复让 Input 快照提示权限不足,保留第一次异常栈。恢复权限后,原输入和附件继续处理。
具体改动与影响
附件准备服务在已有保存点回滚后,读取附件行上一次持久化的错误。准备阶段直接收到 PermissionError 时,连续相同的权限故障仅记录首次异常栈。其他异常沿用既有报告方式。复用现有 attachment_error 字段和来源保留流程,无需迁移。
实现依据与设计取舍
输入队列承诺保留已接收消息及附件,允许目录恢复或用户显式取消。按输入年龄自动取消可能丢掉可以恢复的消息。决策补充在工作目录与缺失后的执行约束。故障分类和日志均由附件准备服务负责。
验证情况
pytest -q test/integration/services/test_input_attachments.py,33 项通过。新增用例在修改前因三次记录同一权限错误失败;修正后回读原 Input 的 Run、附件归属、MinIO 来源与 Workdir 最终字节。补强断言后单独重跑新增用例通过,唯一日志包含 PermissionError 和 traceback。python3 scripts/ci/verify_engineering_contracts.py、python3 -m unittest scripts.ci.test_verify_engineering_contracts(56 项)、变更文件 Ruff check 与 format --check、决策记录相对链接、cd docs && pnpm run build、git diff --check均通过。cd backend && uv run --no-sync --group test pytest test/unit -m "not slow" -q,4267 passed、1 skipped。本地docker compose exec api因缺少私有 Compose override 无法启动该命令。独立审阅与未验证范围
独立 Reviewer 核对原 PR、主干契约、替代方案、diff 和实际用例。已按意见明确权限错误的范围,并验证首次日志携带异常类型与诊断栈。
恢复测试直接调用调度入口并从独立数据库会话回读结果。本地未等待常驻 worker 的定时扫描,也未运行完整模型推理。
关联事项
替代 #1189。