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

Aperta Adatta ai principianti
#343 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Shizoqua ci sta già lavorando.

Dal 27/11/2026.

  • #345 di @Shizoqua — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bash, python, zsh
Ambito
devtools

Direzione di ricerca

Inizia da unwrap e _WRAP_RE in tokeneconomizer/microskills/observe.py, poi segui come classify_command lo richiama. _pieces e _SHELLS in loopguard/turn gestiscono già i nomi delle shell per percorso e per script, quindi replica quell'approccio. Esegui la riproduzione offline della issue. È fatto quando bash -lc 'pytest -q', /bin/zsh -lc 'pytest -q' e /bin/bash -lc 'pytest -q' restituiscono tutti [('run_tests', 'pytest')].

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Python
Stelle
7.4k
Fork
500
Merge medio
1g 19h
PR unite (30g)
123

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/TokenEconomizer

Tutte le issue di microsoft/TokenEconomizer

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.