Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Document agent lifecycle proposal and feature-first priorities

deee9093964bda1
diff --git a/desktop/tool/native_benchmark/README.md b/desktop/tool/native_benchmark/README.md
index 4acee37c5..4a7513c4e 100644
--- a/desktop/tool/native_benchmark/README.md
+++ b/desktop/tool/native_benchmark/README.md
@@ -26,8 +26,9 @@ From `desktop/`, build with a compatible Flutter SDK and Xcode:
python3 tool/native_benchmark/prepare.py --flutter /path/to/flutter
```
-Use the `BENCHMARK_APP` path printed by the build. Normally close the workspace preview and finish
-other builds/tests first. Keep this fixture in the foreground during a run; it
+Use the `BENCHMARK_APP` path printed by the build. Unlock the Mac, normally close
+the workspace preview and finish other builds/tests first. A locked desktop
+cannot supply the active/key window required for valid samples. Keep this fixture in the foreground during a run; it
exits on focus loss instead of reclaiming focus between observations. The runner
refuses to start alongside another preview or benchmark process and never quits
them. Its error names the exact bundle path. A development copy outside the
diff --git a/docs/harness-agent-lifecycle.md b/docs/harness-agent-lifecycle.md
new file mode 100644
index 000000000..a0c947539
--- /dev/null
+++ b/docs/harness-agent-lifecycle.md
@@ -0,0 +1,78 @@
+# Agent lifecycle: stop accumulating live sessions
+
+Proposal, September 14, 2026. The user raised this problem while reviewing the
+current developer experience. This document is a design recommendation, not an
+implemented lifecycle or authorization to stop existing agents.
+
+The user values closing a pane without ending its agent, but repeatedly creating
+agents leaves an ever-growing collection of running sessions. Preserve that
+useful separation and add an explicit way to finish work for now.
+
+## Recommended experience
+
+| Action | Meaning |
+| --- | --- |
+| Remove from swarm | Remove this view only. The agent and its other swarm memberships keep working. This clarifies today's Close agent label. |
+| Archive agent | Stop its runtime, preserve its conversation reference and launch context, and move it out of the active collection. This affects the agent across swarms, not only one pane. |
+| Resume | Restore the archived conversation in a runtime and add it to the chosen swarm. Reuse the same Harness agent identity. |
+| Delete agent | Keep the separate explicit removal action. Do not treat ordinary closure or archiving as permission to delete project files or provider transcripts. |
+
+- Put Archive agent in the pane menu and the Agent menu. Explain that it stops
+ the agent and saves it for later. Closing a swarm continues to close views.
+- Add and machine/project starters show active agents by default. Archived
+ agents remain discoverable through History and an explicit Archived filter;
+ their action says Resume and add. Navigate continues to describe existing
+ open destinations, with no implicit restart or membership changes.
+- Offer Archive unused agents… as an explicit bulk cleanup action. List
+ candidates with machine/project, last activity and known swarm membership.
+ Let the user choose and review the set. Do not turn local absence from a swarm
+ into an automatic stop rule: an agent may still be useful elsewhere.
+- Keep Cmd-N opening Add so reusing existing work remains the primary entry.
+ New agent still means a fresh agent. Do not silently redirect a deliberate
+ creation into an older conversation.
+- Start with deliberate archive/resume and bulk cleanup. Automatic inactivity
+ policies can come later. Quiet terminal output does not establish that an
+ agent has finished working.
+
+## What implementation must preserve
+
+Archive must be durable on the agent's machine, shared with other clients and
+honored by discovery/reboot restoration. Hiding a row in the desktop alone would
+leave the process running and recreate the same accumulation problem.
+
+Store and validate the existing provider session identifier, working directory,
+profile/launch references and useful recent output before stopping. Confirm
+termination before reporting Archived. If saving or stopping fails, retain a
+visible recoverable agent and report the actual outcome. Do not expose launch
+credentials in UI or copy them into desktop preferences.
+
+Resume is conversation restoration, not an exact snapshot of process memory.
+Only offer the promised stop-and-resume path where the provider/session can
+support it. Explain unsupported cases before any stop. If resuming fails, keep
+the archived record with Retry; starting a fresh conversation must be a separate
+explicit action. An active task needs an explicit interruption decision, and
+bulk selection should not include working agents by default.
+
+Current source has useful pieces but not this contract:
+
+- `cli/src/cli.ts` handles `agent_delete` by forgetting the live registration
+ and asynchronously terminating the validated engine process. It preserves
+ some recap/name data; it is not an acknowledged Archive operation.
+- `cli/src/lib/restartAgent.ts` tries the provider session and may fall back to
+ a fresh conversation. That fallback must not be reused silently for Resume.
+- `cli/src/lib/restoreAgents.ts` recreates missing registered runtimes after a
+ reboot. An archived state must explicitly exclude those entries from this
+ restoration and from discovery that would otherwise resurrect them.
+
+Acceptance checks should cover repeated requests, offline and partial failures,
+agent identity across clients, daemon restarts, shared swarm memberships,
+unsupported resume, and preservation of provider/workspace choices. Exercise
+process termination only with disposable fixtures; current user agents are not
+test inputs or cleanup targets.
+
+## Reference
+
+VS Code documents archiving completed agent sessions, restoring them to the
+active list, and filtering archived sessions separately. That supports the
+organizational pattern; it does not establish Harness's proposed process-stop
+or provider-resume guarantees. [Manage agent sessions](https://code.visualstudio.com/docs/agents/run/sessions/manage-sessions#archive-sessions).
diff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.md
index 9faf1e806..07468f407 100644
--- a/docs/harness-v2-handoff.md
+++ b/docs/harness-v2-handoff.md
@@ -6,6 +6,17 @@ historical checkpoints in [the progress log](harness-v2-progress.md). The user
requested a portable checkpoint, then asked this session to resume building;
the overall goal is still active and unfinished.
+**Latest priority:** the user explicitly deferred native benchmarking and further
+performance optimization. Focus on completing the agreed features and usability
+work. Do not interrupt them for a benchmark window or resume calibration merely
+because the desktop becomes available.
+
+**Current product discussion:** the user reports accumulating live agents after
+closing their views. [The lifecycle proposal](harness-agent-lifecycle.md) recommends
+explicit Archive/Resume plus bulk cleanup, preserving ordinary view closure.
+This is a proposal for discussion, not implemented behavior or authorization to
+archive/delete existing user sessions.
+
## Goal
Build the best everyday workspace for people directing persistent AI agents:
@@ -251,7 +262,10 @@ Available existing work gets Add search, three direct agent choices and New
agent. Machines and projects are visible as one-click swarm starters; the
first agent opens immediately and optional multi-select lives in shared Add.
A single usable local computer no longer needs a Machine dropdown
-in the creation form. Delayed discovery enables Enter on the primary action
+in the creation form. Failed agent checks now offer **Retry** in place, preserving
+the folder, chosen agent and permission setting; recovered Codex profile support
+loads into the same form. A late check for a different machine cannot change the
+current choice. Delayed discovery enables Enter on the primary action
without stealing an explicit focus choice. Offline/linking cases expose their
next action. Large text stacks the layout, and New agent now uses the shared
darker modal veil. See [first-use details](harness-v2-appearance-onboarding.md).
@@ -261,16 +275,19 @@ unverified; do not infer them from these UI changes.
**Archived drafts:** both are superseded. The onboarding ideas were adapted into
the common page, without adding another first-tab-only component.
-**Latest verification:** the picker-opening continuation on main passes 1,309
-desktop tests with one existing skip.
+**Latest verification:** the first-agent Retry continuation, including the team's
+`5f279e1` pane-menu Delete action, passes 1,311 desktop tests with one existing skip.
+Main subsequently fast-forwarded through the team's independent socket, terminal,
+titlebar and device changes at `87f8fcd`; the results below describe the tested
+`5f279e1` base plus this Retry change, not a rerun of that later integration.
Analyzer reports zero errors/warnings and 14 existing informational diagnostics
(12 vendored, two inherited from main). Logs:
-`/private/tmp/harness-add-open-titlebar-{tests,analyze}.log`.
-The final macOS arm64 Release build succeeds with
-`FLUTTER_TARGET=lib/main.dart`; log:
-`/private/tmp/harness-add-open-titlebar-build.log`. The running app was not
+`/private/tmp/harness-agent-check-retry-{full-tests,integrated-analyze}.log`.
+The macOS arm64 Release build succeeds with `FLUTTER_TARGET=lib/main.dart`
+in a separate output directory, `/private/tmp/harness-agent-check-retry-release`;
+log: `/private/tmp/harness-agent-check-retry-release.log`. The running app was not
restarted, so do not claim its process has loaded these source changes.
-The combined titlebar/picker source passes 51 native keymap decoder
+The preceding combined titlebar/picker source passed 51 native keymap decoder
and 347 AppKit assertions, including the exported Dart keymap and hidden window
layout. Native log: `/private/tmp/harness-add-open-titlebar-native.log`.
The preceding Add/shortcut integrated
@@ -305,16 +322,15 @@ a distinct Harness Benchmark app. Nine isolated Python checks pass. Preflight
distinguishes installed copies from workspace builds by exact location as well
as identity. Preserve its isolation and foreground/key-window guards. The
performance notes explain the earlier failed calibration; these tooling fixes
-provide no new latency measurements. The current disposable Release build
-succeeded at `/private/tmp/harness-native-benchmark-wt0_dt31`, with production
-source at `339f008`. The four changed picker source files match by SHA-256;
-the built bundle is `ai.autonomous.harness.benchmark`. Build receipt:
-`/private/tmp/harness-native-picker-prepare.log`. The earlier identity-fix runner
-correctly refused the running workspace preview, writing no timing result.
-This session confirmed that preview is still running; the new fixture was not
-launched. The later titlebar change supersedes that fixture's native source;
-rebuild it before measuring current main. The [performance record](harness-v2-performance.md)
-has the artifacts.
+provide no new latency measurements. The most recent disposable Release build
+is `/private/tmp/harness-native-benchmark-v99tt1m2`, pinned to production source
+`a6fe4a4`, including the later titlebar change. Its bundle identity is
+`ai.autonomous.harness.benchmark`; receipt:
+`/private/tmp/harness-native-approved-prepare.log`. It was not launched: the
+desktop was locked, and the user then deferred benchmarking to focus on
+features. Both Harness processes remained running. Rebuild from current source
+when measurement returns to scope. The [performance record](harness-v2-performance.md)
+retains the earlier fixtures and artifacts.
## Previous terminal fix and verification
@@ -390,17 +406,24 @@ that its isolated window can become active/key.
3. **Recheck fresh terminal positioning and real workflows** on disposable
local/remote agents: startup, delayed snapshots, resizing, returning to a
scrolled view, reconnect, paste, selection, and IME.
-4. **Measure native responsiveness** under representative retained/output load,
+4. **Deferred: measure native responsiveness** under representative retained/output load,
using the repaired benchmark identity checks for the team's new
`ai.autonomous.harness` macOS bundle identifier (Linux now uses
`com.autonomous.harness` and executable `harness`). Nine isolation tests pass;
- a disposable Release fixture is available at
- `/private/tmp/harness-native-benchmark-wt0_dt31` from source `339f008`.
- Rebuild it for the team's later titlebar change when the measurement window
- is available. The workspace preview is still
- running. A request to briefly close/reopen that preview
- for calibration is pending; elapsed time is not approval. No native samples
- have been accepted. See the current performance record for exact artifacts.
+ a fresh disposable Release fixture is available at
+ `/private/tmp/harness-native-benchmark-v99tt1m2` from source `a6fe4a4`,
+ including the team's later titlebar change. The user explicitly answered
+ **“Run it now”** and authorized briefly quitting/reopening the workspace
+ preview while leaving installed Harness and underlying agents running.
+ Do not ask for that approval again. The attempted UI access returned
+ `cgWindowNotFound`; a read-only console check confirmed the Mac is locked
+ (`CGSSessionScreenIsLocked = Yes`). Neither Harness process was stopped and
+ the benchmark was not launched. The user then said to do the benchmark later
+ and focus on building features. Keep it deferred. When measurement is back
+ in scope, use an unlocked desktop, normally close the exact workspace
+ preview, accept calibration only with the active/key-window guards passing,
+ and reopen the preview even if calibration fails. No native samples have been
+ accepted. See the current performance record for exact artifacts.
Then close remaining visual/platform/release qualification gaps. Maintain
the main-branch handoff and keep it honest about what's still unverified.
diff --git a/docs/harness-v2-performance.md b/docs/harness-v2-performance.md
index 5c4cb8db0..c6fca69be 100644
--- a/docs/harness-v2-performance.md
+++ b/docs/harness-v2-performance.md
@@ -137,6 +137,28 @@ no native samples were collected. Rebuild it if production source changes.
The team's later native titlebar change in `51c0d27` now requires that rebuild
before qualifying current main; the prepared fixture remains pinned to `339f008`.
+The user subsequently approved the brief preview quit/reopen with **“Run it
+now.”** A fresh isolated arm64 Release build from `a6fe4a4`, including the later
+titlebar change, succeeded at
+`/private/tmp/harness-native-benchmark-v99tt1m2/desktop/build/macos/Build/Products/Release/Harness Benchmark.app`.
+All 229 production Dart/Swift sources compared with the fixture copy match
+(excluding the deliberately instrumented `MainFlutterWindow.swift`); the nine
+Python isolation checks pass. Receipt:
+`/private/tmp/harness-native-approved-prepare.log`; full build output is in that
+fixture's `build.log`.
+
+The approved attempt then encountered a locked desktop. App control returned
+`cgWindowNotFound` for the exact workspace preview, Activity Monitor, and Finder
+interaction; a read-only `ioreg` check reported
+`CGSSessionScreenIsLocked = Yes`. The workspace and installed Harness processes
+were left running, and the benchmark was not launched. No timing samples or
+percentiles were collected. The user then explicitly deferred benchmarking and
+performance optimization to focus on feature work. Do not resume just because
+the desktop becomes available. The quit/reopen authorization is recorded for
+when this work is back in scope. This confirms the cause of
+this attempt's unavailable desktop, not the cause of every earlier calibration
+failure.
+
### History focus hot path
History now formats only agents with open views. Previously each focus change
diff --git a/docs/harness-v2-progress.md b/docs/harness-v2-progress.md
index 43ed44293..046c978b7 100644
--- a/docs/harness-v2-progress.md
+++ b/docs/harness-v2-progress.md
@@ -6,6 +6,35 @@ Updated 2026-09-14 after integrating the continuation into main. This is a worki
## Continue directly on main
+- Added **Retry** to failed New agent availability checks. The same form keeps
+ the folder, explicit agent and permission choices while rechecking; recovered
+ Codex profile support loads in place. Late replies for a previous machine
+ cannot replace the current choices. The two new regressions and surrounding
+ first-use/Add/profile checks pass (47 tests); analysis has zero errors/warnings
+ and 14 existing infos. Minimum-window renders with normal/2× text were checked.
+ Logs: `/private/tmp/harness-agent-check-retry-{verified,analyze,render}.log`.
+ Preserved the team's `5f279e1` pane-menu Delete action by fast-forwarding main.
+ The combined suite passes **1,311 tests**, one existing skip, with no analyzer
+ errors/warnings. A separate arm64 Release output succeeds; the running preview
+ was not replaced or restarted. Logs:
+ `/private/tmp/harness-agent-check-retry-{full-tests,integrated-analyze,release}.log`.
+ Main then fast-forwarded through the team's independent changes at `87f8fcd`.
+ Those files do not overlap this Retry change; the recorded full-suite and
+ Release results remain measurements of the preceding `5f279e1` base.
+- The user raised accumulating live sessions after closing panes. Saved an
+ [Archive/Resume lifecycle proposal](harness-agent-lifecycle.md) for discussion.
+ It has not been implemented; no existing user agents were stopped or removed.
+- The user approved the native run and brief workspace-preview quit/reopen.
+ Rebuilt the isolated arm64 Release fixture from `a6fe4a4`, including the later
+ titlebar change, at `/private/tmp/harness-native-benchmark-v99tt1m2`.
+ The 229 compared production Dart/Swift sources match the copy; all nine
+ isolation tests pass. App control cannot access windows while this Mac is
+ locked, confirmed by the read-only console lock flag. Both Harness processes
+ remain running; no benchmark was launched and no samples were collected.
+ The user then explicitly deferred benchmarking/performance optimization and
+ asked for feature work. Keep measurement deferred; do not request another
+ desktop/preview interruption while that priority stands.
+ Build receipt: `/private/tmp/harness-native-approved-prepare.log`.
- Preserved the team's native Settings-button removal (`51c0d27`) in merge
`3a7fe57`, then its independent device updates through `22653fe` in `51f62e7`.
The combined desktop passes **1,309 tests**, one existing skip, 51 native