Commit Graph

264 Commits

Author SHA1 Message Date
can1357 c9b3c23600 feat(task): enabled schema override flow to keep task payloads with warnings
- Propagated `schemaOverridden` from `YieldTool` into executor `YieldItem` metadata.
- Bypassed schema validation on override or schema-builder errors and kept payload output with success exit.
- Emitted `SUBAGENT_WARNING_SCHEMA_OVERRIDDEN` so accepted override results no longer surface as `schema_violation`.
2026-06-08 02:04:59 +02:00
can1357 16f9c199da ux(coding-agent/task): adjusted running task progress output to animate descriptions
- Reworked running-task rendering so shimmer animation is applied to descriptions instead of IDs.
- Added accent coloring for the separator and description text to keep the status line formatting consistent.
2026-06-08 01:46:03 +02:00
roboomp 0f243f4505 style: bun run fix 2026-06-07 21:07:48 +00:00
roboomp dd8b50649a fix(coding-agent): suppressed reviewer findings injection when schema rejects it
`finalizeSubprocessOutput` always spliced collected `report_finding`
entries onto a top-level `findings` array regardless of the active output
schema. A caller-supplied schema with `additionalProperties: false` and
no `findings` property would accept the raw payload in-tool (via the
`yield` validator, which only sees the pre-injection data) but then fail
post-mortem validation — emitting `schema_violation: findings: must not
be present` and propagating as a fatal `RuntimeError` through
`agent-bridge.ts` and the eval Python/JS preludes, collapsing the entire
workflow cell along with any prior successful subagent work.

`normalizeCompleteData` now takes the resolved validator and only
performs the injection when the augmented candidate validates. When the
schema rejects it, the raw payload is returned instead — which the in-
tool yield validator already accepted, so the lockstep guarantee
documented at the top of `output-schema-validator.ts` is honored.
Findings remain visible via the agent progress stream and JSONL
artifact, so no information is dropped when injection is suppressed.

Both finalize call paths (yield-success and no-yield fallback) now share
the single validator build instead of constructing it twice, and the
yield-path schema_violation branch is now reached only via the
explicit malformed-schema check, never via spurious findings rejection.

Fixes #2070
2026-06-07 21:07:43 +00:00
can1357 1b2373425b feat(packages/coding-agent): set 30fps stream and stabilized read groups
- Reduced shimmer-driven UI animations and borders to a 30fps cadence.
- Collapsed consecutive read tool calls into one finalized transcript block.
- Tracked visible assistant content to finalize and reset read groups correctly.
- Updated running task rows to static bullet markers with shimmer-only subagent labels.
2026-06-07 08:42:51 +02:00
can1357 0914379f49 fix(coding-agent): rendered shared task context as markdown and froze async block borders
- Updated task call and result rendering to process shared context with the Markdown renderer, so context sections are now displayed with proper Markdown formatting.
- Stopped shimmer animation on pending bash/eval/task blocks once async state is `running`, preventing the committed frame from freezing a transient dark border segment.
- Adjusted rule path display to fall back to a root-relative path when cwd-relative resolution is unavailable.
2026-06-07 08:01:52 +02:00
can1357 ddd8c86209 ux(coding-agent): added separator support for unlabeled output sections
- Extended `OutputBlock` section metadata with an optional `separator` flag and included it in cache hashing.
- Updated output block rendering to emit an unlabeled section divider when the separator flag is enabled.
- Marked task and result render paths to request separators for non-context content sections to improve output clarity.
2026-06-07 07:08:06 +02:00
can1357 9bd9e3127e feat(coding-agent): added /tan background forking with prompt cache inheritance
- Added `/tan` slash command registration and interactive handling.
- Added TanCommandController validation and async task scheduling for `/tan` dispatch.
- Added session cloning that suppresses breadcrumbs, copies artifacts, and handles abort cleanup.
- Added `promptCacheKey` support in Agent and inherited `providerPromptCacheKey` in session creation.
2026-06-07 06:52:15 +02:00
can1357 136106ba4f fix(coding-agent): kept task context visible after first progress snapshot
- Rendered shared `# Goal`/`# Constraints` brief in result frame via buildContextSection helper.
- Undid per-field double-encoding so brief reads cleanly from raw result args.
- Removed header spinner since per-agent body lines already animate.
- Wrapped run summary in bracket glyphs to match bash tool footer.
2026-06-07 06:07:17 +02:00
can1357 28c3e2a986 feat(task-rendering): added unified call/result task rendering
- Enabled call/result merging by setting mergeCallAndResult on TaskTool.
- Reworked task item lines into bullet lists and removed tree-style prefixes.
- Rendered task calls as framed blocks with isolated headers and pending status metadata.
- Changed result previews to hide task titles and `Tasks` headings when a result is present.
2026-06-07 05:13:58 +02:00
can1357 133137c9a6 fix(eval): surfaced subagent abort reasons and disabled runtime cap
- Used `||` so empty stderr falls through to abortReason in agent bridge.
- Preferred assistant errorMessage over "Cancelled by caller" on internal aborts.
- Forced `maxRuntimeMs: 0` for eval subagents via ExecutorOptions override.
2026-06-06 21:33:07 +02:00
can1357 c49d5c99b1 fix(coding-agent): removed preview line capping on context lines
- Rendered full context lines instead of truncating via capPreviewLines.
2026-06-06 18:21:09 +02:00
can1357 ecd80120a3 feat(coding-agent): added framed tool rendering with capped streaming previews
- Wrapped tool call/result renderers with framed block markers for full-width display.
- Added preview-line caps via capPreviewLines to bound multiline outputs with truncation hints.
- Added code-cell tail rendering so streaming output shows capped tail slices with markers.
- Added setPaddingX in Box and applied framed-inline padding adjustments for tight layouts.
2026-06-06 15:19:06 +02:00
roboomp 1ffa6dc6fb fix(coding-agent): guarded task renderer against non-array yield slot
renderAgentResult and the live-progress sibling cast
extractedToolData?.yield to Array<{ data }> and called ?.map without
checking the actual runtime shape. Optional chaining only short-circuits
on null/undefined, so any stray non-array value (a single yield object
landing in the slot) made .map undefined and threw
TypeError: completeData?.map is not a function — taking down every
`review` task render.

