Skip to content

feat(agent-config): agent config state and the editing workspace [10/21] - #331

Merged
gusfcarvalho merged 4 commits into
agent-config/09-config-apifrom
agent-config/10-workspace
Oct 6, 2026
Merged

gusfcarvalho merged 4 commits into
agent-config/09-config-apifrom
agent-config/10-workspace

Conversation

@gusfcarvalho

@gusfcarvalho gusfcarvalho commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Part 10 of 21 of the stacked split of #318 (agent remote configuration). Every layer adds the final version of its files from #318, and only imports from layers below it, so each layer passes make reviewable on its own. Nothing is reachable in the app until layer 20 wires the Configuration tab in.

What

useAgentConfig (effective config, instances, permissions) and useConfigWorkspace, the editing workspace that ties draft, preview, validation and save together. Adds the component test helpers used by the UI layers above.

Tests

useAgentConfig.spec.ts; the workspace is exercised by the component and integration specs in later layers.

Size exception

This PR is over the 1k-line limit (about 1,220 lines, package-lock excluded) and carries the size-exception label. Review of the stack added two fixes that belong to the workspace this layer introduces, each with its regression spec: edits wait for every instance's file (failed loads tracked for a retry), and the paginated instance list (api#476/#483) is loaded through the page helper, with fleet-wide counts and edits blocked when the list is cut at the page cap. Moving the specs up would test this layer's behaviour from a layer that doesn't own it.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 5, 2026 10:52
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 7c3fae0d-c5cc-496a-b96a-563c532d0267
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Agent switching can reuse cached revisions and preview results from the previously selected agent.

Review effort: Balanced
Findings: 2 High severity

Open (2)
What changed in this PR

Adds agent-configuration state management and an editing workspace for the future Configuration tab.

Changes:

  • Adds configuration, instance, permission, and selection state.
  • Adds draft, preview, validation, access-control, save, and discard orchestration.
  • Adds state tests and reusable component-test helpers.
File Description
useConfigWorkspace.ts Provides the shared editing workspace.
useAgentConfig.ts Manages configuration and instance state.
useAgentConfig.spec.ts Tests permissions, races, fallbacks, and unsupported APIs.
helpers.ts Adds configuration component-test utilities.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +47 to +48
const revisionCache = new Map<number, AgentConfigRevision>();
const detailCache = new Map<string, AgentInstanceDetail>();
!clientBlocked.value &&
!detailsLoading.value,
);
const preview = usePreview(agentIdRef, draft.overlay, api, canPreview);
@gusfcarvalho
gusfcarvalho force-pushed the agent-config/10-workspace branch from b1c6fb7 to 8d214a0 Compare October 5, 2026 16:32
@ccf-lisa
ccf-lisa Bot force-pushed the agent-config/10-workspace branch from 8d214a0 to 3288c54 Compare October 6, 2026 09:40
@ccf-lisa
ccf-lisa Bot force-pushed the agent-config/10-workspace branch from 3288c54 to 3503c35 Compare October 6, 2026 11:38
@gusfcarvalho gusfcarvalho added the size-exception PR intentionally exceeds the 1k-line size limit; reasoning in the description label Oct 6, 2026
ianmiell
ianmiell previously approved these changes Oct 6, 2026

@ianmiell ianmiell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ccf-review: APPROVE

no findings.

Stack (gh stack 343): #322 → #323 → #324 → #325 → #326 → #327 → #328 → #329 → #330 → #331 → #332 → #333 → #334 → #335 → #336 → #337 → #338 → #339 → #340 → #341 → #342

gusfcarvalho and others added 4 commits October 6, 2026 11:24
Layer 10 of 21 in the stacked split of #318.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The draft decides null-vs-omit and "back to the file value" against
every known base. Editing was enabled before the background detail load
finished, and a failed detail load was skipped silently, so an edit
could drop an overlay entry another host's file still needs.

- canEditPointer is false while a reporting instance's detail is
  missing; basesBlockedReason says why (loading, or which hosts failed)
- failedBaseIds names the instances the last loadDetails could not
  load; loadDetails is the retry
- a single-instance agent's only file is the selected instance's, so it
  never waits on the background load (and makes no extra request)
- the workspaceHost test harness loads every detail, as the tab does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lock edits on a partial fleet

- useAgentConfig loads instances with listAllInstances; it exposes
  instancesPartial and instanceTotal (meta.counts.total), and the sync
  summary takes the API's fleet-wide counts
- past the page cap, base-dependent edits are blocked through the
  existing gate (basesBlockedReason names the cap): field access and the
  draft would otherwise be computed over part of the fleet
- a single-instance agent still makes one list request and never waits

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
helpers.ts pagedListInstances(items) answers listInstances as the
paginated API does (25 a page, page fields, counts over every item);
fakeApi uses it for the fixture fleet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ccf-lisa
ccf-lisa Bot force-pushed the agent-config/10-workspace branch from 38a5b56 to 4a214ea Compare October 6, 2026 14:38
@gusfcarvalho
gusfcarvalho merged commit 9bc611c into main Oct 6, 2026
7 checks passed
@gusfcarvalho
gusfcarvalho deleted the agent-config/10-workspace branch October 6, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-exception PR intentionally exceeds the 1k-line size limit; reasoning in the description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants