GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — refactor(core): encapsulate physical attempt execution by kitlangton · Pull Request #45294 · anomalyco/opencode Conversation
|
| Situation | Preserved behavior |
|---|---|
| Retryable failure before output | Reuse the assistant ID and logical Step; consume the shared retry allowance. |
| Incomplete stream after output | Settle the partial attempt and its tools, then schedule continuation with a new assistant ID. |
| Explicit continuation rejection | Allow one immediate full-context recovery without generic backoff. |
| Context overflow before output | Attempt runner-owned compaction before publishing the held-back provider error. |
| Cancellation while streaming or awaiting tools | Interrupt and await owned tool fibers before durable closeout. |
Attempt Lifetime
For a successful stream, the ownership boundary is:
sequenceDiagram
participant Runner as Session runner
participant Attempt as SessionStep
participant Provider
participant Tools as Local tool fibers
Runner->>Attempt: Prepared request and recovery policy
Attempt->>Provider: One llm.stream(request)
loop Provider events
Provider-->>Attempt: Event
opt Local tool call
Attempt->>Tools: Fork after durable Tool.Called
end
end
Provider-->>Attempt: Natural EOF and completion hook
Note over Attempt: Flush fragments and publish Step.Streamed
Attempt->>Tools: Await every exit
Tools-->>Attempt: All runs settled
Note over Attempt: Capture snapshot, account usage, publish terminal event
Attempt-->>Runner: Explicit outcome or failure
Natural EOF remains important for WebSocket checkpoint completion. Tool fibers stay in the attempt scope rather than the provider-stream scope, and Fiber.awaitAll retains every exit instead of failing fast.
Selection Fix
The Linux and Windows unit jobs exposed an existing TUI auto-copy bug. Releasing the first click cleared a start-only selection and reset OpenTUI's click counter, so subsequent clicks never selected a word or line. Auto-copy now leaves the initial cell selection alone and accepts word/line selections even when OpenTUI still marks them as starts. Click-only and empty explicit copies still clear selection, and dialog Ctrl+C still clears a selection before closing the dialog.
Demo
Real production TUI through OpenCode Drive: before 1d3c6460c1 on the left, after fde82dbf5e on the right. Both use the same 80x24 viewport, isolated fixture, simulated model response, and double/triple-click sequence. Startup and quiet reset gaps are trimmed; playback is not accelerated.
Scope
The Session change is a behavior-preserving extraction, not a retry-policy redesign or a fix for existing failure-classification behavior. The separate, narrow TUI selection fix addresses the reproduced Linux and Windows unit-test failures. Public events, persistence formats, and HTTP contracts are unchanged.
Verification
Run from the indicated package directories:
# packages/core bun typecheck bun run build bun run test bun run test -- test/session-runner.test.ts test/session-runner-recorded.test.ts test/session-runner-tool-events.test.ts test/session-step.test.ts test/session-model-request.test.ts test/session-model-transport.test.ts test/session-execution.test.ts test/session-move.test.ts bun run test -- test/session-runner.test.ts --test-name-pattern 'retry|continuation|overflow|full provider stream|interrupted' --rerun-each 3 # packages/tui bun typecheck bun run test bun run test -- test/util/selection.test.ts test/util/selection-copy-on-select.test.tsx test/cli/tui/dialog-select.test.tsx --rerun-each 10
git diff --check passed.4.0.0-rc.111 and the local v4 source. Provider tests use fixtures, not live model calls.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Extract physical-attempt streaming, tool execution, and durable settlement from the Session runner. Preserve logical-Step retry and recovery policy, use tagged drain outcomes, and fix multi-click selection during auto-copy.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.