Both sites now route through a new normalizeYieldData helper (next to
normalizeReportFindings) that returns an array of yield records: it
preserves arrays unchanged, wraps a single object as a 1-element array
so the verdict still renders, and drops primitives. Added a regression
test exercising the result branch, the progress branch, the primitive
fall-through, and the canonical array shape — all of the failing-branch
ones reproduce the crash on the pre-fix renderer.

Fixes #1987
2026-06-06 11:16:44 +00:00
can1357 9151ce9623 Merge remote-tracking branch 'origin/farm/9e76efd7/task-fallback-sync-no-async-manager' 2026-06-05 11:43:28 +02:00
can1357 c39350d598 fix(dry-balance): decoupled bench mode from sampling flags
- Skipped count/concurrency normalization when --bench is set.
- Errored when no OAuth accounts resolve for the provider.
- Updated flag docs to run one request per OAuth account.
2026-06-05 11:43:17 +02:00
can1357 0340604f64 Merge remote-tracking branch 'origin/farm/9c8b047b/fix-async-job-manager-singleton-overwrite' 2026-06-05 11:41:15 +02:00
can1357 eb8e4f7657 feat(task): added read-summarize override for subagents
- Parsed `read-summarize` frontmatter into `readSummarize` field.
- Applied `read.summarize.enabled: false` override on isolated subagent settings.
- Disabled summarization for `explore` and `librarian` agents.
2026-06-05 11:36:13 +02:00
roboomp eda5eebe71 fix(sdk): route bash/task/job through ToolSession.asyncJobManager to keep secondary sessions isolated
Per PR review on #1926: a secondary in-process top-level createAgentSession() that exposes bash/task/job tools would still call AsyncJobManager.instance() at execute time, register on the primary's manager, and have the primary's onJobComplete enqueue results into the primary's yieldQueue — corrupting the owning session's conversation.

ToolSession now carries an asyncJobManager reference scoped to its session: the constructed manager for top-level sessions, the inherited singleton for subagents (so their bash/task completions still flow into the spawning conversation as before), and undefined for secondary in-process top-level sessions that found a singleton already installed. bash, task, and job tools resolve the manager through ToolSession instead of the process-global singleton, so a secondary session whose tools attempt async work fails fast with the standard "Async job manager unavailable" error instead of contaminating the primary.
2026-06-05 09:22:18 +00:00
roboomp de21a28e43 fix(task): fallback to sync when AsyncJobManager is unavailable
When `async.enabled` is true but `AsyncJobManager.instance()` returns
`undefined` (orphaned-session state, host that never wired one up, etc.),
the `task` tool was returning a hard error and was unusable for the rest
of the session — even though the existing sync codepath (`#executeSync`,
which still parallelizes via `mapWithConcurrencyLimit`) was right there.

