microskills: a command wrapped in bash -lc or zsh -lc is not observed

未关闭 适合新手
#343 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Shizoqua 已经在做这个了。

开始于 2026年11月27日。

  • #345 来自 @Shizoqua —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
bash, python, zsh
领域
devtools

调研方向

从 tokeneconomizer/microskills/observe.py 中的 unwrap 和 _WRAP_RE 开始,然后追踪 classify_command 如何调用它。loopguard/turn 中的 _pieces 和 _SHELLS 已经按路径和脚本处理 shell 名称,请参照其做法。运行 issue 中的离线复现。当 bash -lc 'pytest -q'、/bin/zsh -lc 'pytest -q' 和 /bin/bash -lc 'pytest -q' 都返回 [('run_tests', 'pytest')] 时即完成。

由索引模型根据 Issue 内容生成。

描述

unwrap in tokeneconomizer/microskills/observe.py strips a shell wrapper only when it is spelled /bin/bash -lc or /bin/sh -c (_WRAP_RE). Codex runs each shell call as [<user's shell>, "-lc", <script>] (Shell::derive_exec_args in codex-rs), so the shell comes by name or by path, and is /bin/zsh for a user on macOS's default shell. A rollout's argv such as ["bash", "-lc", "pytest -q"] is joined to bash -lc 'pytest -q' (trace.codex._command_text). The observer reads any of these as a command named bash or zsh, so the session shows it no test run, no interpreter run and no package tool, and teaches it nothing. The loop guard already reads all of them by their script (loopguard.turn._pieces, _SHELLS).

Reproduction (offline):

from tokeneconomizer.microskills.observe import classify_command

for cmd in ["/bin/bash -lc 'pytest -q'", "bash -lc 'pytest -q'", "/bin/zsh -lc 'pytest -q'"]:
    print(cmd, "->", [(o.intent, o.form) for o in classify_command(cmd)])

Expected: [('run_tests', 'pytest')] for all three
Actual: [('run_tests', 'pytest')] for the first, [] for bash -lc and /bin/zsh -lc

Upstream main: 747b8016538c13da7ba9d455b89e5e6595bf5294
Python 3.13.18, Linux

主要语言
Python
星标
7.4k
派生
500
平均合并
1 天 19 小时
30 天内合并 PR
123

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/TokenEconomizer 的其他 Issue

查看 microsoft/TokenEconomizer 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。