CRITICAL-1 (definition-only behavior invisible / silent access broadening):
- Render D-owned access/allowlist/parallelism in definition-only context via
AgentEditMergedDialogDSection (showInstancePresent prop controls visibility)
- Preserve nullable respondTo/parallelism — no coercion to defaults on open;
seed preserves null for unset definitions (owner-only by backend default)
- Include D-parallelism in emitAgentFormDiff dChanged detection
- emitAgentFormDiff behavior block emits respondTo/parallelism when D-owned
- agentAccessOwnerOnly query enabled for definition-only context
CRITICAL-2 (D/I runtime layers entangled):
- Split shared model/provider state into independent dModel/dProvider (D-owned)
and iModel/iProvider (I-owned) state pairs
- Extract useAgentEditRuntimeHandlers: applyDSelection writes D state/envVars;
applyISelection writes I state/instanceEnvVars — no cross-layer mutation
- handleRuntimeDropdownChange uses applyISelection (I-only); handleDefinitionRuntimeChange
uses applyDSelection (D-only)
- handleProviderDropdownChange and handleModelDropdownChange route to D or I
apply function based on context
- Remove defReadOnly from I-owned access field in AgentEditMergedDialogInstanceSection
(team-linked live access is I-editable per row 9)
- Track auto-seeded D runtime via autoSeededDefinitionRuntimeRef; no-op saves
do not persist the app default as a definition runtime change
- useAgentEditRuntimeState.ts: pass def prop; blankRuntimeModelProviderEditable
restores AgentDefinitionDialog's runtime-less provider edit capability (87dc4dccba)
CRITICAL-3 (settlement false-success/false-failure):
- agentSaveCoordinator: refetch on every command boundary regardless of throw;
observed persistence decides step failure, not the command result
- observedStateMatchesPersonaInput: runtime uses full-write semantics
(submitted.runtime ?? null vs observed.runtime ?? null — clear = null)
- observedStateMatchesAgentInput: harness unpin settles against
agentCommandOverride === null, not effective command vs sentinel
IMPORTANT-1 (test-11 provider gate):
- Restore blankRuntimeModelProviderEditable in useAgentEditRuntimeState
- test-11 restored to provider-visible-save-enabled contract (87dc4dccba)
IMPORTANT-2 (R6 route-level behavioral evidence):
- agentSaveCoordinator.test.mjs: two R6 route-level tests exercise the
full pipeline (seedAgentFormModel → emitAgentFormDiff → runAgentSaveCoordinator)
for a definition-only respondTo override
MINOR fold-ins:
- sourceTeam resolved to display name via useTeamsQuery
- identity-archived flair shown for any archived agent (not gated by showDef)
File-size gate: AgentEditMergedDialog.tsx extracted handlers to
useAgentEditRuntimeHandlers.ts; dialog now 962 lines (gate: 963 < 1000)
Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>