Skip to content

Commit 1e0a04d

Browse files
Kasper JungeRalphify
authored andcommitted
workspace: record stream_cmd inline in _run_agent_streaming
Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent 7402f04 commit 1e0a04d

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

workspace/ralphs/improve-codebase/coverage/_agent.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# `_agent.py` coverage
22

3-
Valid at: 66d6c60
3+
Valid at: 7402f04
44

55
## Recent changes
66

7+
- 7402f04 — inlined the `stream_cmd = cmd + [_OUTPUT_FORMAT_FLAG,
8+
_STREAM_FORMAT, _VERBOSE_FLAG]` local in `_run_agent_streaming`.
9+
The binding was consumed exactly once on the very next statement
10+
(the first positional arg to `subprocess.Popen(...)`); no other
11+
references exist in src/ or tests/ (grep confirmed). The three
12+
appended tokens are already named constants
13+
(`_OUTPUT_FORMAT_FLAG`, `_STREAM_FORMAT`, `_VERBOSE_FLAG`) so the
14+
"extended command for streaming mode" intent reads cleanly at the
15+
call site without the intermediate name. Same Phase 4 inline-alias
16+
shape as 66d6c60 (`remaining`), b24accf (`reader`), 2fda4f0
17+
(`visible`), and e1ad87a (`binary`). Behavior preserved —
18+
subprocess.Popen still receives the same list; pinned by the
19+
streaming-path test coverage in `tests/test_agent.py`.
720
- 66d6c60 — inlined the `remaining = deadline - time.monotonic()` local
821
in `_read_agent_stream`'s per-iteration timeout calc. The alias was
922
read exactly once on the next line as `max(remaining, 0)`; collapsing

workspace/ralphs/improve-codebase/iterations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
One line per iteration: `<sha> <summary>`.
44

5+
7402f04 refactor: inline `stream_cmd` into Popen call in `_run_agent_streaming` — the `stream_cmd = cmd + [_OUTPUT_FORMAT_FLAG, _STREAM_FORMAT, _VERBOSE_FLAG]` local was consumed exactly once on the very next statement (the first positional arg to `subprocess.Popen(...)`), and grep confirmed no other references in src/ or tests/. The three appended tokens are already named constants, so the intent reads cleanly at the call site without the intermediate binding. Same Phase 4 inline-alias shape as 66d6c60 (`remaining`), b24accf (`reader`), 2fda4f0 (`visible`), e1ad87a (`binary`), and 52e0272 (`msg`). Behavior preserved — subprocess.Popen still receives the same list, pinned by the full streaming-path test coverage in `tests/test_agent.py`.
6+
57
66d6c60 refactor: inline `remaining` alias in `_read_agent_stream` timeout calc — the `remaining = deadline - time.monotonic()` local served a single use on the very next line as `max(remaining, 0)`. Collapsing to `max(deadline - time.monotonic(), 0)` matches the inline-alias pattern from e1ad87a (`binary`), 497c028 (`agent`), fc5e1cb (`total_in`), 52e0272 (`msg`), and ce487d3 (`text`). The adjacent comment was updated to refer to "clamp to 0" since `remaining` no longer exists. Behavior preserved — the same clamped value reaches `line_q.get(timeout=...)` on every iteration of the read loop, so deadline enforcement and the non-blocking drain on an already-expired deadline both behave identically. Pinned by the streaming-path tests in `tests/test_agent.py`.
68

79
b24accf refactor: inline `reader` thread handle in `_read_agent_stream` — the local served only to call `.start()`; the thread is never joined because termination flows through the queue's None sentinel plus the daemon flag, so the handle had no further role. Collapsing into the fluent `threading.Thread(..., daemon=True).start()` form matches the fire-and-forget intent and drops an unused binding. Python's `threading` module keeps live threads reachable via `threading._active`, so dropping the local reference does not affect thread lifetime — verified by the full agent test suite (628 passed). Same alias/handle-drop shape as 2fda4f0 / e1ad87a / 497c028 / b19625e, specialised to a Thread.

0 commit comments

Comments
 (0)