Skip to content

Stream local check output into a bounded diagnostic tail - #1227

Closed
eowca wants to merge 3 commits into
mainfrom
lean178/1194-bounded-check-output
Closed

eowca wants to merge 3 commits into
mainfrom
lean178/1194-bounded-check-output

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by #1343, which carries the bounded-capture fix on a fresh base. The conflict-resolution merge on this branch prevented review inheritance and delta review. The replacement PR owns delivery and closure of #1194.

Refs #1194

Co-Authored-By: Codex <noreply@openai.com>
@eowca
eowca marked this pull request as draft November 26, 2026 00:36

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero primary review by claude on a85af29f6296179d09194564c261708fceafa437, 35.7s: approve (0 critical, 0 important, 2 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

Comment thread tests/test_sandbox.py
os.write(2, b"\\nlast available diagnostic\\n")
signal.pause()
"""])
result = sandbox._run_one(make_config(), git_repo, [], command, 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Real-timeout test depends on the child writing its output within 1s

test_local_stage_timeout_retains_drained_output runs a real Python child under prlimit with a 1s timeout. It asserts that the tail ends with the diagnostic and is exactly 16 KiB. On a loaded CI host, interpreter startup can take longer than 1s. The child is then killed before it writes anything, the tail is just the timeout marker, and both assertions fail. This is a test flake, not a product defect. Smallest fix: have the child print a ready marker after its writes, and wait for it before the deadline matters. Alternatively, raise the timeout to a few seconds; signal.pause() keeps the test deterministic either way.

Comment thread src/loopzero/_proc.py
return env


def _read_output_tail(proc: subprocess.Popen[str], limit: int, timeout: float) -> str:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Document _read_output_tail's trailing-newline contract next to _check_tail

_read_output_tail holds trailing newlines separately. It drops them on success and keeps them, capped at limit, on timeout. This matches what _check_tail produces from the full text, which does rstrip("\n") and then slices the last 16 KiB. The equivalence depends on the min(limit, ...) cap and on _check_tail running rstrip first, and neither function mentions the other. A one-line docstring saying the result equals text.rstrip('\n')[-limit:] on success and text[-limit:] on timeout would stop the two from drifting apart in a later edit. Non-blocking.

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