Skip to content

Add stream --llm-interval throttle and fix show-code LLM-chain parity#45

Merged
alexkroman merged 1 commit into
mainfrom
stream-llm-interval-and-show-code-parity
Jun 8, 2026
Merged

Add stream --llm-interval throttle and fix show-code LLM-chain parity#45
alexkroman merged 1 commit into
mainfrom
stream-llm-interval-and-show-code-parity

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Summary

Two related changes to the --llm / --show-code paths:

  • stream --llm-interval is now baked into both the live streaming loop and the generated --show-code script. The prompt chain refreshes at most once per --llm-interval seconds (0 = every finalized turn), with a closing flush on stop so tail turns aren't dropped. The generated summarize() mirrors StreamSession._maybe_summarize (LLM_INTERVAL throttle + final=True flush).
  • transcribe --show-code chain parity: chained --llm follow-up prompts now wrap the previous result under the same Transcript:\n label that the real CLI uses (llm.run_chain_stepstransform_transcript(transcript_text=output)). Previously the generated script sent prompt + "\n\n" + result, drifting from an actual run for 2+ prompts. Single-prompt output was already identical.

Test plan

  • uv run pytest tests/test_code_gen.py tests/test_stream_llm.py tests/test_stream_session.py — green.
  • Spot-checked generated output: aai transcribe --sample --llm … --llm … --show-code now emits the labeled Transcript:\n form; aai stream --llm … --llm-interval 5 --show-code emits LLM_INTERVAL = 5.0 with the throttle + closing flush.
  • Run the full ./scripts/check.sh gate before merge.

🤖 Generated with Claude Code

Bake the --llm-interval cadence into the live `stream --llm` loop and its
generated `--show-code` script: refresh the prompt chain at most once per
interval (0 = every turn) with a closing flush so tail turns aren't lost.

Also fix `transcribe --show-code` chained prompts to wrap follow-up steps
under the same "Transcript:" label the CLI's run_chain_steps uses, so the
generated script matches a real run.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment on lines +277 to +278
llm_interval: float = typer.Option(
30.0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Default llm_interval=30.0 conflicts with nearby --llm descriptions claiming refresh on every finalized turn, so behavior and command semantics diverge.

Suggested change
llm_interval: float = typer.Option(
30.0,
llm_interval: float = typer.Option(
0.0,
Details

✨ AI Reasoning
​​1) The code adds a new interval-based throttle with a nonzero default, so refreshes are no longer guaranteed per finalized turn.
​2) Existing user-facing wording in the same command path still describes per-turn refresh behavior.
​3) This creates contradictory runtime assumptions for users and generated expectations.
​4) The contradiction is concrete and introduced by this change set, not speculative.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

@alexkroman alexkroman merged commit 748ff6d into main Jun 8, 2026
11 checks passed
@alexkroman alexkroman deleted the stream-llm-interval-and-show-code-parity branch June 8, 2026 22:51
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.

2 participants