Commit Graph

1258 Commits

Author SHA1 Message Date
can1357 3a772de879 Merge PR #5518: fix(agent): strip images for non-vision models mid-session (@roboomp) 2026-07-14 23:11:08 +02:00
can1357 a3b4f28078 Merge PR #5506: fix(session): auto-retry bare "Request was aborted" error-stop turns (@roboomp) 2026-07-14 23:11:08 +02:00
roboomp 00c8e921f6 fix(agent): strip images for non-vision models mid-session
Switching from a vision model to a text-only model kept replaying
historical image content blocks to the new provider, which rejected them
with invalid_argument. The convertToLlm wrapper in sdk.ts only filtered
images when images.blockImages was set, never by model capability, so
the outbound request carried image blocks the active model could not
accept.

Add replaceLlmImagesWithText() to scrub image blocks out of the
already-converted LLM message view, and call it from the sdk wrapper
when the active model's input lacks "image". History on disk keeps its
images; only the provider request is scrubbed, and the check reads the
active model dynamically so a /model switch takes effect next turn.

Fixes #5400
2026-07-14 20:11:25 +00:00
roboomp 5e71fac653 fix(session): retried bare Request was aborted error-stop turns
A stalled or dropped provider stream that surfaces as stopReason:"error"
carrying the bare "Request was aborted" sentinel fell through both retry
gates: #isRetryableReasonlessAbort required stopReason:"aborted", and
#isRetryableError's classifier returns no retriable kinds for the generic
sentinel. The turn died immediately despite retry.enabled.

- Relaxed #isRetryableReasonlessAbort to accept an empty generic-abort
  sentinel turn under stopReason "aborted" or "error", tagging it Abort so
  #handleRetryableError retries it without model fallback.
- Kept the deliberate-abort guards intact: user interrupts and silent aborts
  carry their own markers (not the generic sentinel), and #abortInProgress /
  #isDisposed / #streamingEditAbortTriggered still settle without retry.
- Rewrote the stale fallback test that froze the buggy no-retry behavior to
  assert retry-and-recover for the error-stop sentinel.

