Skip to content

Replace routine-panel target inference with an explicit definition picker (CL-7355) - #554

Open
TheGreatAxios wants to merge 6 commits into
cl-7353-retarget-authzfrom
cl-7355-target-picker
Open

Replace routine-panel target inference with an explicit definition picker (CL-7355)#554
TheGreatAxios wants to merge 6 commits into
cl-7353-retarget-authzfrom
cl-7355-target-picker

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Closes https://linear.app/abklabs/issue/CL-7355

Summary

  • Removes resolveCreateTarget and its listWorkbenchAgents/ensureMyraWorkbench-for-target inference from apps/web/src/shell/routine-panel.tsx — a routine's create target is no longer derived from the conversation's own agent.
  • Adds DefinitionTargetPicker (apps/web/src/shell/definition-target-picker.tsx): loads listAllRoutineTargets, groups by kind (Agents / Workflows), never auto-selects, and covers loading/empty/error/stale-selection states.
  • Create now requires a picked target (definitionAssetId) before the first write can fire; delivery workbench resolution (subject.workbenchId or the tenant's default Myra workbench) is unchanged and independent of the target.
  • Existing-routine mode shows the current target's name read-only (editing is CL-7358).
  • Removed the "This conversation has no agent to run this routine yet" guard.

Test plan

  • bunx tsc --noEmit -p apps/web
  • bun test ./test/routine-panel.test.tsx (run from apps/web) — 21/21 pass, including no-inference and picked-target-create coverage
  • bun test ./test/routine-activity.test.ts ./test/routine-detail-page.test.tsx ./test/routine-schedule.test.ts ./test/routines-page.test.tsx — 75/75 pass
  • bunx eslint apps/web/src/shell
  • bun run scripts/checks/report-error.ts — 0 new findings

Resolves CL-7355

@TheGreatAxios
TheGreatAxios changed the base branch from cl-7351-target-discovery to cl-7353-retarget-authz September 2, 2026 06:25
A create or PATCH-carried retarget now must clear the same two gates
before it is persisted: resolveLaunchableDefinition must resolve the
asset, and the acting principal must be authorized for
workflow-definition:<id>/read — the same verb listRoutineTargets
already checks per row. A denial is a typed 403 alongside the
existing 400/404/409 target envelopes, on both the tenant-session and
Myra's workflow-run-authenticated routine surfaces.

Also routes a pre-existing catch in postRoutineEnabledNotice through
reportError, since this change's diff now touches that line and
check:report-error requires it.
Replaces the old chat-participant-inference tests with coverage that no
target is ever inferred from a workbench's agents, that create sends the
explicitly picked definitionAssetId, and that the picker's loading/empty/
error/stale states hold.
…cker (CL-7355)

The routine panel used to derive a create target from the conversation's
own agent (listWorkbenchAgents(...)[0]) — silently wrong the moment a
workbench hosted more than one agent, or none, and it could never target
a workflow. DefinitionTargetPicker instead lists every deployed, frozen
target from GET /api/tenants/:tenantId/workflows/targets, grouped by kind
(Agents / Workflows), and never auto-selects one. Create now requires a
picked target; delivery (which workbench the routine posts back into)
stays independent, unchanged from before. Existing-routine mode shows the
current target's name read-only — editing it is CL-7358.
@TheGreatAxios
TheGreatAxios marked this pull request as ready for review September 2, 2026 11:18
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