Skip to content

Chat coding adapter: retry dropped streams, keep context small, nudge toward writing - #75

Merged
wilke merged 1 commit into
chian:mainfrom
wilke:fix/chat-coding-resilience
Oct 8, 2026
Merged

wilke merged 1 commit into
chian:mainfrom
wilke:fix/chat-coding-resilience

Conversation

@wilke

@wilke wilke commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #67/#71, from the second live refiner build on Argo (2026-10-08, build_request_df9ee3a5…, Run run_7645d122…).

What happened

  • The Code Implementer ran 98 steps: 96 run_command, 3 read_file, 1 list_files, and no source edit.
  • The conversation grew to ~530k characters (~130k tokens). Per-step latency rose from a median of ~6 s to 180 s and 81 s on the last calls.
  • Argo then dropped the stream mid-response:
    peer closed connection without sending complete message body (incomplete chunked read)
    
  • Add a chat-completions coding adapter for Implementer (Argo / OpenAI-compatible routes) #67 treats any provider error as fatal (api_error → CodingTurn.error → ModelCallFailed), so the build ended interrupted with no edits.

Change (agent/transports/refinement_chat.py)

  • Retries: transient transport failures are retried on the same route up to 3 times, with 5/20/60 s backoff. "Transient" uses the existing auxiliary_client._is_transient_transport_error, which covers dropped streams, connection errors, 5xx and 408. Retries are reported as activity events, not api_error, because the Implementer interrupts the turn on api_error. Non-transient errors, and transient ones still failing after the retries, surface as before.
  • Smaller context:
    • history budget 600k → 240k characters;
    • per-tool output 40k → 20k;
    • elided old tool output keeps its first 300 characters, so the model still sees what each command was.
  • Writing nudge: after 40 steps without write_file/edit_file (and every further 40), the model is told to write the assigned source or record the specific blocker in .openchia-implementation.json.

Tests: 14 pass, 4 new:

  • a dropped stream is retried and the turn succeeds;
  • a persistent drop still surfaces;
  • the nudge fires after N steps without a write;
  • compaction keeps the head of old tool outputs.

Context

Most of the exploration reads library sources and earlier packages outside the workspace. #74 (container shell plus read-only /ctx/openchia) and #73 stage 3 (curated context) should shorten it further.

🤖 Generated with Claude Code

… toward writing

Second live refiner build on Argo (2026-10-08, build df9ee3a5): the Code
Implementer ran 98 steps (96 shell commands, no source edit). The
conversation had grown to ~130k tokens, per-step latency rose from ~6 s to
180 s, and Argo then dropped the stream ("peer closed connection without
sending complete message body (incomplete chunked read)"). The adapter
treated that provider error as fatal, so the owning Run stopped.

- Transient transport failures (dropped stream, connection errors, 5xx, as
  classified by auxiliary_client._is_transient_transport_error) are retried
  on the same route up to 3 times with 5/20/60 s backoff. Retries are
  reported as activity, not api_error (which makes the Implementer interrupt).
- Conversation budget lowered from 600k to 240k characters and per-tool
  output from 40k to 20k; elided old tool output keeps its first 300 chars.
- After 40 steps (and every further 40) without write_file/edit_file the
  model is told to write the assigned source or record the specific blocker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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