Fixes #5375
2026-07-14 19:39:24 +00:00
can1357 1f619dcf18 feat(ai): enhanced Codex rate-limit header ingestion and usage-based key ranking
- Added a Codex rate-limit parser for `x-codex-*` headers and registered it with the Codex usage provider.
- Updated auth-storage to require parsed usage headers before ingesting usage data, treated exhaustion as non-throttled, and renamed ranked candidate drain fields.
- Reworked key ranking math to use `headroom / remainingHours` with a 1-minute minimum, then applied measured-usage precedence with hot-window demotion behavior.
- Updated session handling and tests to support provider-aware header ingestion with deterministic, exhaustion-aware account selection.
2026-07-14 20:54:03 +02:00
can1357 5e74444c27 fix(test): repair auth-storage-rotation merge resolution and normalize changelogs 2026-07-14 18:50:47 +02:00
can1357 a572448306 Merge PR #5297: fix(coding-agent): respect role thinking for temporary model picks (@roboomp)
# Conflicts:
#	packages/coding-agent/src/modes/controllers/selector-controller.ts
2026-07-14 18:47:28 +02:00
can1357 4b5c32a092 Merge PR #4950: fix(mcp): resolve local image paths for tool calls (@roboomp) 2026-07-14 18:45:22 +02:00
can1357 82327af420 fix(coding-agent): require terminal user prompt for todo suppression 2026-07-14 18:45:03 +02:00
can1357 f1ade56f65 Merge PR #5097: fix(coding-agent): suppress todo reminders for interactive questions (@roboomp) 2026-07-14 18:45:02 +02:00
can1357 1dfec0d161 Merge PR #5090: fix(advisor): reduce stale advisories via delta coalescing, WIP markers, and delivery annotation (@apoc)
# Conflicts:
#	packages/coding-agent/src/advisor/__tests__/advisor.test.ts
#	packages/coding-agent/src/advisor/runtime.ts
#	packages/coding-agent/src/session/agent-session.ts
2026-07-14 18:44:57 +02:00
can1357 280d4b039b fix(coding-agent): persist pruned autolearn captures 2026-07-14 18:41:16 +02:00
can1357 af9e9a898b Merge PR #5217: fix(coding-agent): accept Auto-Learn capture empty stops (@roboomp) 2026-07-14 18:41:15 +02:00
can1357 645cf45ed6 fix(coding-agent): preserve all terminal advisor notes 2026-07-14 18:41:15 +02:00
can1357 b52a4cdede Merge PR #5186: fix(coding-agent): preserve late advisor notes after terminal answers (@roboomp)
# Conflicts:
#	packages/coding-agent/test/agent-session-advisor-suppression.test.ts
2026-07-14 18:40:35 +02:00
can1357 fcad4f22b9 Merge PR #5183: fix(advisor): quarantine unknown tool responses (@roboomp) 2026-07-14 18:39:54 +02:00
can1357 72b1ddf04c fix(session): validate pending exit diagnostics 2026-07-14 18:39:53 +02:00
can1357 7773f48ebc Merge PR #5168: fix(session): recover interrupted session turns (@paralin) 2026-07-14 18:39:53 +02:00
can1357 58b80dac42 Merge PR #5139: fix(coding-agent): flush throttled output tails (@wolfiesch) 2026-07-14 18:39:26 +02:00
can1357 da24614d5a feat: added scrollback rebuild controls and prewalk status-line visibility
- Added `tui.scrollbackRebuild` configuration with interactive startup/controller wiring to apply `setScrollbackRebuild`.
- Exposed prewalk session state in `SegmentContext` and rendered a dedicated prewalk segment/icon in the status line.
- Added divergence-aware TUI full-paint logic that enables scrollback erase-and-replay rebuilds for non-multiplexer divergence cases.
- Updated rendering and streaming tests to verify rebuild behavior (`3J`) and eliminate stale marker expectations under drift scenarios.
2026-07-14 00:39:34 +02:00
can1357 f9f6ed9e8d feat(coding-agent): replaced legacy pi/ role alias prefix with
- Replaced legacy `pi/` role alias prefix with canonical `@` syntax across model resolution, documentation, and tests.
- Added support for bare `*` default alias and multiple alias prefix detection with custom role resolution in `resolveConfiguredRolePattern()`.
- Enhanced thinking suffix parsing to accept unambiguous abbreviations (minimum 2 characters) for effort and level selectors.
- Extended `resolveCliModel()` and `filterAvailableModelsByEnabledPatterns()` to accept settings parameter for role alias resolution from `--model` flag.
2026-07-13 23:26:33 +02:00
can1357 a5673c90f8 feat(ai): removed legacy Google interactions routing from AI providers
- Removed the Google Interactions transport and deleted interaction-specific request options from the shared AI stream typing/API surface.
- Simplified Google provider routing to eliminate interactions auto-selection logic and keep `streamGoogle` on the `:streamGenerateContent` path.
- Updated Vertex request handling to use resolved stream hosts without `/interactions`/`Api-Revision` and removed related interaction constants.
- Deleted obsolete Interactions tests and updated remaining Google stream tests to no longer reference `useInteractionsApi`/`storeInteraction`/`previousInteractionId`.
2026-07-13 18:43:52 +02:00
can1357 4df6f6683d chore: finalizing the new /prewalk 2026-07-13 15:18:31 +02:00
can1357 f405525bf4 feat: removed boomerang feature and associated validation workflows
- Removed the `downshift.boomerang` feature, including CLI flags, configuration schema settings, and internal session state logic.
- Deleted the associated prompt definition file and all unit tests related to the boomerang validation flow.
- Cleaned up frontend forms and server request handling in the harbor-manager package to reflect the feature removal.
- Updated the downshift planning prompt instructions to maintain continuity in task creation.
2026-07-13 14:15:54 +02:00
can1357 590270ca26 feat(coding-agent): gated downshift trigger on todo initialization
- Modify downshift logic to ignore `todo` tool calls as triggers, requiring them instead to open a "gate" that permits switching only on subsequent `edit`/`write` actions.
- Ensure the starting model consistently handles implementation until the todo list is established, preventing premature hand-off to the fast/cheap model.
- Update system prompts to emphasize strict validation and multi-test execution requirements for the boomerang model upon returning to the primary context.
2026-07-13 10:37:20 +02:00
can1357 95ecc61bc9 feat(coding-agent): implemented downshift boomerang flow for context handoff
- Introduced `--downshift-boomerang` CLI flag and `downshift.boomerang` configuration setting.
- Integrated boomerang validation hand-back logic and context cutting within the agent session.
- Added system prompt templates and runtime checks to facilitate message handling for boomerang transitions.
- Included unit tests to verify context management and validation pass requirements during the boomerang process.
2026-07-13 10:37:20 +02:00
can1357 4d019e5617 feat(coding-agent): trigger downshift on post-plan todo initialization
- Included the todo tool in downshift action triggers, gated on the plan nudge being in context — a post-nudge todo init is the planning-complete signal, while a turn-one todo remains bookkeeping.
- Updated flag help, settings schema, SDK docs, slash-command text, and plan-nudge instructions.
- Added a regression test covering the nudge-gated todo trigger.
2026-07-13 10:36:39 +02:00
can1357 9f1ff90a39 feat(coding-agent): implemented downshift and plan-yolo agent workflows
- Replaced legacy reasoning-slide functionality with new downshift and plan-yolo capabilities.
- Updated CLI arguments, slash commands, and configuration schemas to support the new model-switching and execution behaviors.
- Refactored agent session logic to handle downshift arming, plan-yolo headless execution, and context scrubbing.
- Renamed and added system prompts to align with the updated downshift and plan-yolo workflows.
2026-07-13 06:03:46 +02:00
can1357 0a98aa252b feat(coding-agent/modes): hardened tan fork isolation and session sync
- Clear inherited todo list state and persist empty edit at fork creation to prevent parent task reminders from affecting the tangential session.
- Re-inject the fork notice after each auto-compaction event to ensure the boundary between the parent and child session survives history summarization.
- Align the provider cache key with the parent's actual pinned key to correctly mirror cached session context.
- Update `AgentSession` to perform a full entry rewrite during tool result pruning to ensure session files match pruned state for reliable resuming and branching.
2026-07-13 06:00:30 +02:00
can1357 ac16253613 wip: rslide (experimental) 2026-07-13 04:21:54 +02:00
can1357 22f2c1947b test(session): validated auto-compaction guard and recovery behavior
- Added test coverage for auto-compaction entry warning attribution during dead-end scenarios.
- Verified automatic continuation and warning suppression when image-drop recovery successfully clears context pressure.
- Mocked session context usage and image-drop functionality to simulate high-usage state recovery.
2026-07-13 01:41:09 +02:00
can1357 aa52fa4231 feat(session): enabled visibility for elided tool calls in transcripts
- Added `StrippedToolCallsMarker` to identify assistant messages with dangling tool calls that were removed during context building.
- Updated `buildSessionContext` to preserve turn entries in transcripts even when all content is stripped, marking them with the count of elided calls.
- Updated `UiHelpers` to render a dim, italicized placeholder in the TUI when an assistant message has elided tool calls, preventing silent activity gaps.
2026-07-13 01:40:15 +02:00
can1357 4903a13511 feat(session): implemented automated recovery and status reporting
- Added `warning` field to `CompactionEntry` and `CompactionSummaryMessage` to persist dead-end status in session history.
- Introduced a multi-tier rescue mechanism in `AgentSession` that automatically performs `elide` and `dropImages` passes when maintenance fails to recover sufficient headroom.
- Integrated visual indicators for dead-ends into the `CompactionSummaryMessageComponent`, surfacing warnings directly on the compaction divider and detail block.
- Updated `AgentSession` logic to re-evaluate progress after each rescue tier and emit recovery notices, ensuring transparent reporting of automated history rewrites.
2026-07-13 01:40:14 +02:00
can1357 bf5eb3769f feat(coding-agent): rebased pending context snapshot after compaction
- Update in-flight context snapshots after historical messages are modified by compaction or elision.
- Prevent stale run-start token counts from triggering false-positive dead-end "no progress" warnings during auto-continuation.
- Add regression test to verify that prompt headroom measurements correctly account for post-compaction context sizes.
2026-07-13 01:28:18 +02:00
can1357 58d6130b50 feat(coding-agent): enabled model fallback for hard errors
- Extended `AgentSession` to consult `retry.fallbackChains` on non-retryable (hard) model errors.
- Implemented `#isHardErrorFallbackEligible` to validate eligibility for model switching before surfacing terminal errors.
- Updated `#handleRetryableError` to orchestrate immediate model switching for hard errors, bypassing backoff-retries for the failing model.
- Ensured hard errors propagate to the user if no fallback candidates are available or if no credential can be resolved for the fallback model.
2026-07-13 00:59:43 +02:00
roboomp 9bda84b685 fix(coding-agent): respected role thinking for temp picks
Applied explicit thinking suffixes from matching configured model roles when the temporary model picker switches the session model.