Fall back to `#executeSync` instead and emit a `logger.warn` so the
missing-manager state stays diagnosable. Background/job-poll semantics
are lost in this degraded mode, but the tool keeps working.

Fixes #1922
2026-06-05 08:54:49 +00:00
can1357 3f22f939a2 feat(coding-agent/plan-mode): shared approved plan context with spawned subagents
- Added `loadOverallPlanReference` to resolve a session plan reference from local storage and skip empty or missing files.
- Updated task execution to read the active plan reference (except in plan mode) and pass it into each spawned subagent.
- Extended the subagent system prompt and session SDK/tools plumbing so subagents receive and render the approved plan path and contents.
2026-06-04 04:10:53 +02:00
can1357 bc5eeef398 feat(coding-agent): tagged read-only agents in task tool description
- Added `isReadOnlyAgent` and `READ_ONLY_TOOL_NAMES` to classify agents.
- Marked read-only agents and forbade edits, commands, and reasoning offload.
- Added tests for capability classification and description rendering.
2026-06-04 03:24:41 +02:00
can1357 dc4aeb7b88 refactor(coding-agent): renamed todo_write tool to todo
- Renamed `TodoWriteTool` to `TodoTool` and its source/prompt files.
- Updated tool registration, schema, renderers, and gating to `todo`.
- Adjusted cursor provider native tool names and tests to match.
- Renamed strike-animation constants and `todo-error-reminder` type.
2026-06-04 02:45:30 +02:00
can1357 384a206737 refactor(task): replaced numeric-prefix ids with name-first agent output ids
- Changed `AgentOutputManager` to use requested names verbatim, adding `-2`/`-3` suffixes only on repeats (e.g. `Anna`, `Anna-2`).
- Renamed main agent id from `0-Main` to `Main`; nested ids now use dot notation without numeric prefix (e.g. `Parent.Child`).
- Updated task widget to render dotted hierarchy as `Parent>Child` breadcrumb without leading index.
- Resume scan now tracks seen names instead of a counter to avoid clobbering prior outputs.
2026-06-02 06:50:03 +02:00
can1357 72cf371b9d Merge remote-tracking branch 'origin/farm/f30c73d1/demote-subagent-abort-log' 2026-06-01 14:37:10 +02:00
roboomp d14aa4dbe5 fix(task): demote subagent reminder-loop abort log
The catch around the subagent yield-reminder prompt previously logged
every exception at ERROR. User cancel (^C) and compaction-driven aborts
both surface as ToolAbortError through awaitAbortable, so benign control
flow generated 9 spurious 'Subagent prompt failed' errors in 2 days on
the reporter's instance.

Gate the ERROR branch on '!abortSignal.aborted && !(err instanceof
ToolAbortError)' and route the abort path to logger.debug. The outer
catch + finally still mark the run aborted, so observable behaviour is
unchanged.

