Skip to content

fix(remote): keep the legacy shell outcome on the lean feed - #859

Merged
huichen merged 3 commits into
mainfrom
fix/lean-legacy-outcome
Sep 25, 2026
Merged

huichen merged 3 commits into
mainfrom
fix/lean-legacy-outcome

Conversation

@huichen

@huichen huichen commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

The gap

The lean trim dropped a tool result's captured output because the client reads the structured outcome (exit_code, is_soft_fail, target_path, error) instead of parsing an [exit: N] footer out of the text.

That holds for a current agent — tool_end_semantics derives exit_code from that footer, so every shell result carries either exit_code or error. But an agent older than tool_end_semantics reports a failed shell command as a successful result whose only outcome signal is the footer. On the lean feed there was then nothing to read, and the row showed as completed — a failure the trim invented.

This was known and pinned rather than fixed: lean-render-live asserted that row as 已运行, with the comment that the lean lane "has no outcome to read". A review pass over this work surfaced it as the one behavioral asymmetry left in the series.

The fix

Keep the output for exactly that shape — shell, no structured outcome, and a non-zero [exit: N] footer as the last line. Then:

  • a failing legacy shell result keeps the only signal it has (short: it is one command's output);
  • a soft failure keeps it too, because the client needs the code for its own exemption (grep exit 1 is a no-match);
  • a successful legacy result still loses its output;
  • everything with a structured outcome (current agents, all four tool kinds) is untouched.

Verification

  • New unit test pins all five branches (failure kept, soft-fail kept, success dropped, structured dropped, non-shell dropped, buried footer dropped); falsified by forcing the guard off — the new test is the only failure.
  • The fixture generator's self-check was tightened to the new rule (a surviving output must be a shell result with no structured outcome and a non-zero footer), and regenerating keeps the committed lean fixture byte-equal to the shipping trim output.
  • Only call_8 gains its output in the regenerated lean fixture — one hunk, no other event affected.
  • lean-render-live now expects both failure shapes to read 运行失败 and exactly two 已运行 rows (the soft failures). Its leak assertion is now non-vacuous for that payload.
  • cargo fmt --check and cargo clippy --all-targets -D warnings clean; remote_host:: 83 passed, remote_host::lean 12 passed.

The render harness re-run is delegated to the independent reviewer that produced the prior render evidence (the scenario expectations changed, so its earlier pass is invalidated). Reported back on this PR.

The lean trim dropped a tool result's captured output on the grounds that the
client reads the structured outcome (`exit_code`, `is_soft_fail`,
`target_path`, `error`) instead of parsing an `[exit: N]` footer out of the
text. That holds for a current agent -- `tool_end_semantics` derives
`exit_code` from that footer -- but an agent older than it reports a failed
shell command as a *successful* result whose only outcome signal is the
footer. The lean feed then had nothing to read and the row showed as
completed: a failure the trim invented.

Keep the output for exactly that shape: shell, no structured outcome, and a
non-zero `[exit: N]` footer as the last line. A failing shell result is
short, a soft failure (`grep` exit 1) needs its code for the client's own
exemption, and a successful legacy result still loses its output.

The render fixture pinned the old reading (`lean-render-live` expected that
row as 已运行); the fixture and the scenario now carry both failure shapes.
Regenerated through the shipping trim, so the committed lean fixture stays
byte-equal to what the code produces.
@huichen
huichen enabled auto-merge (squash) September 25, 2026 21:01
@huichen
huichen merged commit 0af062f into main Sep 25, 2026
12 checks passed
@huichen
huichen deleted the fix/lean-legacy-outcome branch September 25, 2026 21:26
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.

1 participant