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

Đang mở Phù hợp với người mới
#343 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Shizoqua đang làm issue này rồi.

Từ ngày 27/11/2026.

  • #345 của @Shizoqua — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, python, zsh
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu từ unwrap và _WRAP_RE trong tokeneconomizer/microskills/observe.py, sau đó theo dõi cách classify_command gọi chúng. _pieces và _SHELLS trong loopguard/turn đã xử lý tên shell theo đường dẫn và theo script, vì vậy hãy làm theo cách đó. Chạy bản tái hiện offline trong issue. Hoàn thành khi bash -lc 'pytest -q', /bin/zsh -lc 'pytest -q' và /bin/bash -lc 'pytest -q' đều trả về [('run_tests', 'pytest')].

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
7.4k
Fork
500
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
123

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/TokenEconomizer

Tất cả issue của microsoft/TokenEconomizer

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.