Commit Graph
9801 Commits
Author SHA1 Message Date
Christian Stewart 39290eade8 fix(coding-agent): deferred continue normalization past extension flags
Skipped UUID-shaped positional normalization while startup parsing still contains unrecognized extension flags, then normalized the extension-aware parse.

Signed-off-by: Christian Stewart <christian@aperture.us>
2026-07-11 16:19:05 -07:00
Christian Stewart 8ff4590d31 fix(coding-agent): preserved continue target after flag reparse
Normalized UUID-shaped --continue targets on the extension-aware argument parse so the session id cannot leak back into the initial prompt.

Signed-off-by: Christian Stewart <christian@aperture.us>
2026-07-11 16:19:05 -07:00
Christian Stewart d7fe28bcbf fix(coding-agent): rejected unknown continued session ids
Treated a UUID passed after --continue as an explicit session target so a missing id cannot fall back to the latest persisted session.

Signed-off-by: Christian Stewart <christian@aperture.us>
2026-07-11 16:19:05 -07: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 b6559861d0 feat(cli): standardized throughput calculation to total duration
- Removed the `computeTokensPerSecond` helper function in favor of a direct calculation.
- Standardized throughput to use total request duration instead of post-TTFT decode time.
- Updated UI usage display to calculate tokens per second against total duration.
- Prevented over-inflation of throughput metrics caused by hidden reasoning tokens.
2026-07-12 01:06:24 +02:00
can1357 a0dcb8ae20 feat(ui): enabled performance monitoring and viewport navigation
- Integrated performance statistics (TPS/TTFT) into ModelBrowser and ModelHub components with adaptive visibility.
- Decoupled mouse wheel behavior from selection logic to enable smoother viewport panning.
- Improved UI navigation by preventing unwanted wrapping in role indexes and adding viewport snapping logic.
- Added comprehensive test suites to verify performance display rendering and corrected input interaction behavior.
2026-07-12 01:06:22 +02: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
Mathews-Tom f9e481baad fix(coding-agent): preserve final retry error toasts
AgentSession defers and coalesces the wire-level agent_end while a
prompt is in flight (#emitSessionEvent), so a multi-attempt retry saga
often surfaces only ONE agent_end to EventController — which can be
the final settle, not an intermediate attempt. Consuming #retryPending
against whichever agent_end arrived first (previous commit) could
therefore discard the real final failure notification.

Switch to gating purely on the retry lifecycle: #retryPending is set
by auto_retry_start and cleared only by auto_retry_end (both
outcomes), never consumed by sendErrorNotification itself. Those
lifecycle events are never deferred, so they reliably bracket the
window a retry is actually outstanding regardless of how agent_end
coalescing lands.

Close the residual gap this creates: #handleRetryableError's
classifier-refusal and Fireworks-fallback-ineligible branches could
short-circuit a saga that already announced auto_retry_start without
ever emitting auto_retry_end, latching #retryPending open forever.
Both branches now emit a final auto_retry_end(false) when a prior
attempt already started the saga. #handleAgentStart also clears
#retryPending defensively so a saga that still somehow never resolves
cannot suppress a later, unrelated turn's notification.
2026-07-12 04:17:11 +05:30
Mathews-Tom 2a3b6856ff fix(coding-agent): gate error toasts while auto-retry is pending
A retryable error's agent_end fires with the failed assistant message
(stopReason === 'error') the instant #handleRetryableError schedules a
retry (auto_retry_start), before the retry has a chance to recover.
sendErrorNotification read that transient agent_end the same as a real
final settle, so error.notify=on raised a 'Stopped with error' toast
even for turns that went on to succeed on retry.

Track a #retryPending flag set on auto_retry_start and consumed
(check-then-clear) by sendErrorNotification, so exactly one mid-retry
agent_end is suppressed per attempt. #handleAutoRetryEnd also clears it
directly on both success and failure so a recovered retry never leaves
it stuck; consuming it on read (rather than only via auto_retry_end)
keeps it self-healing for the classifier-refusal short-circuit path,
which can return from #handleRetryableError without ever emitting a
fresh auto_retry_end.
2026-07-12 03:58:19 +05:30
Wolfgang Schoenberger 95add0187e fix(coding-agent): load web search fallbacks lazily 2026-07-11 15:26:37 -07:00
Mathews-Tom 04e66e4f58 Merge remote-tracking branch 'upstream/main' into feat/error-notify 2026-07-12 03:32:00 +05:30
can1357 666327608c feat(coding-agent): improved model search ranking by match quality
- Prioritized fuzzy match quality over the most-recently-used model order when filtering the model browser.
- Added bucketing to match scores to ensure stable sorting when match quality is identical.
- Added unit tests to verify that exact query matches take precedence over the MRU model.
2026-07-12 00:00:35 +02:00
Rens Tillmann 8ff98674e5 fix(tui): bound replay-safe transcript retention 2026-07-11 21:09:06 +00:00
can1357 e7955ddf3c feat(coding-agent): introduced sequential message queueing and commands
- Implemented `/queue` command and `->`/`=>` shorthands to support deferred, sequential message processing.
- Added a robust parsing utility to handle various list-based queue inputs and automate yield management.
- Integrated visual decorations and state tracking to provide real-time feedback on queueing status.
- Enabled non-cursor line text decoration in the TUI to support dynamic queue header rendering and list numbering.
2026-07-11 22:07:51 +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 2ab2da2b1d fix(coding-agent): improved role-assignment strip visibility on overflow
- Prevent selected chips from being hidden when the role strip row overflows.
- Implement horizontal scrolling with a leading ellipsis to maintain visibility of the selection and lookahead context.
2026-07-11 21:17:35 +02:00
DarkPhilosophy ca8bf8dda1 Merge remote-tracking branch 'can1357/main' into feat/advisor-per-agent-toggle
# Conflicts:
#	packages/ai/test/pi-native-client.test.ts
#	packages/coding-agent/src/modes/components/advisor-config.ts
#	packages/coding-agent/src/session/agent-session.ts
2026-07-11 22:13:08 +03:00
can1357 6bb0878b63 feat(ai): added cache invalidation command for usage reports
- Added an `invalidate` action to the usage CLI to clear cached usage reports for specific or all providers.
- Updated `invalidateUsageCache` in `AuthStorage` to be asynchronous and notify the underlying store of invalidations.
2026-07-11 20:55:19 +02:00
Mathews-Tom d6fe21e079 fix(secrets): redact replay and title metadata 2026-07-12 00:12:01 +05:30
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
Mathews-Tom 9afad2388a Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-07-11 23:10:23 +05:30
Mathews-Tom 112bcda344 fix(secrets): reobfuscate restored assistant replay 2026-07-11 23:07:09 +05:30
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
roboomp 221196704a fix(coding-agent): cleared autolearn empty-stop override
Cleared the terminal empty-stop acceptance flag for every agent-initiated prompt so non-opt-in custom turns cannot inherit Auto-Learn capture behavior.

Added a regression covering a non-opt-in custom turn after a non-empty Auto-Learn capture response.

Fixes #5211
2026-07-11 17:20:46 +00:00
can1357 6f47df88b4 Merge remote-tracking branch 'origin/farm/84fe7c9e/harden-plugin-feature-load' 2026-07-11 19:18:56 +02:00
roboomp e2afc87a40 fix(coding-agent): accepted autolearn empty stops
Marked Auto-Learn capture turns as accepting terminal empty assistant stops so the empty-stop guard does not retry the expected no-reply completion.

Added a focused AgentSession regression covering the auto-continue capture turn.

Fixes #5211
2026-07-11 17:04:16 +00:00
roboomp 8608395eef fix(coding-agent): rejected empty advisor stops
Treat content-less advisor stop completions as failed turns so the advisor retry/drop path handles silent provider responses instead of accepting them as successful reviews.

Fixes #5212
2026-07-11 17:02:18 +00:00
Mathews-Tom 2e4e215da2 fix(secrets): scan typed JSON collision values 2026-07-11 22:31:49 +05:30
Miroslav Drbal 74be4d5f67 style(advisor): apply biome formatting 2026-07-11 19:00:34 +02:00
Miroslav Drbal 59017f2616 fix(advisor): address final review: wip return type, import order, cap edge case, cap test
Blockers from final review:
- runtime.ts:457 TS2741: #collectAndMaintainBatch now returns wip in its
  result type; #drain destructures it and passes it to the retry-requeue
  unshift — a WIP batch that fails retry no longer silently loses its
  [in progress] heading.
- agent-session.ts import order: annotateForStaleness moved before
  formatAdvisorBatchContent (biome enforces case-insensitive alpha order).

Cap edge case (advisor nit + review CONCERN): final round of the
  coalescing for-loop now breaks BEFORE the late-item splice so any
  deltas that arrived during round MAX_COALESCE_ROUNDS-1's
  maintainContext call stay in #pending for the next drain iteration
  instead of being merged into an unbudgeted batch. Doc comment updated
  to match ('left for the next drain iteration' is now accurate).

Cap test: bounded version that only pushes new turns for the first 3
  maintainContext calls so the drain while-loop terminates cleanly after
  a second iteration. The previous unbounded version created an infinite
  drain loop (each maintainContext call unconditionally pushed another
  turn) and timed out.
2026-07-11 18:59:11 +02:00
Miroslav Drbal 441197b462 fix(advisor): address review: wip on PendingDelta, MAX_COALESCE_ROUNDS cap, annotateForStaleness extraction
Blocker: wip field added to PendingDelta and threaded into the reprime
  path. #collectAndMaintainBatch now captures the most-recent WIP state
  from each delta batch and forwards it to #renderDelta in both the
  normal and reprime branches, so a willContinue:true turn never loses
  its [in progress] heading through a reprime.

Safety cap: MAX_COALESCE_ROUNDS=3 constant defined and used in the
  coalescing for-loop, preventing indefinite dispatch stall under
  pathological fast-primary + slow-maintainContext conditions.

Testability: annotateForStaleness extracted as an exported pure function
  in advise-tool.ts and used in AgentSession#routeAdvice. Three unit
  tests added in advisor.test.ts covering the no-staleness, staleness,
  and note-preservation contracts. This addresses the ReviewSession
  regression-test concern without requiring a full AgentSession harness.

Reprime turn-tally coverage: new test 'backlog stays accurate when a
  delta arrives during the reprime-triggering maintainContext' asserts
  runtime.backlog === 0 after all three turns, catching a deleted
  turns += reduce(...) line.

Fragile double-await tests converted: sends-batch-when-maintenance-fails
  and expands-plan-mode-context now use Promise.withResolvers signals
  instead of counted await Promise.resolve() hops.

Docs: onTurnEnd JSDoc added; hasFreshBacklog comment broadened to cover
  all drain-busy phases (not just agent.prompt).
2026-07-11 18:59:11 +02:00
Miroslav Drbal 74715f8cca fix(advisor): reduce stale advisories via delta coalescing, WIP markers, and delivery annotation
Three related changes that address the pattern of the advisor flagging things
the primary already fixed:

Fix 1 — coalesce late-arriving deltas before agent.prompt (runtime.ts)
  Refactored #drain into a reusable #collectAndMaintainBatch helper that loops
  until the pending queue is stable (no new deltas arrive during a maintenance
  check) before calling agent.prompt. Previously, any turn queued during the
  maintainContext await was deferred a full extra model-call cycle; now it is
  merged into the current batch after re-checking the token budget for the
  expanded payload. Every await in the loop has an epoch guard so a
  reset/dispose mid-await cannot leak a stale batch. finalTurns always counts
  all merged turns so #backlog decrements correctly.

Fix 2 — hasFreshBacklog + delivery-time staleness annotation (runtime.ts, agent-session.ts)
  Added AdvisorRuntime.hasFreshBacklog getter (true when #pending.length > 0
  while agent.prompt is running — i.e., newer primary turns arrived after the
  reviewed window). #routeAdvice checks it at delivery time and appends a
  lightweight caveat to the note so the primary agent knows to verify before
  acting. Uses #pending.length not #backlog, which is always > 0 mid-call.

Fix 3 — willContinue WIP marker in rendered delta + system prompt (runtime.ts, agent-session.ts, system.md)
  onTurnEnd now accepts { willContinue } and passes it through to #renderDelta,
  which tags the heading '[in progress — more steps follow]' for intermediate
  turns. The agent-session.ts call site passes context.willContinue. The advisor
  system prompt instructs the model to withhold critique on WIP updates.

Also fixed pre-existing inline casts in #renderDelta and #dedupContextMessage
that suppressed the type checker instead of using the narrowing already provided
by the role discriminant.

All 75 advisor tests pass; pre-existing type errors in cursor.ts are unrelated.
2026-07-11 18:56:04 +02:00
Mathews-Tom 331e7bea65 fix(secrets): restore keyed session placeholders 2026-07-11 21:59:50 +05:30
can1357 172691f6ec feat: removed redundant pre-execution bash command fixup logic
- Removed the bash command fixup system and associated logic from both the Rust and TypeScript components.
- Deleted the redundant fixup module and its exported implementations.
- Updated technical documentation and configuration settings to reflect the removal of pre-execution bash command rewriting.
2026-07-11 18:28:32 +02:00
can1357 7a0ae70313 feat(coding-agent/tools): implemented bulk conflict resolution via conflict://*
- Added `conflict://*` support to the `write` tool, allowing resolution of multiple conflicts in a single call using per-id directives.
- Implemented `parseBulkDirectives` to interpret `ID: @side` mappings from the raw input content.
- Enabled partial bulk resolution where unlisted conflict IDs remain registered for subsequent operations.
- Updated conflict documentation and tool summaries to reflect the new bulk resolution capability.
2026-07-11 18:23:57 +02:00
can1357 5b20a7dea4 feat(coding-agent): implemented persistence for tool calls during rebuilds
- Enabled persistence of dangling tool calls during transcript rebuilds by adding `keepDanglingToolCalls` configuration.
- Integrated `seal()` logic for pending tool blocks to properly finalize history during idle session states.
- Enhanced UI helpers and session context to preserve assistant turns during streaming or mid-turn rebuilds.
- Added comprehensive unit and integration tests to verify correct tool call tracking and transcript integrity.
2026-07-11 18:19:48 +02:00
Mathews-Tom 2e7c429586 fix(secrets): skip opaque payloads in regex pre-scan 2026-07-11 21:26:50 +05:30
can1357 369a0d879e feat(coding-agent/modes): displayed session title in pause screen
- Included the current session name in the fullscreen pause UI.
- Updated `renderPauseScreen` and `InteractiveModeContext` to propagate and display the session title.
- Added test coverage for both full and compact pause screen layouts.
2026-07-11 17:37:19 +02:00
can1357 33b6774aa1 feat(coding-agent): implemented resumable subagent yielding for tasks
- Replaced silent budget-based termination with a graceful stop and forced-yield mechanism.
- Implemented resumable subagent states to preserve agent context upon budget exhaustion.
- Increased default soft request budget to 200 and updated IRC bus signaling to distinguish between active, resumable, and hard-aborted statuses.
- Added comprehensive status-aware prompts and unit tests to verify non-terminal abort behavior.
2026-07-11 17:27:35 +02:00
can1357 9a868d2e7a feat: introduced agent suspension mechanism with pause command and ui
- Introduced an `AgentPauseGate` mechanism to suspend and resume agent loops and tool executions safely.
- Added a `/pause` slash command to trigger a new fullscreen UI that manages agent suspension and lifecycle.
- Integrated pause checks into the core agent loop and tool execution pipeline to ensure responsive state handling.
- Provided a new pause screen component to facilitate user interaction and resume control during suspension.
2026-07-11 17:15:00 +02:00
can1357 0828c53cab feat(coding-agent): integrated liveness monitoring into irc wait operations
- Update `IrcBus.wait` to accept a `liveness` configuration, automatically aborting waits if the specified sender or relevant peers transition to an idle state.
- Enhance `IrcTool` to utilize liveness monitoring during `wait` operations, ensuring the agent does not hang if target peers become unreachable.
- Refactor `IrcBus.wait` to unify internal settlement logic and improve cleanup robustness.
2026-07-11 17:14:03 +02:00
Mathews-Tom 8d231daedb Merge remote-tracking branch 'upstream/main' into feat/secret-friendly-names 2026-07-11 20:42:16 +05:30
can1357 7e5e7e864d feat(coding-agent-tools): implemented auto-trimming for echo lines
- Implemented logic to automatically detect and trim redundant lines duplicating adjacent file content within conflict markers.
- Added delimiter balancing and boundary tracking to ensure accurate removal of echoed text while preserving EOL formatting.
- Updated user feedback to report the number of trimmed echo lines during write and conflict resolution operations.
- Expanded test coverage to include multi-line echo scenarios and integration validation of the repair process.
2026-07-11 17:04:23 +02:00