Skip to content

refactor(desktop): definition-edit routes through AgentDialog — single dialog entry point (Phase 1B.3c)#1643

Merged
wesbillman merged 2 commits into
mainfrom
feat/agent-profile-cutover
Jul 8, 2026
Merged

refactor(desktop): definition-edit routes through AgentDialog — single dialog entry point (Phase 1B.3c)#1643
wesbillman merged 2 commits into
mainfrom
feat/agent-profile-cutover

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

What (Phase 1B.3c — profile cutover)

AgentDialog gains a third union arm, definition-edit — a pass-through to AgentDefinitionDialog driven by the caller's PersonaDialogState (edit / duplicate / import flows). The two remaining direct AgentDefinitionDialog mounts re-point through it:

  • UserProfilePersonaDialogs (profile panel)
  • AgentsView (edit/dup/import mount)

After this, AgentDialog is the single dialog entry point for every intent — create-definition(±start), create-instance, edit-instance, edit-definition — and AgentDefinitionDialog is internal to the dialog family. Nothing is deleted: PersonaDialog died in B3a (#1627), EditAgentDialog in B3b (#1639); B3c collapses the last two out-of-family mounts.

Pins (pre-agreed in-channel)

  1. Cascade untouchedsubmitProfilePersonaDialog (persona→linked-agent cascade, validateLinkedAgentRuntimeEdit, toasts) zero-diff; profile keeps ownership of its personaDialogState, only the mount re-points.
  2. Existing arms byte-identical — create + instance-edit routing untouched; union extension only.
  3. Zero spec editsdesktop/tests/e2e/ diff is 0 lines; AgentDefinitionDialog body untouched, all testids stay put.
  4. Exclusivity comment in AgentsView reworded only where it named the old direct mount.

Test-loader fix (isolated in its own commit for review)

Writing the routing test surfaced a latent bug in test-loader-hooks.mjs: resolveSourcePath early-returns when path.extname() is truthy, so dotted basenames (ProfileAvatarEditor.utils.utils.ts on disk) never resolved — the entire dialog component tree was unimportable from unit tests. Fixed by deciding on file existence, with fallback to node's default resolution so genuinely-extensioned specifiers (.mjs, .json, explicit .ts) resolve exactly as before. Reviewer ruling (Pinky): keep in this PR — the routing test cannot pass without it.

New test

agentDialogRouting.test.mjs (3 tests): definition-edit exact prop pass-through (mode discriminant stripped), instance-edit contract props, create modes route through the internal router.

Validation

  • tsc clean, biome clean
  • Unit: 2082/2082 pass (full suite through the patched loader — the loader-regression gate)
  • Scoped e2e, zero spec edits: edit-agent + agents + persona-env-vars + persona-sync + human-edit-agent-content → 9/9; full agent/persona smoke slice → 59/59

wesbillman and others added 2 commits July 8, 2026 10:16
resolveSourcePath treated any dotted basename as already-extensioned
(path.extname('.../ProfileAvatarEditor.utils') is '.utils'), handing
node an unresolvable path. Any test importing the dialog component tree
died on AgentCreationPreview -> ProfileAvatarEditor.utils. Decide by
file existence instead, falling back to default resolution so
genuinely-extensioned specifiers (.mjs/.json/explicit .ts) resolve
exactly as before.

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

AgentDialog gains a definition-edit union arm — a pass-through to
AgentDefinitionDialog driven by the caller's PersonaDialogState (edit/
duplicate/import). The two remaining direct AgentDefinitionDialog mounts
re-point through it (UserProfilePersonaDialogs, AgentsView), making
AgentDialog the single dialog entry point for every intent:
create-definition(+/-start), create-instance, edit-instance,
edit-definition. AgentDefinitionDialog is now internal to the dialog
family. New routing pinning test covers exact prop pass-through per arm.

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

Copy link
Copy Markdown
Collaborator Author

Review — APPROVE (via comment; formal approve blocked, same authed account)

Reviewed per the five pins agreed in-channel, plus the loader carve-in conditions.

Loader commit 3cb0039fe (read in isolation): correct. resolveSourcePath now decides by existsSync + isFile instead of path.extname, so dotted basenames (ProfileAvatarEditor.utils.utils.ts) resolve. Null return + fallback to default resolution at both call sites means genuinely-extensioned specifiers that resolved before resolve identically; a missing file now fails through node's default resolver instead of a fabricated .ts path — same outcome, clearer error. The parentURL?.startsWith("file:") tightening is a strict improvement.

Pin 1 (cascade zero-diff): UserProfilePanel.tsx / UserProfilePanelPersonaSubmit.ts absent from the diff entirely. ✓
Pin 2 (existing arms byte-identical): only changes in AgentDialog are the new union member, the definition-edit branch, and the doc comment; instance-edit and create routing untouched. ✓
Pin 3 (zero spec edits): desktop/tests/e2e/ diff = 0 lines; AgentDefinitionDialog body untouched. ✓
Pin 4 (comments): AgentsView exclusivity comment reworded, not retired — correct, since two separate AgentDialog mounts still need the insurance. ✓
Pin 5 (budget): 5 files, +147/−19, loader fix isolated in its own commit as required. ✓

Routing test: hook-free plain-function-call inspection is a clean pattern; the exact-pass-through + discriminant-stripped assertions pin the contract, and the test itself is a living witness for the loader fix (cannot pass on an unpatched loader).

Manual verification (fresh detached checkout of 0a18df913):

  • Scoped e2e: edit-agent + agents + persona-env-vars + persona-sync + human-edit-agent-content = 26/26 passed (33.3s)
  • Full unit suite through the patched loader: 2082/2082 pass, 0 fail

Matches the builder's reported results independently. LGTM — queues at Wes's gate once CI settles.

@wesbillman wesbillman merged commit aa17294 into main Jul 8, 2026
25 checks passed
@wesbillman wesbillman deleted the feat/agent-profile-cutover branch July 8, 2026 16:28
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