Skip to content

8bdf9698 - Surface the vendor's actual output from a lane run - #40

Merged
TaprootFreak merged 2 commits into
developfrom
8bdf9698-surface-lane-run-vendor-output
Aug 31, 2026
Merged

8bdf9698 - Surface the vendor's actual output from a lane run#40
TaprootFreak merged 2 commits into
developfrom
8bdf9698-surface-lane-run-vendor-output

Conversation

@Danswar

@Danswar Danswar commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

EN:
agent lane run genuinely invokes grok/codex against a real diff, but the CLI only ever printed a one-line STATUS/rc summary and threw away the vendor's actual output. By the time launch() returns, the tmux pane it was captured from is already killed, so nothing downstream (gate record --evidence, a human watching the run) could ever see what the vendor found. Fixed both call sites (agent lane run and the agent run one-step chain) to print result.stdout/result.stderr before the summary line, and sanitize that output (strip C0/C1/DEL control bytes) before printing since the --no-tmux path captures raw vendor subprocess output unlike the tmux path's already-escape-free capture-pane.

DE:
agent lane run ruft grok/codex tatsächlich mit einem echten Diff auf, aber die CLI hat bisher nur eine einzeilige STATUS/rc-Zusammenfassung ausgegeben und die eigentliche Vendor-Ausgabe verworfen. Sobald launch() zurückkehrt, ist die tmux-Pane, aus der sie stammt, bereits beendet — nichts Nachgelagertes (gate record --evidence, ein Mensch, der zusieht) konnte je sehen, was der Vendor gefunden hat. Beide Aufrufstellen (agent lane run und die agent run-Ein-Schritt-Kette) geben jetzt result.stdout/result.stderr vor der Zusammenfassungszeile aus und sanitisieren diese Ausgabe (C0/C1/DEL-Kontrollbytes entfernt), da der --no-tmux-Pfad rohe Vendor-Subprocess-Ausgabe erfasst, anders als der tmux-Pfad, dessen capture-pane bereits escapefrei ist.

Details

Replaces #37, rebuilt cleanly off the current develop tip with a single commit and a CONTRIBUTING.md-compliant subject line (the commits on #37 were missing the required trailing period; fixing that in place would have meant amend+force-push on already-pushed, already-reviewed commits, which is not done here even for a message-only fix — see #37 for that PR's original review history).

Found while manually driving a diagnostic review task against RealUnitCH/web#27's real diff through Jonny Luca's dfxai instance: the grok quality lane ran for real (STATUS=complete) but produced no retrievable findings anywhere. Traced to cmd_lane/cmd_run in main.py never touching result.stdout.

Full local suite green: 446 passed, 1 skipped (agent-core integration test, needs that package importable).

@Danswar

Danswar commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author

EN:
Ready after 4 review passes.
Both call sites of agent lane run (the lane and one-step run chains) now print and sanitize the vendor's actual stdout/stderr instead of discarding it.

DE:
Bereit nach 4 Review-Durchläufen.
Beide Aufrufstellen von agent lane run (die Lane- und die Ein-Schritt-run-Kette) geben nun die tatsächliche Vendor-Ausgabe (stdout/stderr) sanitisiert aus, statt sie zu verwerfen.

Details

This PR replaces #37 (closed) after a CONTRIBUTING.md finding that #37's commit subjects were missing the required trailing period; fixing that in place would have meant amend+force-push on already-reviewed, already-pushed commits, so the branch was rebuilt cleanly instead. The 4 review passes span both PRs:

  1. 8a4d464a - Surface the vendor's actual review output from a lane run #37, commit 643a129: grok quality/logic + codex quality/logic all reviewed the initial fix. Codex logic found a test-coverage gap (only the cmd_lane call site had a content-asserting test, not cmd_run) and flagged raw, unsanitized vendor stdout/stderr on the --no-tmux path as a potential ANSI/control-sequence injection vector.
  2. 8a4d464a - Surface the vendor's actual review output from a lane run #37, commit ba43401: added the missing cmd_run test and a _sanitize_lane_output() helper stripping C0/DEL control bytes. Grok quality/logic (both 0 defects) and codex logic found a residual gap: Unicode C1 control bytes (\x80-\x9f) weren't covered by the sanitizer.
  3. 8bdf9698 - Surface the vendor's actual output from a lane run #40 (rebuild), commit e52edb5: extended the sanitizer to cover C1 control bytes too. Grok quality/logic (0 defects, logic run twice for redundancy after an inconclusive first attempt) and codex quality (0 defects) passed; codex logic found two Minor test-coverage gaps (sanitizer boundary bytes untested, cmd_lane print-order untested) — explicitly not production-code defects.
  4. 8bdf9698 - Surface the vendor's actual output from a lane run #40, commit 7716c36: added the two missing test assertions. Grok quality/logic and codex quality/logic all returned 0 defects. Codex logic's one residual note (extend the boundary test to also assert the byte just outside each stripped range) was deliberately not chased further — it is a test-of-test nitpick on code added specifically to satisfy the prior round's finding, and the sanitizer regex's actual behavior has now been independently, manually byte-verified correct across 4 separate reviewer passes.

