Repository navigation
Conversation
Kuddev
left a comment
There was a problem hiding this comment.
我逐行检查了 9c3c0d0,在隔离的 Linux 工作树跑了相关测试:设置层 3 项、应用层 6 项全部通过。合入前请补齐规则与目标 Shell 不相容时的反馈。
规则编辑器只检查通用语法,符合语法就显示「已保存」。但 Cmd 路径会拒绝包含双引号、百分号或感叹号的参数。例如现有 PowerShell 回归中的 model_provider="custom" 可以保存,在 Cmd 会导致整条会话恢复失败。当前恢复只显示通用错误,用户不知道应停用哪个规则。
建议指出具体规则及目标 Shell,并允许用户显式选择「本次不应用规则」后重试。同时请补一个真正通过 cmd.exe 启动探针的 argv 回归,覆盖可传递的带空格参数及不可传递参数的反馈。现有 Windows 原生 argv 用例只运行两个 PowerShell。
|
感谢逐行审阅!已按建议全部补齐并推送新提交:
(注:原提交 |
Kuddev
left a comment
There was a problem hiding this comment.
复审了 b97f34ab。设置页预警和原生 cmd.exe 参数测试已补齐,五平台原生套件通过。我也在 Linux ARM64 编译运行了本提交的参数解析、恢复状态和通知格式化代码:16 项通过、1 项跳过,其中 3 项复现了下面的问题。请修正后再合并。
- 阻断通知会带出整条参数。 恢复失败分支 把规则原文放进通用通知。用带假标记的规则验证,后台窗格会把标记同时交给应用内横幅的日志正文和系统通知预览;关闭应用内 AI 通知也仍走系统通道。参数可能包含凭据或私有路径。请只在通知中保留智能体名、Shell 和失败原因,原文留在设置里编辑;补一个假标记不出现在通知正文的回归。
- 用户另开会话后,旧恢复仍占用当前窗格。 旧会话被规则阻断后,在同一窗格手动打开另一个会话,身份校验 仍拒绝新会话 ID;命令结束后,「本次不应用规则」依然会提交旧命令。重试条件 也允许在已标记有命令运行、尚未识别出程序名时排队。请让显式的新命令或会话替换旧恢复尝试,并确认重试只适用于仍属于当前窗格的那次阻断。建议覆盖「阻断旧会话 → 手动打开另一会话 → 新会话正常登记,旧重试消失」。
pr-size 统计了 1,759 行源码改动,超过 1,500 行默认门槛。这两项修正前先不加豁免标签;如果要拆,建议把规则设置与实际接入恢复流程按可独立验证的职责划分。
|
已按审阅意见在
关于 |
…ession recovery Split out the graphical Settings editor pane into an independent follow-up module per review guidance so this PR stays within a single cohesive, independently verifiable boundary (1,278 changed source lines, size/L): - Keep [agent_resume_args] persistence and reset contracts in nebula_settings. - Keep CLI suffix / JSON array validation, POSIX/PowerShell/cmd.exe literal argv quoting, and native Windows shell argv probes. - Keep TerminalView session Resume/Fork rule application, desensitized blocked-rule diagnostics, one-shot "Continue without rule" bypass, and attempt superseding when a new command or manual session starts.
|
补充更新(
|
Result / 用户结果
Add per-agent extra CLI argument rules (
agent_resume_args_<slug>andagent_resume_enabled_<slug>innebula_settings.txt), allowing users to configure and enable/disable custom CLI suffixes per coding agent (claude,codex,antigravity,gemini,opencode,cursor,kimi,pi,omp,copilot,grok,amp) — such as--yolofor Codex/OpenCode or--dangerously-skip-permissionsfor Claude Code/Antigravity. (The graphical editor pane underSettings → Agentsis split out into an independent follow-up PR so each module remains withinsize/L.)Automatically append active per-agent rules (quoted safely for the target pane's shell) when Pebrel resumes or forks an AI session across cold session recovery,
pisession file resolution,codex resumefallback, tab context-menu Fork, and Command Palette Resume/Fork.Surface desensitized shell-compatibility / syntax feedback and explicit one-shot bypass when a rule cannot be passed safely (for example,
"/%/!incmd.exeor malformed syntax): failed session Resume/Fork names only the agent, target shell, and failure reason (never echoing the raw rule text) with an explicit Continue without rule / 本次不应用规则 action in the pane recovery banner and tab context menu (without altering saved settings), and automatically supersedes stale blocked recovery when an explicit command or manual session starts in the pane.Ordinary terminal startup commands, disabled rules, and agents without configured rules remain untouched; invalid or unquoted shell-operator inputs fail closed during session recovery.
在
nebula_settings.txt中新增按智能体独立配置的规则式附加命令行参数合同(agent_resume_args_<slug>与agent_resume_enabled_<slug>),支持为各智能体(Claude Code、Codex、Antigravity、Gemini、OpenCode、Cursor、Kimi、Pi、Oh My Pi、Copilot、Grok、Amp)单独配置并启停恢复/分叉后缀规则(图形化设置编辑面板按职责边界拆分至独立后续 PR,使本 PR 保持在size/L范围内)。在冷启动会话恢复、
pi会话文件解析、codex resume选择回退、标签页右键分叉(Fork)以及命令面板(Command Palette)恢复/分叉时自动按当前终端 Shell(POSIX、powershell.exe、pwsh.exe、cmd.exe)安全转义并附加已启用的规则参数。补齐规则与
cmd.exe不相容或语法无效时的脱敏提示、显式单次重试与旧状态让位:在恢复或分叉被拦截时,终端底部恢复横幅与后台通知仅报告具体智能体名称、目标 Shell 与原因(不回显可能含凭据或私有路径的规则原文),并在底部横幅与标签页右键菜单提供显式的 「本次不应用规则」 按钮(仅本次跳过规则重试,不修改已保存配置);当窗格运行新命令或手动打开其他会话时自动取代旧阻断恢复状态。普通终端启动命令、已停用规则及未配置规则的智能体保持原有行为;包含未加引号 Shell 运算符或语法错误的输入按 fail-closed 拒绝执行。
Design / 设计边界
Responsibility and affected modules:
nebula_settings/src/agent_resume.rsandnebula_settings/src/reset.rs: zero-dependency persistence contract (agent_resume_args_<slug>+agent_resume_enabled_<slug>), canonical rule ordering, case-insensitive lookup, and full cleanup on settings reset.nebula_app/src/agent_resume.rsandnebula_app/src/platform/agent_resume.rs: application-layer validation/tokenization (AppendError::{InvalidSyntax, IncompatibleShell}), and native per-shell argv quoting (Posix,powershell.exelegacy Windows quoting,pwsh.exe, andcmd.exetrailing-backslash escaping).nebula_app/src/gpui_shell/terminal/view/startup_command.rs,session_failure.rs,agent_activity.rs,runtime.rs,view.rs,workspace/tab_menu.rs,workspace/session_recovery.rs,workspace/agents.rs, andworkspace/palette.rs: applysubmit_with_resume_rule/run_agent_session_commandexclusively at confirmed AI session Resume/Fork entrypoints (after tab insertion so background notifications resolve pane tab ownership), surface desensitizedBlockedResumeRulebanner/toast diagnostics, implement one-shotretry_without_rule, and supersede inactive/blocked attempts when a new command or manual session starts.Why this belongs here; interfaces that remain unchanged:
nebula_settingsretains its zero-production-dependency contract by storing raw rule strings and booleans without shell or UI types; shell quoting stays innebula_app/src/platform/. Existing session identity persistence (AgentSession) and agent hook protocols are unchanged.Dependency, data-format, threading, or lifetime changes (ADR if applicable):
agent_resume_args_<slug>andagent_resume_enabled_<slug>(defaulting to enabled whenargsis present andenabledis omitted) innebula_settings.txt, cleared on reset. Decision recorded inarchitecture/notes/nebula_settings/agent_resume/2026-11-10-agent-resume-fork-rules.mdand linked fromnebula_settings/AGENTS.md.Compatibility and migration/fallback behavior:
职责划分与涉及模块:
nebula_settings/src/agent_resume.rs、reset.rs:维持零生产依赖合同,负责agent_resume_args_<slug>与agent_resume_enabled_<slug>的读写、稳定排序与重置清理。nebula_app/src/agent_resume.rs、nebula_app/src/platform/agent_resume.rs:负责自然命令行后缀与 JSON 字符串数组双格式解析(区分InvalidSyntax与IncompatibleShell),以及针对 POSIX、powershell.exe、pwsh.exe、cmd.exe的原生字面量参数转义。startup_command.rs、session_failure.rs、agent_activity.rs、runtime.rs、tab_menu.rs、session_recovery.rs、workspace/agents.rs、workspace/palette.rs:仅在确认的 AI 会话恢复与分叉入口应用规则(并在标签插入工作区后触发以保证通知路由可达),在规则被拦截时展示脱敏提示及显式「本次不应用规则」重试入口,并在新命令或手动新会话启动时自动作废旧恢复尝试。Evidence / 验证依据
cargo test -p nebula-settings --locked-> passed (110 passed)cargo test --manifest-path tools/i18n-contract/Cargo.toml --locked-> 24 passed, 0 failed, 1 ignoredcargo test -p nebula --bin pebrel --features gpui-shell,gpui-test-support --locked agent_resume-> passed (6 passed: unit + nativepowershell.exe/pwsh.exe/cmd.exeargv probe + terminal restore/fork/cmd.exedesensitized notice/banner + one-shotretry_without_rule+ manual session / running command superseding)cargo test -p nebula --test file_line_budget --locked-> passedpy -3.12 -m unittest scripts.tests.test_ci_native_tests scripts.tests.test_architecture_budgets scripts.tests.test_architecture_dependencies scripts.tests.test_architecture_governance-> passedpy -3.12 scripts/check_architecture.py --base 8f69d3327000976bcc56442ffaedfcd8a1e24159-> passedpy -3.12 scripts/check_prohibited_names.py range --base 8f69d3327000976bcc56442ffaedfcd8a1e24159 --head HEAD-> passedpy -3.12 scripts/check_platform_cfg.py-> passed (459 / budget 459)agent_resume_rules_default_to_empty_and_round_trip,disabled_or_removed_rules_preserve_canonical_state,reset_clears_every_agent_resume_rule,natural_suffix_and_json_array_append_quoted_arguments_across_shells,shell_injection_and_malformed_inputs_are_rejected,windows_powershell_and_pwsh_deliver_the_exact_native_argument_array,agent_resume_and_fork_rules_append_quoted_arguments_and_respect_enabled_toggle, andagent_resume_blocked_recovery_yields_to_manual_sessions_and_running_commands.en-US.jsonandzh-CN.jsonwith English fallback for partial catalogs (i18n-contractverified). Blocked terminal panes renderblocked-resume-rulewithsession-retry-without-ruleandsession-rule-dismisscontrols plus tab context-menuSessionRetryWithoutRule.Required Review / 必须确认
CONTRIBUTING.md,docs/architecture.md, anddocs/project-constraints.md.python3 scripts/check_architecture.py --base 8f69d3327000976bcc56442ffaedfcd8a1e24159passes; budgets were not inflated to fit the change.