Skip to content

refactor(desktop): re-host instance edit as AgentInstanceEditDialog behind AgentDialog (Phase 1B.3b)#1639

Merged
wesbillman merged 1 commit into
mainfrom
feat/agent-edit-rehost
Jul 8, 2026
Merged

refactor(desktop): re-host instance edit as AgentInstanceEditDialog behind AgentDialog (Phase 1B.3b)#1639
wesbillman merged 1 commit into
mainfrom
feat/agent-edit-rehost

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

Summary

Phase 1B.3b of the unified agent model: the instance-edit dialog re-homes into the unified AgentDialog family. EditAgentDialog.tsx becomes AgentInstanceEditDialog.tsx (git mv — the 954-line body is unchanged except the function name), and AgentDialog gains an instance-edit mode, making it the single entry point for all four agent intents: create definition, create definition + start, create standalone instance, and now edit instance.

What changed

  • AgentDialog.tsx — props become a discriminated union (AgentDialogCreateProps | AgentDialogInstanceEditProps). instance-edit renders AgentInstanceEditDialog as a pass-through; the create paths are byte-identical, relocated into an internal AgentCreateDialogRouter so hooks stay unconditional. Create callers use the new exported AgentDialogCreateMode type.
  • UserProfilePanel.tsx — the single mount swaps <EditAgentDialog …> for <AgentDialog mode="instance-edit" …>. The persistent mount, editAgentOpen state, and the requestOpenEditAgent nudge-event subscription (the only route that opens this dialog) are untouched.
  • AgentsView.tsx — create-state type narrows to AgentDialogCreateMode (type-only ripple).
  • agentInstanceEditPinning.test.mjs (new) — pins the inherit-toggle → credential-gate → submit seam chain through the pure modules exactly as the component wires them: prospective-runtime resolution from the linked persona (not the stale pin), gate validating the same submission snapshot submit persists (both directions: clears with the persona credential, blocks without it), command-clear sentinel + harnessOverride derivation, and the steady-state-inherit authoritative-edits contract.
  • Comment-only renames in CreateAgentDialog.tsx, personaProviderModelFields.tsx, editAgentProviderDiscovery.test.mjs.