A "vendor output could leak a secret into --evidence" observation was raised once and independently re-assessed as a defensible non-blocking process risk by 3 further reviewer passes (no code path in the repo auto-copies result.stdout/stderr into a persisted evidence field; see DESIGN.md's "secrets do not belong in evidence" rule).

Mergeable (MERGEABLE/CLEAN), CI green (pytest), no open review threads/comments at HEAD 7716c36.

@Danswar
Danswar marked this pull request as ready for review August 27, 2026 01:46
`agent lane run` genuinely invokes grok/codex against a real diff, but the
CLI only printed a one-line STATUS/rc summary and discarded the vendor's
actual stdout/stderr. By the time launch() returns, the tmux pane it was
captured from is already killed, so nothing downstream (gate record
--evidence, a human watching the run) could ever see what the vendor
found. Both call sites (agent lane run and the agent run one-step chain)
now print result.stdout/stderr before the summary line via a shared
_print_lane_result helper.

The --no-tmux runner captures raw vendor subprocess output, unlike the
tmux path whose capture-pane already drops escape sequences, so a
misbehaving vendor process could otherwise inject ANSI/C1 control
sequences into the terminal. _sanitize_lane_output strips C0/C1/DEL
control bytes (keeping tab/newline/CR) before printing either stream.
The sanitizer tests only exercised a few representative escape bytes, so
an off-by-one edit to the control-char regex's range boundaries could
slip through unnoticed. Add a boundary test asserting every edge of each
stripped range is actually stripped and \t/\n/\r survive. Also assert
stdout-before-summary ordering in the cmd_lane print test, matching the
equivalent cmd_run test, so a regression that reordered cmd_lane's output
specifically would be caught.
@TaprootFreakAI

Copy link
Copy Markdown
Collaborator

EN:
Rebased onto the current develop after #44 (one import-line conflict in main.py resolved by keeping both additions); the branch is force-pushed with --force-with-lease and the four lane verdicts are re-run on the new head.

DE:
Nach #44 auf das aktuelle develop rebased (ein Import-Zeilen-Konflikt in main.py, beide Ergänzungen behalten); der Branch wurde mit --force-with-lease gepusht, die vier Lane-Verdikte laufen auf dem neuen Head erneut.

@TaprootFreakAI
TaprootFreakAI force-pushed the 8bdf9698-surface-lane-run-vendor-output branch from 7716c36 to 31efc83 Compare August 29, 2026 18:24
@TaprootFreakAI

Copy link
Copy Markdown
Collaborator

EN:
Non-blocking observation for the author: _print_lane_result writes vendor stdout, then vendor stderr, then the STATUS line without flushing, so under redirection (> log 2>&1, or a parent process capturing the CLI) CPython's block-buffered stdout and line-buffered stderr can reorder them; flush=True on the two prints would pin the intended order.

DE:
Nicht blockierender Hinweis an den Autor: _print_lane_result schreibt Vendor-stdout, dann Vendor-stderr, dann die STATUS-Zeile ohne Flush; bei Umleitung (> log 2>&1 oder Capture durch einen Elternprozess) können CPythons block-gepuffertes stdout und zeilen-gepuffertes stderr die Reihenfolge vertauschen — flush=True auf den beiden prints würde die beabsichtigte Reihenfolge festhalten.

Details
  • Location: src/agent_cli/main.py, _print_lane_result (three print() calls across two streams, no flush, no PYTHONUNBUFFERED/-u in the project).
  • Unaffected: interactive tty use; capsys-based tests cannot observe it because they bypass OS buffering.
  • Not part of the rebase (this comment accompanies the rebase onto develop after f07aaefa - Create the local cluster only in agent init #44); left for the author to decide.

@TaprootFreakAI

Copy link
Copy Markdown
Collaborator

EN:
Four lane verdicts (Grok quality, Grok logic, Codex quality, Codex logic) are approved on the rebased head 31efc83, CI is green and the branch is mergeable again. PR #40 was rebased onto develop after #44 by merging one import line, so it applies cleanly again.

DE:
Vier Lane-Verdikte (Grok Qualität, Grok Logik, Codex Qualität, Codex Logik) sind auf dem rebased Head 31efc83 approved, CI ist grün und der Branch wieder mergebar. PR #40 wurde nach #44 auf develop rebased, eine Import-Zeile zusammengeführt, und lässt sich wieder sauber anwenden.

@Danswar
Danswar requested a review from TaprootFreakAI August 31, 2026 15:18
@TaprootFreak
TaprootFreak merged commit 4252bc1 into develop Aug 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants