Skip to content

chat --once: a steered watched run says its answer once - #2999

Merged
AbirAbbas merged 2 commits into
devfrom
fix/chat-once-steer-answer-once
Nov 27, 2026
Merged

AbirAbbas merged 2 commits into
devfrom
fix/chat-once-steer-answer-once

Conversation

@AbirAbbas

Copy link
Copy Markdown
Collaborator

A watched codeaf chat --once ... --steer PATH --json run that took one steer note printed the answer twice ("answer":"the answer.the answer."). Agent.Steer returns a live view of the turn it steers, which runChatV3Once is already draining; the steer goroutine drained that view into the same reply.

The steer's stream now passes nothing on until EventSteerFellThrough. After that, the same channel carries the turn the note starts by itself, which nothing else reads. A note sent when no turn is running still goes through Submit and prints as before.

The same fix goes to main in the v0.8.4 hotfix, together with the --events/--steer/--json flags the AgentField Go SDK's watched path needs.

Validation contract

  • A steered --once run's reply holds the answer exactly once. TestChatOnceTakesAMidRunNoteAndStreamsItsRecord now counts it: red without the fix ("printed 2 times"), green with it.
  • A note written as the run ends still gets its own turn and prints (TestChatOnceReadsANoteThatLandsAsTheRunEnds).
  • Real binary, fake model, the SDK's exact argv: before "answer":"steered: I read your note.steered: I read your note.", after "answer":"steered: I read your note.". --events stays byte-identical to the session record.

🤖 Generated with Claude Code

AbirAbbas and others added 2 commits November 27, 2026 11:55
Agent.Steer hands back a live view of the turn it steers, and runChatV3Once
is already draining that turn into the reply. The steer goroutine drained the
view into the same reply, so a watched run that took one --steer note printed
every word twice, and `--json` returned "the answer.the answer." as its answer.

The steer's stream now passes nothing on until EventSteerFellThrough; from
there the same channel carries the turn the note starts by itself, which
nothing else reads. A note sent with no turn in flight still goes through
Submit, whose stream is its own turn.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AbirAbbas
AbirAbbas merged commit 2c25f0f into dev Nov 27, 2026
5 checks passed
@AbirAbbas
AbirAbbas deleted the fix/chat-once-steer-answer-once branch November 27, 2026 16:59
AbirAbbas added a commit that referenced this pull request Nov 27, 2026
…ld run starts (hotfix of #2478's live flags)

The AgentField Go SDK starts a watched run as `codeaf chat --once TEXT --json
--yolo --no-host --model M --max-hours H --events E --steer S --session P`.
v0.8.2 and v0.8.3 refused `--json` ("codeaf chat has no --json flag") and
exited at once, so every watched run failed before it began and WorkAF showed
no live transcript.

This carries the three live flags from dev (#2478, with #2609's per-run
accounting in the envelope) onto the v0.8.3 line, without the factory engine
around them: dev relays a question the model asks to the watcher over
--events, and that needs internal/factory, which this line does not have. A
question here takes its own default, as any headless run does.

It also fixes a defect dev has too (#2999): Agent.Steer returns a live view of
the turn it steers, which the run is already printing, so a steered run
printed its answer twice. The steer's stream now passes nothing on until the
steer falls through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas added a commit that referenced this pull request Nov 27, 2026
Staging already has dev's --events/--steer/--json, so it keeps its own bytes
for those files and takes two things from the hotfix: the v0.8.4 changelog
block and the steered-answer-once fix (#2999). This merge exists so the
release guard finds main's commit on staging.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas added a commit that referenced this pull request Nov 27, 2026
History only: dev already has the live flags and, with #2999, the
steered-answer-once fix. The only bytes this brings are the v0.8.4 changelog
block. It exists so the next promotion from dev to staging to main moves
forward over the hotfix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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