Added regression coverage for the Alt+P temporary picker resolution path.

Fixes #5290
2026-07-12 19:01:05 +00:00
can1357 20c0a2e410 test(coding-agent): fixed storage tests for schema v6 and slow CI disks
- Compat tests assert the exported SCHEMA_VERSION instead of a stale
  hardcoded 5; the perf-sample change bumped agent.db to v6.
- Backfill cap fixture inserts its 300 rows in one transaction; per-row
  implicit transactions fsynced 300 times and timed out on CI runners.
2026-07-12 03:13:15 +02:00
can1357 d54dcc2224 feat(coding-agent): allowed model fallback after retry budget exhaustion
- Permit model fallback even if the retry budget is exhausted when the current provider is locked by credential rotation or usage limits.
- Reset the retry budget when successfully switching to a fallback model to ensure the new model has a full allowance of retries.
- Added a regression test to verify that credential rotation failure triggers model fallback.
2026-07-12 01:35:50 +02:00
Christian Stewart bdad9ca8c0 fix(session): recover interrupted switched sessions
Close pending tool turns recorded during normal shutdown and apply interrupted-tail recovery when switching or reloading sessions.

Signed-off-by: Christian Stewart <christian@aperture.us>
2026-07-11 16:18:39 -07:00
Christian Stewart a420dd11e4 fix(session): preserve terminal failed tool turns
Skip interrupted-turn recovery when an error or aborted assistant already closed its tool calls with synthetic results.