Invariants preserved (review pins)

  • personaRuntimeModel.ts and useRequiredCredentialState.ts: zero diff.
  • The [open, agent.pubkey] reset lifecycle travels inside the moved body untouched — no effect surgery.
  • All testids move with the body; edit-agent.spec.ts passes unmodified (zero e2e spec edits — the suite added in test(desktop): add edit-agent dialog e2e coverage (Phase 1B.3b-pre) #1628 is the acceptance gate for this move).

Testing

  • tsc --noEmit clean; biome clean.
  • Full desktop unit suite: 2067/2067 pass (incl. the 5 new pinning tests).
  • playwright --project=smoke edit-agent.spec.ts: 3/3 pass, spec unmodified.
  • Scoped smoke slice -g "agent|persona": 59/59 pass.

Part of the Phase 1B UI unification (#1624#1626#1627 → this). Next: B3c profile-panel cutover deletes the remaining legacy dialog paths.

…ehind AgentDialog (Phase 1B.3b)

Move EditAgentDialog.tsx to AgentInstanceEditDialog.tsx (git mv, body
unchanged) and route it through the unified AgentDialog entry point as a
new "instance-edit" mode, so all four agent intents (create definition,
create+start, create instance, edit instance) share one dialog surface.

- AgentDialog props become a discriminated union; the create paths are
  untouched and now live in an internal AgentCreateDialogRouter. The
  exported mode type for create callers is AgentDialogCreateMode.
- UserProfilePanel keeps its persistent mount, editAgentOpen state, and
  the requestOpenEditAgent nudge-event subscription unchanged; only the
  mounted component name changes.
- Pure modules (personaRuntimeModel.ts, useRequiredCredentialState.ts)
  are zero-diff; the [open, agent.pubkey] reset lifecycle travels inside
  the moved body untouched.
- New agentInstanceEditPinning.test.mjs pins the inherit-toggle -> gate
  -> submit seam chain through the pure modules as the component wires
  them, plus the steady-state-inherit authoritative-edits contract.
- All testids move with the body; edit-agent.spec.ts passes unmodified
  (zero e2e spec edits).

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
@wesbillman

Copy link
Copy Markdown
Collaborator Author

Review (Pinky, per agreed posture) — GitHub approve blocked (same authed account as author), so recording the verdict here.

Mechanical half — all five pins verified:

  1. Pure modules: personaRuntimeModel.ts + useRequiredCredentialState.ts zero-diff ✅
  2. Persistent mount + editAgentOpen toggle: import swap only; [open, agent.pubkey] reset effect travels inside the moved body intact ✅
  3. Nudge contract: consumePendingOpenEditAgent/subscribeOpenEditAgent untouched ✅
  4. Frozen selectors: 99%-similarity rename, testids 9↔9, desktop/tests/e2e/ diff = 0 lines, playwright.config untouched ✅
  5. Pinning test: 5 tests chain inherit-toggle → gate → submit through the real pure-module exports ✅

Manual half: fresh checkout of 61efb08, edit-agent.spec.ts run unmodified → 3/3 passed (zero-spec-edits acceptance gate met).

Union shape note: TS now enforces open on edit mode only; create paths byte-identical behind AgentCreateDialogRouter — correct shape.

Verdict: APPROVE. Narf!

@wesbillman wesbillman merged commit 8af18ee into main Jul 8, 2026
25 checks passed
@wesbillman wesbillman deleted the feat/agent-edit-rehost branch July 8, 2026 15:46
wpfleger96 added a commit that referenced this pull request Jul 8, 2026
…-size override

runtime.rs: wrap the merged_user_env call introduced in the #1639/1640 rebase
conflict resolution — line exceeded rustfmt's limit.

check-file-sizes.mjs: add override for AgentInstanceEditDialog.tsx (1043 lines).
#1639 renamed EditAgentDialog to AgentInstanceEditDialog; #1448 rebase conflict
resolution threaded initialFocus?/EditAgentFocusTarget through AgentDialog.tsx
into AgentInstanceEditDialog.tsx, adding ~7 lines of feature plumbing.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
wpfleger96 added a commit that referenced this pull request Jul 8, 2026
…-size override

runtime.rs: wrap the merged_user_env call introduced in the #1639/1640 rebase
conflict resolution — line exceeded rustfmt's limit.

check-file-sizes.mjs: add override for AgentInstanceEditDialog.tsx (1043 lines).
#1639 renamed EditAgentDialog to AgentInstanceEditDialog; #1448 rebase conflict
resolution threaded initialFocus?/EditAgentFocusTarget through AgentDialog.tsx
into AgentInstanceEditDialog.tsx, adding ~7 lines of feature plumbing.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
wpfleger96 added a commit that referenced this pull request Jul 8, 2026
…-size override

runtime.rs: wrap the merged_user_env call introduced in the #1639/1640 rebase
conflict resolution — line exceeded rustfmt's limit.

check-file-sizes.mjs: add override for AgentInstanceEditDialog.tsx (1043 lines).
#1639 renamed EditAgentDialog to AgentInstanceEditDialog; #1448 rebase conflict
resolution threaded initialFocus?/EditAgentFocusTarget through AgentDialog.tsx
into AgentInstanceEditDialog.tsx, adding ~7 lines of feature plumbing.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
wpfleger96 added a commit that referenced this pull request Jul 8, 2026
…-size override

runtime.rs: wrap the merged_user_env call introduced in the #1639/1640 rebase
conflict resolution — line exceeded rustfmt's limit.

check-file-sizes.mjs: add override for AgentInstanceEditDialog.tsx (1043 lines).
#1639 renamed EditAgentDialog to AgentInstanceEditDialog; #1448 rebase conflict
resolution threaded initialFocus?/EditAgentFocusTarget through AgentDialog.tsx
into AgentInstanceEditDialog.tsx, adding ~7 lines of feature plumbing.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
wpfleger96 added a commit that referenced this pull request Jul 8, 2026
…-size override

runtime.rs: wrap the merged_user_env call introduced in the #1639/1640 rebase
conflict resolution — line exceeded rustfmt's limit.

check-file-sizes.mjs: add override for AgentInstanceEditDialog.tsx (1043 lines).
#1639 renamed EditAgentDialog to AgentInstanceEditDialog; #1448 rebase conflict
resolution threaded initialFocus?/EditAgentFocusTarget through AgentDialog.tsx
into AgentInstanceEditDialog.tsx, adding ~7 lines of feature plumbing.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
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.

1 participant