Fixes #1623
2026-06-01 06:20:55 +00:00
can1357 7e11bea8f4 fix(coding-agent): repaired per-field double-encoded JSON in task tool
- Added `repairDoubleEncodedJsonString` to unescape fields double-encoded by the model (e.g. literal `\n`, `\"`, `\uXXXX` in `context`/`assignment`/`description`).
- Scoped repair to natural-language fields only, leaving code-bearing tools untouched.
- Applied repair on both render and execution paths in `TaskTool`.
2026-05-31 20:17:38 +02:00
can1357 a45747f96a refactor(coding-agent): replaced bracket-style section tags with underlined headers
- Converted [SECTION]...[/SECTION] markers to "SECTION\n===" format in system prompt templates.
- Updated system conventions doc to reference the new marker style.
- Updated tests to match against the new header pattern.
2026-05-31 20:10:56 +02:00
can1357 68430dee5c chore: renamed mnemosyne package to mnemopi
- Updated package name, directory, and binary from mnemosyne to mnemopi.
- Updated all lockfile references and workspace paths accordingly.
2026-05-31 08:45:12 +02:00
can1357 d1bd14f020 feat(coding-agent): propagated mcpManager and localProtocolOptions to subagents
- Stored mcpManager and localProtocolOptions on ToolSession so nested subagents inherit them without relying on process-global singletons.
- TaskTool now uses the session's localProtocolOptions and mcpManager when spawning sub-tasks, falling back to defaults if absent.
2026-05-31 06:49:20 +02:00
can1357 e22b31401b feat(packages/coding-agent): added orchestrate notices for session output
- Added orchestrate keyword detection and notice handling for non-synthetic prompts.
- Added orchestrate notice handling in session output paths, including streaming and append delivery.
- Added a system orchestrate notice specifying task-subagent delegation, phase workflow, and validation gates.
- Added shared gradient-highlighter utilities and switched ultrathink highlighting to use cached palettes.
- Removed embedded orchestrate prompt artifacts and updated usage tips for orchestration, ultrathink, and /login behavior.
2026-05-30 17:34:38 +02:00
can1357 99365385aa feat(mnemosyne): added mnemosyne parent-state sync in delegated sessions
- Added parentMnemosyneSessionState propagation from session state through SDK, executor, and task options into nested sessions.
- Added getMnemosyneSessionState() and rekeying logic to refresh Mnemosyne IDs during session sync, switch, and restore.
- Added Mnemosyne reset and teardown cleanup on unaliasing or restoration to avoid stale state.
2026-05-30 16:22:12 +02:00
can1357 baafa3c027 feat(render): added task renderContext propagation to hide preview rows
- Propagated task `renderContext` through `ToolExecutionComponent` so call rendering can detect result state.
- Suppressed task call-preview rows when a result snapshot exists to avoid duplicate task lines.
2026-05-30 16:22:12 +02:00
can1357 f559f6b10c ux(coding-agent): added ? fallback for %/window context in status/task
- Added formatContextUsage to render context as `%/window` with `?` fallback across status and task views.
- Updated task renderCall to show dispatched agents as tree entries with `Tasks (2)` header and `#3` fallback.
- Capped task preview collapse at 12 entries and added `... N more agents` overflow messaging.
- Replaced hard-coded dot separators with `theme.sep.dot` in subagent cost and context output.
- Added tests for streaming task preview rendering and updated nested-live expectations for percent/context output.
2026-05-30 15:30:05 +02:00
can1357 9d29fc9716 feat(mnemosyne): added configurable memory scoping with per-project-tagged mode
- Added `mnemosyne.scoping` setting: `global`, `per-project`, and `per-project-tagged`.
- `per-project-tagged` writes to a project-local bank while merging global memories on recall.
- Refactored `MnemosyneSessionState` to manage scoped recall/retain targets and deduplication.
- Updated hindsight tools to route recall/retain through scoped methods.
2026-05-30 14:47:53 +02:00
can1357 377ed34e08 refactor(coding-agent): replaced ctx/Σ labels with icon and cleaner cost separator
- Removed "ctx" suffix and cumulative Σ-token display from status lines.
- Replaced "N tools" text with tool count + extensionTool icon.
- Changed cost separator to ` . ` to visually distinguish it from dim stats.
- Added test asserting new format and absence of old labels.
2026-05-30 06:38:09 +02:00
can1357 535f7cfa89 fix(coding-agent/tools): reworked yolo approval resolution to honor user tool policies
- In `resolveApproval`, yolo mode now returns the user policy directly (`allow`/`prompt`/`deny`) and ignores tool `override` prompts.
- Updated approval-mode and approval unit tests to match the new behavior for critical bash patterns under yolo and auto-approve.
- Updated docs and settings metadata to describe yolo as user-policy-driven rather than override-driven.
2026-05-27 00:21:33 +02:00
can1357 e4a16451ec feat(coding-agent): added coding-agent approval types and mode options
- Added `ToolTier`, `ToolApproval`, and `ToolApprovalDecision` types and exported approval APIs.
- Updated approval-mode options from `auto|prompt|custom` to `always-ask|write|yolo` and defaulted mode to `yolo`.
- Changed approval resolution to apply per-tool decisions first, then mode-tier limits, with legacy-mode migration.
- Assigned read/write/exec `approval` and approval-detail prompts across built-in, custom, extension, and MCP tools.
2026-05-26 21:52:16 +02:00
oldschoola 384f429461 fix(coding-agent): tighten approval edge cases and rewrite mode docs
- approval: user 'tool: deny' now wins over critical-pattern override
  (the override only tightens allow->prompt; it must never re-arm a denied tool).
- approval: rename hindsight policy keys to match registered tool names
  (recall/retain/reflect, not hindsight_recall/hindsight_retain).
