Repository navigation
Per-orchestration budget ceiling for fan-outs (#67) - #123
Merged
currentbits merged 1 commit intoAug 16, 2026
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
currentbits
deleted the
coder/per-orchestration-per-thread-budget-ceil-fff8b9
branch
October 3, 2026 16:07
currentbits
added a commit
that referenced
this pull request
Oct 30, 2026
…more navigation and writing wins (#1776) * Sidebar marker for threads with an unsent draft (#1770) ThreadCard shows a quiet pencil glyph in the meta line, title "Unsent draft", when a thread has non-whitespace composer text that hasn't been sent. composerSession.setDraftText is now the single write path for draft text (draftsRef aliases keptDrafts) and notifies a small listener set only when the non-empty state flips, so sidebar rows subscribe via useSyncExternalStore instead of polling localStorage per row per render. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Add buildFileTree: pure helper for the Changes/PR Code tree view (#1772) Builds a directory tree from a flat file list for the upcoming Tree toggle: single-child chains compress into one row, dirs sort before files, and each directory carries a recursive file count and +/- sum. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Downscale oversize pasted/dropped images instead of rejecting them (#1773) electron/attachments.js: saveImage, savePng, and the HEIC->JPEG conversion path now run an oversize image through nativeImage (resize + re-encode, JPEG stepping quality/size down, PNG kept first when alpha may matter) before falling back to today's MAX_IMAGE_BYTES rejection. Target is 4096px longest side / 4MB, safe under Claude's ~5MB/8000px API limits with headroom for the other providers. nativeImage is injected via setNativeImage so the pure step-down plan (planDownscaleSteps, imageNeedsDownscale) and the full save paths are testable under plain node. Chips show a quiet "resized from WxH" note, mirroring the existing HEIC "converted from" note. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Add threads.regenerateTitle: digest-based title refresh (#1774) Regenerates a thread's title from its first user message plus a digest of its latest few messages, via the same fm completion path and sanitization/cap as the automatic one-shot title. Always an explicit action (menu item, bulk action), so it overwrites a user-set title too. Runs at most 2 threads concurrently; trashed threads are skipped and one thread's failure never stops the rest. Wires the IPC channel through ipcChannels.ts, CoderApi, the threads:regenerateTitle handler, webScopes (steer), and the dev fixture, plus a useCoder action that applies successful titles locally. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Shortcuts to toggle pin and settle/restore the open thread (#1770) thread.togglePin defaults to mod+shift+p, thread.toggleSettle to mod+shift+a (mod+shift+s is already composer.unstash). Both call the same threads.setPinned / threads.setSettled IPCs as the thread action menu, toggling off the current effective state (same resolution as the sidebar's settle computation). Since both are mod chords they still fire while a text field is focused; only an open dialog blocks them. Settle reuses the existing undo toast; pin has none to reuse. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Add Tree view, Changes panel +/- total, and per-file copy path (#1772) Git pane and PR Code tab: a shared List/Tree toggle (coder.diffTreeView, same pattern as the shared Hide tests setting) renders buildFileTree instead of the flat list, with collapsible directory rows showing a file count and summed +/-. The Changes panel file list also gets a summed +/- total next to its file count, respecting the hide-tests filter. Every file row (both views, both panels) gets a copy-path icon button; the Changes panel's context menu gets a matching "Copy path" item, and Alt-click on its button copies the absolute worktree path instead of the repo-relative one. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Wire Regenerate title into the thread menu, header menu, and bulk action Row menu (src/threadActionMenu.ts, ThreadCard) and the chat header menu (ThreadView) both get a "Regenerate title" item next to Rename; the sidebar multi-select toolbar gets a "Regenerate titles" bulk action (BatchBar). Affected rows show "Regenerating..." in place of the title while in flight, and the toolbar reports success/failure counts. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Next/previous turn and PageUp/PageDown transcript navigation (#1770) turn.prev/turn.next default to alt+arrowup/alt+arrowdown, deliberately sharing the composer's alt+arrowup "edit last queued" chord: the settings conflict checker already treats a shared shipped default as intentional (same pattern as transcript.find/diff.find on mod+f), and useTurnNavigation backs off whenever the composer textarea owns focus so the two never fire for the same keypress. currentRailTurn is TurnRail's scrollspy heuristic pulled out so the shortcuts find "current" the same way the rail's own highlight does, then step to the neighboring turn via the existing scroll-to-turn jump. PageUp/PageDown page the transcript body by ~90% of its height outside any editable element; the composer textarea keeps native paging. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Confirm before closing a terminal with something still running (#1773) electron/terminal.js: foregroundCommand/isBusy best-effort check whether anything other than the login shell is running under a session's pid (POSIX: any live child via `ps`; Windows ConPTY has no cheap query, so it is always busy there). Wired through a new terminal:isBusy IPC channel (ipc-devserver.js, ipcChannels.ts, preload regenerated, webScopes terminal:observe) that the per-tab close button in TerminalPane.tsx calls on click: idle shells close immediately, a running command shows "Close terminal? <command> is still running." with Close/Cancel, using the same confirm-dialog shape and useModalFocus as the rest of the app. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Add commitMessageInstructions and prInstructions settings (#1774) Two new AppSettings strings, normalized/validated exactly like titleInstructions (#1765): trimmed, capped at ~1000 chars, default empty. When set, they are appended to the commit message prompt (electron/commitmsg.js buildPrompt) and the PR title/body prompt (buildPrPrompt) as a "Follow these instructions from the user:" block that takes precedence over the default style; the repo's PR template still applies on top. Mirrors the #1765 settings plumbing in store-normalize.js, store-settings-methods.js, the dev/browser settings fixture, and the AppSettings type, plus the auto-settle/budget-spend snapshot tests. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Add commit message and PR instructions textareas to GitPane settings Two textareas in the Pull requests section (Commit message instructions, PR title and body instructions) save on blur, mirroring the thread title instructions field. Distinct key prefixes avoid a React duplicate-key collision when both fields are empty. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Add Copy error report to the crash screen (#1773) src/components/ErrorBoundary.tsx: componentDidCatch now keeps ErrorInfo.componentStack in state, and the fallback gains a collapsed <details> stack trace plus a "Copy error report" button that writes a plain-text report (app version from the existing __BUILD_SHA__ seam, platform, pane name, error.message, error.stack, componentStack) to the clipboard, with the same "Copied" label-flip idiom used elsewhere (e.g. Markdown's code-block Copy button). formatErrorReport is exported and unit-tested separately from the clipboard plumbing. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Test Tree view, +/- total, and copy path; fix a shared chip class clash (#1772) Renderer tests for all three #1772 features in both the Git pane and the PR Code tab: List/Tree toggle plus a directory collapse, the summed +/- total respecting Hide tests, and copy-path (button, Alt-click absolute path, and the Git pane's context menu item) with a stubbed clipboard. Along the way, fix a real regression from the Tree view change: the PR Code tab's new file-chip wrapper reused TurnDiffPanel's `.fileBtn` class, which TurnDiffPanel's own turn-diff file chips still render with — stripping their pill styling. The PR tab's inner button is now `.entryBtn`, leaving `.fileBtn` untouched for its original caller. Co-Authored-By: Claude Sonnet 5 <[email protected]> * feat: per-project default-worktree override (#1775) Projects already carry per-project defaults (threadDefaults); worktree was the one global-only setting. Add ProjectInfo.defaultWorktree (true/false pins it, null/absent inherits settings.defaultWorktree), editable in EditProjectModal as a 3-way select, and resolve the override through one shared helper per layer (electron/services-shared.js resolveDefaultWorktree, src/projectDefaults.ts) at every place a new thread's worktree choice defaults: the plain "New thread" button (useCoderRuns), Ask's Start work (ThreadView), and chat-initiated threads (electron/channels/index.js). Co-Authored-By: Claude Sonnet 5 <[email protected]> * feat: list a run's named background jobs (#1775) The working-strip label collapses background work into one rolling line ("N agents working in the background" or the current tool). Add a derived list instead: deriveBackgroundJobs (src/backgroundJobs.ts) reads shells (Bash run_in_background, paired with a later KillShell/BashOutput by the shell id the launch echoes back) and a still-open BashOutput poll straight from the transcript's tool-call messages, reuses thread.subagents for in-session Agent/Task subagents (already tracked server-side; this only adds a startedAt stamp in electron/runner-subagents.js), and reads running workflow fan-out agents off detail.workflow. ThreadView shows it as a compact "Background: N running" row under the working indicator, expanding to each job's label and elapsed time; the one-line label stays as the collapsed summary. Jobs disappear with the run because the derivation only runs while the thread is working. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Add threads:setSortKey IPC for manual sidebar drag order (#1769) New per-thread sortKey field (number | null, null by default) persisted through every layer: ipc.ts/ipcChannels.ts, the regenerated preload, electron/services-thread-state.js (plain field write, same shape and bookkeeping-only updatedAt rule as setPinned), the ipc-threads.js handler, the web scope allow-list, and the dev/fake coder implementations used by tests. No ordering logic lives here yet - just the storage seam. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Add the manual sidebar order helper: midpoint keys + renumbering (#1769) src/threadOrder.ts is the pure fractional-ordering math: applyManualOrder layers a persisted sortKey on top of a section's normal order (keyed threads first ascending, unkeyed ones keep today's order), reorderSortKeys turns a drop between two neighbors into a midpoint key or, when a neighbor has no key or the gap has collapsed, a renumber of the whole section, and moveNeighbors computes the one-step neighbors for a keyboard move. buildFlatSidebar applies it to the pinned and active sections only - settled/snoozed/archived keep today's ordering, unaffected. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Drag threads into your own order in the sidebar (#1769) Wires src/threadOrder.ts into the sidebar UI: - ThreadCard's existing detach-drag (#519) grows a reorder sibling: the outer row now also reports dragover/drop, and draggable no longer requires desktop's canDetachThread() (reordering works on web too). A thin indicator line (data-drop-indicator, the existing --accent marker color) shows where the drop would land; the dragged row dims. - src/components/sidebar/useThreadReorder.ts holds the drag state and calls onSetSortKey. Handlers are stable across renders (state read through a ref, not a closure dependency) so passing the same function to every card never defeats ThreadCard's memo (#617) while idle. - Alt+Shift+ArrowUp/Down (new thread.moveUp/moveDown bindings) moves the selected thread one step within its section, through the same helper. - Cross-section drag is refused: no patch, no indicator. - Plumbed end to end: App.tsx handleSetSortKey -> Sidebar onSetSortKey. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Add a hover-delayed detail card for PR links and pills (#1771) Hovering a PR badge, PR list row, or linked PR for ~400ms shows title, state, checks summary, review decision, +/- lines and author, fetched through the existing git:prDetail IPC (extended with a checks rollup and reviewDecision), cached ~60s and deduped per PR. Escape/mouse-out closes it; keyboard focus opens it too; a failed fetch stays quiet. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Auto-link owner/repo#123 and bare #123 refs in markdown (#1771) linkifyNode (PathLinks.tsx) now also turns qualified owner/repo#123 refs and bare #123 (2+ digits) into links to github.com/<owner>/<repo>/issues/<n>. Bare refs resolve against the thread's project GitHub remote (project.slug, threaded through ThreadLinkContext); qualified refs work regardless. Skips URLs, inline code and fenced code, and anything that looks like a file path or a CSS hex color. A github.com link (synthesized or literal) gets a small GitHub mark and, when it points at a PR or issue, the hover card from the previous commit. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Find threads by linked PR number or title in search (#1771) _buildSearchSnapshot now folds each thread's linked PR numbers (both "#482" and "482", from prNumber and prLinks) and PR titles into the notes text handed to the search scan, so ⌘K and sidebar search match a thread by its PR. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Sidebar draft marker: server snapshot for renderToString (#1770) The ThreadCard draft subscription had no getServerSnapshot, so the prRender tests that render the card to a string threw. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Test: approval-redirect test accepts an already-drained queue (#1762) On fast macOS runners the Codex turn ends right after the decline and the runner drains the queued redirect into the next turn before the assertion reads thread.queued. Accept either state, and check the text is posted once. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Willem <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
currentbits
added a commit
that referenced
this pull request
Oct 31, 2026
…eads, and run-once automations (#1813) * feat: drag a sidebar thread into the composer as context (#1810) Dropping a thread row (the same application/x-solenta-thread payload ThreadCard's dragstart already sets for detach-to-window and the #1769 reorder) onto the composer now adds the same thread context chip the @-mention menu's thread row would, instead of falling through to the file-drop path. Own-thread and already-chipped drops are no-ops, and the composer's existing drop overlay shows while the drag hovers. useFileDrop gets an onThreadDrop option checked before the OS-file path, mirroring the #1794 onMentionPath pattern. dropFiles.ts exports THREAD_DRAG_MIME/isThreadDrag so ThreadCard, useFileDrop, and tests share one constant instead of a duplicated string literal. Sidebar search results render through the same ThreadCard component as the rest of the list, so they were already covered by the dragstart change with no extra wiring. Co-Authored-By: Claude Sonnet 5 <[email protected]> * feat(sidebar): add collapsed-by-default Watching section (#1811) Idle, unpinned, unsnoozed, unsettled threads with an active PR watch (prWatch !== false, open PR) now carve out of the inbox into their own "Watching · N" shelf, below the active rows and above Snoozed. A wake makes the thread working, which routes it to the Working shelf instead, so it leaves Watching on its own. Collapsed state persists the same way as the other shelves. Rows show "Watching #123" in the status line via a new isWatchingPr helper reused by both sidebarGroups and status.ts. No IPC changes needed: prWatch/prWatchState/prNumber/prState already reach the renderer's ThreadInfo unstripped by services-threads.js listRow. Co-Authored-By: Claude Sonnet 5 <[email protected]> * test(sidebar): cover the Watching section (#1811) Grouping precedence (idle+watched -> Watching, working/pinned/snoozed override it, prWatch:false and closed/merged PRs keep threads out), collapsed-by-default state, the "Watching #123" status text, and flatVisibleThreadIds/nextThreadAfterSettle keyboard-order parity. Two pre-existing sidebar.test.tsx fixtures (card anatomy, PR hover card) used an idle thread with an open PR purely to test PR badge rendering; they now default into the new Watching shelf like any real thread would, so mark them prWatch: false to keep testing what they were meant to test. Co-Authored-By: Claude Sonnet 5 <[email protected]> * feat(automations): add one-time "once" schedule preset (#1812) Adds a single-fire schedule alongside hourly/daily/weekly/cron: preset "once" with a future local-time runAt. The scheduler fires it at or after runAt (within a 24h grace window if the app was closed, otherwise marks it missed) and then disables it with lastRunAt stamped, so it never fires twice. Validation rejects a past runAt on create, and on edit only when runAt itself is being set (editing an already-fired row otherwise must not re-litigate a timestamp that is now, correctly, in the past). Threaded through: solenta.json shared-automation rows and their hash, store migration healing, the automations IPC/service layer, the automation_create MCP tool schema + description, and the Automations UI (schedule picker, datetime-local input with min = now + 1 minute, and row labels: "Once · <time>", "Ran once", "Missed"). Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Willem <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #67 (follow-up from #34).
Why
The only spend cap was the global daily budget, enforced at run start. A single fan-out orchestration could burn the entire daily budget, starving every other thread. This adds an optional per-orchestration ceiling: when an orchestrator's crew collectively crosses it, the next wake-up is refused and the thread lands failed with the reason — reusing the visible surfacing path from #34 (sidebar badge, Retry turn, desktop notification) instead of dying silently.
Design decisions (the issue's open questions)
dailyBudgetUsd, and per-threadusageByThread.costUsdalready exists; token counts aren't comparable across providers/models.orchestrationBudgetUsd, "Per-orchestration budget (USD)" next to the daily budget). Per-launch config isn't actionable today because fan-outs are agent-driven: an orchestrator is a normal thread that forks workers over thecoder-threadsMCP, so there is no fan-out launch UI to hang a per-launch option on.flushOrchNotices(orchestration wake-ups), not instartRun, so the user can still send turns and hit Retry after raising the cap. Effectively resumable.What changed
electron/store.js— neworchestrationBudgetUsdsetting: schema default, normalize-on-load (junk/absent → null, no cap),setSettingsvalidation (positive number or null).electron/services.js—orchestrationSpend(store, threadId)sums the orchestrator's own usage plus every directorchWorkerfork (nested crews are not rolled up; a worker that fans out is its own orchestrator with its own ceiling).assertUnderOrchestrationBudgetthrowsOrchestration budget reached ($X of $Y for this thread's crew)…at/over the ceiling.electron/runner.js—flushOrchNoticesruns the assert before the wake-upstartRun; the existing Budget exhaustion kills orchestration silently #34 catch surfaces the refusal as a failed orchestrator with the reason. In-flight workers are never killed (same contract as the daily cap).AppSettings.orchestrationBudgetUsd(src/shared/ipc.ts), Settings field with save/blur/validation surfacing (src/components/SettingsModal.tsx), and thesrc/devCoder.ts/test/support/fakeCoder.tsfixtures mirror the backend validation.docs/ARCHITECTURE.md— Spend section documents the ceiling and its semantics.Tests
electron/test/runner.test.js: wake-up over the ceiling lands the orchestrator failed with the reason (manual-timer pattern from the Budget exhaustion kills orchestration silently #34 test), crew under the ceiling still wakes, and a user-sent turn still runs over the ceiling (Retry stays possible).electron/test/budget-spend.test.js: set/clear/validate/persist for the new key, junk-on-disk heals to null. Also fixed a stale settings-shapedeepEqualhere that was already red at HEAD (missingnotificationskey).test/settingsModal.test.tsx: the new field renders, pre-fills, saves a number, clears to null, and surfaces backend rejection viarole=alert.Suites: renderer 703/703, core 38/38, memory-server 120/120, electron 763/772 — the 9 failures are the orch-server port-bind suites, which reproduce identically on pristine HEAD in this environment (verified against a
git archivecopy of HEAD); unrelated to this change.Possible follow-up: a per-thread override of the global ceiling (thread field + IPC, same pattern as
permissionMode) if per-orchestration granularity is wanted later.