Skip to content

feat(agent-crew): add opt-in Explorer auto-open - #146

Merged
omercnet merged 8 commits into
omercnet:mainfrom
tensorcopy:agent-crew-auto-open
Sep 23, 2026
Merged

omercnet merged 8 commits into
omercnet:mainfrom
tensorcopy:agent-crew-auto-open

Conversation

@tensorcopy

@tensorcopy tensorcopy commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds an optional Agent Crew Explorer auto-open preference. It is disabled by default.

When enabled, Agent Crew opens workspaces first observed as new after enablement. Existing workspaces are baselined only for exclusion and are never opened merely because the setting was turned on. Disabling stops queued and future opens; an RPC chunk already in flight is allowed to finish.

How

  • Registers typed host-scoped settings through Paseo's settings API and exposes an Open Agent Crew automatically switch under the plugin settings screen.
  • Acquires the daemon workspace stream through workspaces.list({ subscribe: {} }), ignores its initial subscription snapshot, and releases the owned subscription during cleanup.
  • Builds a complete paged ID baseline solely to suppress later generic upsert events for existing workspaces. Live updates received while the baseline is built are buffered and filtered against it.
  • Claims new workspace IDs through agent-crew.auto-open.claim in schema-aligned batches of at most 1,000 IDs.
  • Uses one serialized client pump, so only one claim job can be in flight.
  • Retries only the failed chunk once while preserving untouched later chunks; successful earlier chunks are never retried.
  • Persists claims atomically in $PASEO_HOME/plugin-data/agent-crew/auto-open.json.
  • Fails closed when persisted claim state is invalid JSON, not an array, or contains any empty/non-string entry.

Verification

  • npm run check
  • npm run typecheck
  • npm test — 30 tests passing

The automated suite covers default-off behavior, existing-workspace exclusion, owned subscription lifecycle, disable/re-enable behavior, serialized in-flight claims, batch boundaries, chunk-specific retries, stale settings reads, claim serialization, persistence, and malformed stored state.

Open the Agent Crew Explorer tab once per workspace without manual action.
The client seeds and subscribes to the workspace directory, claims unseen
workspace IDs through the agent-crew.auto-open.claim RPC, and opens the
crew panel for newly claimed workspaces. Claims persist atomically in
$PASEO_HOME/plugin-data/agent-crew/auto-open.json so a workspace is opened
at most once across daemon restarts, reloads, and reconnects. Failed claim
batches retry once after two seconds.
@tensorcopy

Copy link
Copy Markdown
Contributor Author

Hi @omercnet! Whenever you get a chance, I'd really appreciate a review of this when you have a spare moment. Happy to adjust anything — design, naming, docs — just say the word. Thanks!

@omercnet omercnet changed the title feat(agent-crew): auto-open Explorer tab for new workspaces feat(agent-crew): add opt-in Explorer auto-open Sep 22, 2026
@omercnet

Copy link
Copy Markdown
Owner

Updated in 21c374c.

Auto-open is now an opt-in, host-scoped Agent Crew setting and defaults to off. Enabling seeds existing unclaimed workspaces and watches new ones; disabling stops queued/future chunks while allowing only the already-started claim chunk to finish.

The update also adds complete pagination, a shared 1,000-ID RPC batch limit, chunk-specific one-time retries, stale-settings race protection, atomic claim persistence, and fail-closed validation for corrupt or malformed claim state. Existing README installation, update, usage, development, coverage, dependency, and release notes were preserved.

Verified with npm run check, npm run typecheck, and the full npm test suite (29 passing). I did not run an isolated daemon/UI smoke in this environment.

@omercnet

Copy link
Copy Markdown
Owner

Astra reviewed the implementation specifically for minimality. The settings UI, typed host settings, durable daemon claims, RPC batching, pagination, and registrations are necessary for the requested semantics and match existing plugin conventions.

Applied Astra's actionable reduction in dbc4a10: client/auto-open.ts now uses one serialized claim pump with a deduplicated pending set and per-job retry bit. This removes the prior seen/failure-count/forced-timer state and prevents workspace events received during an RPC from starting a second concurrent flush. Disabling now permits only the already-started claim job to finish.

I retained the small server/store helpers because they are direct test seams for persistence, corruption handling, and serialized claims; moving them into tests would reduce exported symbols but not the total change or runtime complexity.

Reverified: npm run check, npm run typecheck, and full npm test (30 passing).

@omercnet

Copy link
Copy Markdown
Owner

Simplified further in a248b7a after clarifying the intended behavior: auto-open now applies only to workspace events observed while the setting is enabled.

Removed the full workspace listing, pagination, cursor tracking, historical seed batching, and their tests. Enabling the setting no longer opens existing workspaces. Live-event batching, durable once-only claims, serialized retries, and disable/in-flight semantics remain.

Net follow-up: 28 production lines removed. Reverified with npm run check, npm run typecheck, and full npm test (30 passing).

@omercnet

Copy link
Copy Markdown
Owner

Corrected the future-only implementation in 0b0a6c9.

workspaces.subscribe() is only a local event listener and does not own the daemon stream. The plugin now acquires an owned stream with workspaces.list({ subscribe: {} }), ignores its initial subscription snapshot, releases it on cleanup, and builds a complete ID baseline only to exclude existing workspaces from later generic upsert events. Baseline IDs are never claimed or opened.

This keeps the user-visible contract precise: enabling the setting does not open historical workspaces, while genuinely new live workspace IDs are opened once. Full verification remains green: npm run check, npm run typecheck, and npm test (30 passing).

@omercnet
omercnet enabled auto-merge (squash) September 22, 2026 19:56
@omercnet
omercnet merged commit b4e43a0 into omercnet:main Sep 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants