Commit Graph

3953 Commits

Author SHA1 Message Date
roboomp fe00a9f3c4 style: bun run fix 2026-06-28 21:13:05 +00:00
roboomp 9599689af3 fix(compaction): routed summary oneshots through provider cap
Compaction issued summarization HTTP requests via the default
`completeSimple` transport, bypassing
`wrapStreamFnWithProviderConcurrency` which was only wired into
`Agent.streamFn` / `sideStreamFn`. With the per-LLM-turn bracket
introduced in this PR, multiple ollama-cloud subagents that auto- or
manually compact could issue uncapped summary requests in parallel
and exceed `providers.ollama-cloud.maxConcurrency` (chatgpt-codex
review on #3751).

Added an optional `completeImpl` transport override to
`SummaryOptions` and `GenerateBranchSummaryOptions` and threaded it
into every `instrumentedCompleteSimple` call in compaction +
branch-summarization. Wired `AgentSession.#compactWithFallbackModel`
and the `generateBranchSummary` caller to route through
`#sideStreamFn` — the same limiter-wrapped transport the handoff path
already uses.

Pinned with a coding-agent regression that drives `compact()` end to
end against the wrapped sideStreamFn at maxConcurrency=1 and asserts
peak in-flight stays at 1 across a concurrent unrelated side request.

Fixes #3749
2026-06-28 21:11:48 +00:00
roboomp edaaec398c fix(task): routed side requests through provider cap
Passed the provider-capped stream wrapper into AgentSession side-channel requests so /btw, /omfg, IRC auto-replies, and handoff generation share the same per-provider concurrency limit as normal turns.

Added focused coverage for runEphemeralTurn and handoff generation using the configured side stream function.
2026-06-28 20:57:13 +00:00
roboomp febbc26f28 fix(task): scoped provider concurrency cap to each LLM turn
The per-provider semaphore (e.g. `providers.ollama-cloud.maxConcurrency`) was acquired before `SessionManager.open` and released only after `driveSessionToYield` returned, so it bracketed the whole subagent lifecycle. Any spawn tree wider than `maxConcurrency` deadlocked: parents held every slot while waiting for children that were queued on the same cap — symptoms matched zero LLM requests and tokens=0/requests=0 cancellations.

Moved the bracket into a `StreamFn` wrapper. The wrapper acquires the slot just before each provider HTTP request and releases it the moment the response stream produces 'done'/'error', so a parent's slot is free between turns and child subagents can acquire while their parent's tool calls run. Wraps both the main agent and the advisor (both consume `settingsAwareStreamFn`).

Fixes #3749
2026-06-28 20:36:40 +00:00
can1357 c178ceaea5 Merge remote-tracking branch 'origin/farm/a0906538/codex-context-overflow-recovery' 2026-06-28 21:51:25 +02:00
can1357 6e3d401239 Merge remote-tracking branch 'origin/farm/04d319fb/ctrl-q-follow-up-queue-sends-the-literal' 2026-06-28 21:51:22 +02:00
roboomp 9f79d09a8d fix(session): preserve overflow error when no recovery runs
Split active-context vs persisted-history removal in #checkCompaction so the persisted assistant error stays on the branch unless context promotion or compaction is actually scheduled.

Fixes #3747
2026-06-28 19:40:51 +00:00
roboomp dd57ee85bf fix(session): dropped recovered overflow error turns
Removed recoverable context-overflow and incomplete-response assistant errors from both active context and persisted session history before compaction/promotion schedules the retry.

Fixes #3747
2026-06-28 19:34:33 +00:00
can1357 95748061e9 Merge remote-tracking branch 'origin/farm/4965ca44/fix-autolearn-cache-bust' 2026-06-28 20:42:17 +02:00
roboomp 45f60657d5 fix(agent): seeded startup learned memory snapshot
Use the pre-session memory prompt snapshot as the learned.md baseline when startup consolidation refreshes before a session-scoped cache exists. This keeps active-session learn writes out of the refreshed prompt while still surfacing the new consolidated summary.

Refs #3743
2026-06-28 18:35:01 +00:00
can1357 5f5007d49d Merge remote-tracking branch 'origin/farm/4965ca44/fix-autolearn-cache-bust' 2026-06-28 20:27:06 +02:00
roboomp d883e50c06 fix(agent): preserved learned snapshot during memory refresh
Refresh the startup consolidation summary without rereading learned.md for the active session, so lessons captured while startup is still running remain deferred to the next session.

Refs #3743
2026-06-28 18:27:06 +00:00
can1357 f5c3cd9268 Merge remote-tracking branch 'origin/farm/e24f4a34/collab-large-session-disconnect' 2026-06-28 20:27:00 +02:00
roboomp 261234cb22 fix(agent): invalidated memory prompt cache after consolidation
Background memory startup writes memory_summary.md after the initial system-prompt build has already cached an empty value for the session. Drop the cached snapshot before refreshBaseSystemPrompt so the active session actually picks up the freshly consolidated summary instead of returning the stale cached one.

Refs #3743
2026-06-28 18:18:57 +00:00
roboomp afcb198c5b fix(agent): kept autolearn memory prompts cache-stable
Stopped passive autolearn from adding hidden conversation messages and froze local memory developer instructions per session so learn writes land in future sessions instead of mutating the active Anthropic prompt prefix.

Fixes #3743
2026-06-28 18:10:57 +00:00
roboomp 378bc1aeca fix(collab): clip oversized arrays alongside strings in shrinkForReplication
Per #3740 review: many short strings (e.g. a tool result whose content array holds thousands of small text blocks) could sum past MAX_REPLICATED_PAYLOAD_BYTES without any individual field crossing the per-string floor, so the helper exited the truncation loop and shipped an oversized frame — the relay close/reconnect loop the helper was meant to prevent.

Replace the string-only truncation pass with a single walker that head-truncates strings AND head-clips arrays in one descent, driven by a concrete SHRINK_PASSES schedule that tightens both axes together. The final pass clamps every string to 64 B and every array to one element, so any payload converges. Add direct unit tests for shrinkForReplication covering: identity for small values, single-giant-string clamp, many-short-strings array clamp (no field above floor), and discriminator preservation on a fully-shrunk payload.
2026-06-28 17:18:10 +00:00
roboomp 0f3ee8d107 style: bun run fix 2026-06-28 17:11:28 +00:00
roboomp c577ffebdc fix(collab): cap replicated host frames so oversized entries do not loop the relay
CollabHost shipped the first entry of every snapshot-chunk batch unconditionally, and broadcast live entry/event frames verbatim, so a single multi-megabyte tool result (read/bash/search) overflowed the relay's per-frame maxPayloadLength. The relay closed the host's WebSocket with 1006 ("Received too big message"), CollabSocket treated 1006 as non-fatal and reconnected, the next guest hello triggered the same oversized send, and the host status line cycled "Collab relay connection lost, reconnecting…" indefinitely.

Add shrinkForReplication: any host->guest payload whose JSON exceeds MAX_REPLICATED_PAYLOAD_BYTES (1 MB) is deep-cloned with long strings head-truncated and an "[…N chars elided for collab session]" marker; otherwise the original reference passes through. Apply it to snapshot chunk entries, live entry broadcasts, and live event broadcasts (including large tool_execution_end results). Regression test stands up a Bun.serve relay with 8 MB maxPayloadLength and a snapshot containing a 5 MB entry; asserts the host stays connected, the snapshot train finalizes, and the guest sees the entry with the elision marker.

Fixes #3739
2026-06-28 17:10:41 +00:00
can1357 6dab2b3196 Merge PR #3604: fix stale todo HUD rows (@jeffscottward) 2026-06-28 18:55:26 +02:00
can1357 0ffe6c8e1f Merge PR #3675: keep moved sessions resumable (@riverpilot)
# Conflicts:
#	packages/coding-agent/src/modes/controllers/command-controller.ts
2026-06-28 18:46:19 +02:00
can1357 21ed419aeb fix(coding-agent): keep registry-qualified bun cache markers 2026-06-28 18:45:12 +02:00
can1357 1ca6213018 Merge PR #1716: prune stale bun update cache (@dragonbaba)
# Conflicts:
#	packages/coding-agent/test/update-cli.test.ts
2026-06-28 18:45:12 +02:00
roboomp 7c8b77deee style: bun run fix 2026-06-28 16:43:25 +00:00
roboomp 404a43e02b fix(coding-agent): expand paste markers in Ctrl+Q follow-ups
InputController.handleFollowUp read raw editor text via getText(),
bypassing the paste-store expansion the Enter path applies through
Editor.getExpandedText(). A large paste collapsed into a [Paste #N, +X
lines] marker was therefore sent verbatim to the model when queued with
Ctrl+Q / Ctrl+Enter, silently dropping the pasted content.

Switch the follow-up path to getExpandedText() so queued submissions
match the Enter path. Image markers are untouched; pendingImages
forwarding is unchanged.

Updated existing input-controller stubs (skill-queue, followup-image,
keybindings) to implement getExpandedText, matching the production
CustomEditor surface.

Fixes #3737
2026-06-28 16:42:39 +00:00
can1357 e170bb1110 Merge PR #3694: recover completed tool calls after transient stream read errors (@cexll)
Includes evaluator cleanup removing unrelated stacked fixture churn.
2026-06-28 18:40:53 +02:00
can1357 dab245a30a Merge PR #3678: show Antigravity weekly usage limits (@riverpilot) 2026-06-28 18:40:02 +02:00
can1357 0a1fac7347 test: drop unrelated fixture changes 2026-06-28 18:22:08 +02:00
can1357 19ac2813ec Revert "test(coding-agent): align fixtures with session title slot"
This reverts commit fdf85803fe.
2026-06-28 18:21:23 +02:00
Jeff Scott Ward 917d2834a3 fix: address todo reminder review feedback 2026-06-28 12:03:06 -04:00
can1357 2622ab13fe test(coding-agent/tools): removed invalid regex test cases
- Removed tests covering invalid regex patterns.
- Deleted the dedicated grep-invalid-regex test suite.
2026-06-28 17:46:10 +02:00
can1357 b5544b3f19 feat(coding-agent): implemented path recovery for mismatched section tags
- Added `recoverSectionPathFromTag` to reconcile bare or mismatched `[basename#tag]` paths using existing session snapshots.
- Implemented `readSectionForPreview` to fallback to recovered file paths when the authored path is absent.
- Updated `computeHashlineSectionDiff` to use the path recovery logic during preview content acquisition.
- Removed obsolete regression test file `issue-1765-repro.test.ts`.
2026-06-28 17:28:53 +02:00
can1357 6d11f705e9 test(coding-agent): standardized temporary file path naming conventions
- Updated temporary directory prefixes to include an @ symbol in multiple test suites.
- Standardized file paths for temporary agent storage across test environments.
2026-06-28 17:23:16 +02:00
Jeff Scott Ward 9a9dc88f43 fix: address todo HUD review feedback 2026-06-28 11:16:30 -04:00
can1357 8185fdbfa9 feat(coding-agent): queued tool argument updates to prevent edit loss
- Implemented a queueing mechanism in `ToolExecutionComponent` to prevent starvation of edit previews during high-frequency argument updates.
- Replaced eager cancellation of in-flight diff computations with a drain loop that ensures every update is processed once the current compute settles.
- Added `partialJsonOf` helper to safely narrow streamed JSON buffers from tool arguments.
- Added regression test to verify that slow diff computations are not aborted by incoming stream chunks and instead queue a subsequent re-run.
2026-06-28 17:11:43 +02:00
Jeff Scott Ward 44ca363be0 fix: keep goal todos in context 2026-06-28 11:09:17 -04:00
Jeff Scott Ward dd917046d8 fix: anchor todo reminder HUD 2026-06-28 11:09:16 -04:00
can1357 42981154fb feat(coding-agent): deduplicated thinking signatures during persistence
- Implement cleanup logic to drop `thinkingSignature` values from assistant thinking blocks during persistence.
- Identify and drop signatures only when the underlying reasoning data is already recoverable via the `providerPayload` items.
- Ensure orphaned signatures that cannot be reconstructed from the payload are preserved during serialization.
- Add comprehensive test coverage to verify deduplication safety and edge-case handling for missing payloads.
2026-06-28 17:01:04 +02:00
can1357 93f68b75a2 test(coding-agent/modes): updated controller test mocks
- Added missing `noteDisplayableThinkingContent` mock function to test fixtures.
- Included `markActivityStart` and `markActivityEnd` methods in status line mocks to match updated controller interfaces.
2026-06-28 16:53:16 +02:00
can1357 ec2551b60e test(coding-agent): extended event controller test fixture
- Added a mock function for noteDisplayableThinkingContent to the test fixture.
2026-06-28 16:14:15 +02:00
can1357 5056dc57db Merge remote-tracking branch 'origin/farm/f4bf8adf/lazy-extension-headers' 2026-06-28 16:10:08 +02:00
can1357 008b0bac2d Merge remote-tracking branch 'origin/farm/cff0327f/ssh-pending-preview-scrollback' 2026-06-28 16:08:13 +02:00
can1357 0501addbd2 feat(coding-agent): allowed advisors to use mutating tools
- Removed the architectural restriction limiting advisors to read-only tools.
- Updated advisor configuration to permit any built-in tool, including `edit`, `write`, and `bash`.
- Defaulted advisor toolsets to `read`, `grep`, and `glob`, while maintaining strict session isolation for each advisor.
2026-06-28 16:07:46 +02:00
roboomp 7d01f539d9 style: bun run fix 2026-06-28 14:00:45 +00:00
roboomp 1b9cd7d787 fix(providers): kept runtime headers live
Preserved extension-registered provider and model header objects so request-time reads observe later mutations instead of registration-time snapshots.

Fixes #3725
2026-06-28 13:59:42 +00:00
ben fdf85803fe test(coding-agent): align fixtures with session title slot 2026-06-28 20:07:32 +08:00
roboomp 2024821d67 fix(ssh): pinned expanded pending preview commit-unstable
The SSH renderer previously declared 'provisionalPendingPreview: "collapsed"',
which only opted the COLLAPSED pending shape out of the transcript's
stable-prefix ratchet. Once the user expanded an in-flight SSH preview (ctrl+o)
and the framed block outgrew the viewport, the pending rows became
ratchet-eligible and committed to native scrollback before the result render
inserted the 'Output' section. The settled render then re-anchored the frame,
producing two distinct stranded shapes in history:

- a stale 'pending SSH: [host]' header pinned above the final '<- SSH: [host]'
  frame (header variant), and
- the pending bottom border row reused in-place as the new 'Output' separator,
  with a fresh '...' footer pushed below it (footer variant).

Flip 'provisionalPendingPreview' to 'true' so every pending shape — collapsed
or expanded — is treated as provisional and stays out of native scrollback
until the result render commits a settled frame. The 'collapsed'-only opt-out
remains correct for renderers (bash, eval) whose expanded pending preview is
top-anchored and survives the result render without re-anchoring.

Added two contract tests asserting expanded pending SSH is commit-unstable
and that bash/eval expanded pending preview is still commit-stable — keeping
the opt-in renderer-scoped.

Fixes #3714
2026-06-28 10:40:18 +00:00
ben 23dc53bdc9 fix(agent): preserve stream error detail 2026-06-28 17:31:06 +08:00
ben cb4e68888f fix(agent): recover completed tools after stream read errors 2026-06-28 16:18:46 +08:00
can1357 6061c3278b Merge remote-tracking branch 'origin/farm/efa85bd2/fix-mcp-legacy-sse' 2026-06-28 10:02:18 +02:00
can1357 4373dde48a Merge remote-tracking branch 'origin/farm/efa85bd2/fix-mcp-legacy-sse' 2026-06-28 09:59:43 +02:00