Signed-off-by: Christian Stewart <christian@aperture.us>
2026-07-11 16:18:39 -07:00
Christian Stewart de236903d4 fix(session): close all interrupted transcript tails
Detect pending tool calls from assistant content and use the selected model metadata to terminate first-turn user tails after abnormal process exits.

Signed-off-by: Christian Stewart <christian@aperture.us>
2026-07-11 16:18:39 -07:00
Christian Stewart e3e5bf8775 fix(session): recovered interrupted session turns
Appended one terminal aborted assistant record when a persisted abnormal-exit diagnostic follows a non-terminal transcript tail, preserving partial history while making resumed context valid.

Signed-off-by: Christian Stewart <christian@aperture.us>
2026-07-11 16:18:39 -07:00
can1357 c4fa0ebaae feat(storage): implemented persistent model performance tracking and migration
- Added `model_perf` table to store persistent, recency-weighted TPS and TTFT statistics per model.
- Introduced `AgentStorage.recordModelPerf` to asynchronously capture and aggregate turn timing metrics.
- Implemented a background backfill mechanism to migrate historical request data from `stats.db` into new performance aggregates.
- Updated `AgentSession` to record performance metrics upon turn completion.
- Bumped `SCHEMA_VERSION` to 6 and cleared existing performance data to account for improved duration-based TPS calculation.
2026-07-12 01:06:19 +02:00
can1357 a3117c2842 feat(agent): migrated async-drain utility to shared package for reuse
- Relocated `AsyncDrain` class from `coding-agent` to `utils` package.
- Updated `HistoryStorage` to import `AsyncDrain` from shared utilities.
- Centralized the utility to allow reuse across the codebase.
2026-07-12 01:06:17 +02:00
can1357 54bafa1cce feat(coding-agent): implemented interactive fallback chain configuration
- Implemented model-specific keys and provider wildcards for `retry.fallbackChains` with updated resolution logic.
- Added interactive fallback chain management in the model roles UI, including support for reordering and editing.
- Improved fallback chain specificity rules and added comprehensive validation with startup warnings.
- Fixed mouse interaction alignment and hover state coordinate mapping in the roles view.
2026-07-11 22:03:35 +02:00
can1357 7957d0b88c Merge remote-tracking branch 'origin/farm/3b0815b6/fix-btw-gpt-luna-esc' 2026-07-11 20:38:37 +02:00
can1357 6c292b97c3 refactor(coding-agent): preserved completed and abandoned tasks in session
- Updated task synchronization to include all todo phases regardless of completion status.
- Removed logic that filtered out completed or abandoned tasks during session synchronization.
2026-07-11 20:35:43 +02:00
roboomp c36f64d4f0 fix(coding-agent): pruned noop autolearn captures
Removed accepted empty Auto-Learn capture stops from live and persisted context, including the hidden capture prompt when it directly parents the no-op stop.

Extended the regression to prove the next real prompt does not replay the stale Auto-Learn nudge.

Fixes #5211
2026-07-11 17:46:44 +00:00
roboomp 9269823d16 fix(coding-agent): shared codex state for btw websockets
- Forwarded the session provider state map to ephemeral side-channel turns so Codex can allocate websocket transport state for the side request session id.
- Extended the /btw side-channel regression to assert providerSessionState reaches the stream options with the websocket preference.

Fixes #5213
2026-07-11 17:46:28 +00:00
roboomp 2c161d2a8f fix(coding-agent): preserved btw codex websocket routing
- Preserved the session websocket preference for ephemeral /btw side-channel turns so Codex websocket-only models do not fall back to SSE.
- Prioritized active /btw and /omfg panels in Esc handling before loop, maintenance, and main-turn interrupts.
- Added regression coverage for side-channel websocket options and /btw Escape priority.

Fixes #5213
2026-07-11 17:31:37 +00:00