- approval: head+tail truncation for bash/ssh command prompts so a
  destructive suffix buried after a long benign preamble stays visible.
- task/executor: force tools.approvalMode='auto' in createSubagentSettings
  so subagents (which have no UI) cannot deadlock on per-tool prompts;
  the parent's approval of the task call is the authorization.
- docs/approval-mode: rewrite so every example surfaces tools.approvalMode
  and explains that tools.approval is ignored outside 'custom' mode.
2026-05-26 20:53:35 +02:00
Can Bölük e1b52714be Merge pull request #1398 from justadudewithtime/feat/resolved-model-badge
feat(coding-agent): surface resolved subagent model badge in task widget
2026-05-26 21:25:57 +03:00
can1357 8a5b3e9552 feat(eval): added shared executor inheritance for subagents with concurrent async cells
- Removed per-session run queues from JS and Python backends, allowing async cells on the same session id to interleave.
- Introduced `getEvalSessionId` on ToolSession so subagents spawned via `task` inherit the parent's executor id and share JS VM and Python kernel state.
- Switched JS runtime state from module-level fields to AsyncLocalStorage so concurrent runs route output and tool calls to their own context.
- Changed Python runner to an asyncio event loop with per-request tasks and ContextVar-based run id tracking for concurrent execution.
- Added mtime-based module cache eviction to preserve singleton state across re-imports of unchanged local files.
2026-05-26 14:37:56 +02:00
Magxm 03a29f3aec refactor(task): hoist settings.get into local before appendAgentStats calls 2026-05-26 18:00:14 +09:00
Magxm 075bfb94c1 fix(task): decouple appendAgentStats from global settings and sanitize resolvedModel
- Move settings.get("task.showResolvedModelBadge") out of appendAgentStats
  and into its callers, passing the value as an explicit opts field.
  This removes a hidden dependency on global state and makes the
  function a pure formatter.
- Sanitize resolvedModel with replaceTabs() + truncateToWidth(30)
  before rendering, consistent with the file's existing sanitization
  patterns and AGENTS.md requirements.
2026-05-26 17:41:21 +09:00
Magxm 8f5da835e7 feat(coding-agent): surface resolved subagent model badge in task widget 2026-05-26 17:30:11 +09:00
can1357 e0eae43fde feat(tools): added shared output schema validator for YieldTool
- Unified output schema construction and validation by adding buildOutputValidator and using it in YieldTool and task executor.
- Added MAX_SCHEMA_RETRIES so YieldTool now retries schema failures three times with hints before overriding.
- Updated failure handling to use shared summarizeValidationFailure and formatters for required-field reporting.
- Added tests for output-schema-validator and YieldTool covering malformed schemas and nested-array retry edge cases.
2026-05-26 06:34:30 +02:00
roboomp 0a3a48b92d fix(task): respected parent lsp disable for subagents
Combined task.enableLsp with the parent session enableLsp gate before spawning subagents, so --no-lsp remains authoritative even when subagent LSP is enabled in settings.

Fixes #1385
2026-05-26 03:13:28 +00:00
roboomp 28a0dc3ae4 feat(task): gated subagent LSP behind task.enableLsp setting
Added task.enableLsp (boolean, default false) and routed both regular and isolated subagent dispatch through it. Keeps subagents cheap by default while letting users opt in to LSP-aware delegation. Updated regression tests to cover the default-off, opt-in, plan-mode, and isolated paths.

Fixes #1385
2026-05-26 03:09:09 +00:00
roboomp 8948101e2b fix(task): forwarded parent enableLsp flag to subagents
Subagents now inherit the parent session's enableLsp value, so a top-level --no-lsp invocation propagates into spawned tasks instead of falling back to the executor's default of true.

Fixes #1385
2026-05-26 03:06:14 +00:00
roboomp 5ff1c747ce fix(task): inherited lsp for subagents
Removed the hardcoded subagent LSP disable flag so executor defaults and user settings control LSP availability. Passed the effective plan-mode agent definition into both regular and isolated subagent dispatch so plan-mode tool restrictions apply consistently.

Fixes #1385
2026-05-26 03:01:57 +00:00
Can Bölük d201442a16 Merge pull request #1372 from can1357/farm/e4c67c73/fix-subagent-session-start-busy
fix(agent): prevent subagent session_start busy race
2026-05-25 21:59:38 +03:00