Skip to content

Edit stages in the Designer: Properties, agent list, add, rename and delete - #99

Draft
knihit wants to merge 8 commits into
wc/07a-edit-corefrom
wc/07b-properties
Draft

knihit wants to merge 8 commits into
wc/07a-edit-corefrom
wc/07b-properties

Conversation

@knihit

@knihit knihit commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Layer 2 of 4 of the editing work in the Designer. It adds the part you see and use: pick an agent, rename a stage, add one, delete one. Nothing is written to the file yet; the draft lives in the page.

Designer (workflow-canvas/src/designer/):

  • Properties (right of the graph): the selected stage (the first one when the page opens), with a Required card that holds name (a text field) and agent (a list of the agents Konductor ships, each with a line on what it is for), a Complete, Has a note or Needs a fix mark, and Delete stage. A file that names an agent not on the list keeps it, shown first.
  • Add stage adds agent-N (the first free N) with agent k-developer at the end, selects it and moves focus to its name. It is off at 40 stages, with the reason.
  • A stage is selected by a click or by Enter or Space on its node; the intent and the end are not selectable. The name of the selected node ends with "selected" for a screen reader, and its outline is thicker.
  • Read-only workflow: the name is read-only and Add stage, Delete stage and the agent list are off, with the reason.
  • The draft lives in App (useEditor), so it survives a switch of tab. The Execution tab draws the workflow as loaded and shows an info note when the Designer holds changes that are not saved.

Canvas and graph:

  • WorkflowCanvas takes an optional selection; without it the canvas is read-only as before. FitWhenGrown fits the graph again when a stage is added or deleted.
  • The graph names a node by the id of its stage, so two stages that share a name for a moment still have two nodes.

Tests and docs: unit tests for the selection, the graph by stage id, the agent list (and api/agents.test.ts, which checks it against agents/), and the Designer through App (Properties, select by click and Enter, rename, agent list, add, delete, limits, the draft kept across tabs, read-only). Existing e2e expectations changed on purpose: the first stage's node name now ends with "selected" and the node description no longer says "Read-only". README.md has the Designer tab section.

How to review

  • Review the diff against Add the editing core of the Designer: draft, stage text, findings and editor state #98, the layer below (the GitHub diff of this PR is already against it).
  • Start with PropertiesPane.tsx and DesignerEditor.tsx, then use-editor.ts, then the canvas selection (WorkflowCanvas.tsx, selection.ts), then the graph change.
  • Run it: cd workflow-canvas && npm ci && npm run dev:stub, open the address it prints, and edit a stage. Saving is not there yet, so a reload gives the file back.

What the next layer adds

PR #100: Save, the check while typing, the 409 conflict flow with Load the file again, the 422 findings, the lost-answer rule, the save line and alerts, and the API client calls.

Fixes from the hands-on QA run

  • No warning before unsaved edits were thrown away. While the draft differs from the file, a beforeunload handler (useLeaveGuard) makes the browser ask before the page is closed or reloaded. It is off when the draft equals the file, also after a change is put back.
  • Tests: unit tests of the hook; end-to-end e2e/tests/leave-page.spec.ts (asks with unsaved changes and the page stays; no question with no change or with the change put back). The first failed before the change.

Type of Change

  • Other: editing on the Designer tab of the workflow canvas, in workflow-canvas/

Testing

  • Root npm test (tests/scripts/**/*.test.js): not applicable; this PR changes only workflow-canvas/.
  • If cli/ changed: not applicable, cli/ is untouched
  • Smoke tested affected agent(s): not applicable, no agent changed
  • If an agent's or skill's behavior changed: not applicable, none changed
  • New or changed code files carry the required SPDX header (see AGENTS.md's License headers rule); formats without comment syntax (e.g. JSON) are exempt

Checked in workflow-canvas/ on this head: npm run lint, npm run typecheck (3 projects), npm test (74 files, 1266 tests), npm run test:stub (20 files, 354 tests), npm run api:lint, npm run build and npm run test:e2e (78 tests) all pass. npm run screenshots was run and its files are committed; a second run gives the same files.

Screenshots

Designer tab, full page, 1280x800 (regenerated by npm run screenshots; the links are pinned to the head commit of this PR):

Opens with a stage selected Agent changed and a stage renamed
Designer tab on open Designer tab with edits in the draft
Opens, dark theme Edits, dark theme
Designer tab on open, dark theme Designer tab with edits, dark theme

Checklist

  • My code follows the style guidelines of this project (see AGENTS.md's Code Style & Conventions)
  • I have performed a self-review of my own changes
  • I have commented my code where necessary
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings - build is clean
  • I have added or updated tests that prove my change works (see Testing above for the exact commands)

Notes for Reviewers

Fixes from the second adversarial review

  • Enter or Space on the stage that is already selected moves focus to its name; Escape on a node keeps focus. The tests fail without the fix.
  • The Complete / Needs a fix mark shows only for a draft a check has answered for, and a component test feeds a check result.
  • A polite live region says what was added, deleted or selected; a read-only workflow gets a note that says why; an agent named by the saved file stays on offer; two stages with one name say their place in the list to a screen reader.
  • Tests of disabled buttons now read the reason. The agents test skips without the repository.
  • Rebased onto the new wc/07a-edit-core. The e2e for add, delete and keyboard selection are in Test editing in the Designer end to end and add the changelog entry #97.

Fixes from the third adversarial review

  • The read-only note spans both columns of the Designer grid, so the graph keeps the wide column (before, the note took the first cell and pushed the graph into the narrow one). A browser test measures it with the workflow set to read-only.
  • An add names the new stage ("Stage agent-2 added and selected."), and every announcement is a new element, so a repeated one is read again.
  • Escape is kept from React Flow only on a canvas that can select; the read-only canvas of the Execution tab keeps its default.
  • Browser tests for Enter and Space on the already selected stage, and for Escape on a node.
  • Rebased onto the new wc/07a-edit-core.
  • Rejected: passing only a stage's own saved agent to its list (draft ids no longer map to saved stages after a save; harmless); moving the visually-hidden style out of the Execution folder (it lives in the layer below); the "press Enter" wording of the edge labels (edges cannot be focused).

Fixes from the second hands-on QA run

  • A pasted launch address that would drop unsaved changes, or stop following a run, first asks to confirm. Cancel keeps the page as it is; the address can be pasted again (swap-guard.ts; unit tests, App tests for what is at risk, e2e for cancel and accept).
  • After Add stage the generated name is selected, so typing replaces it (unit and e2e tests).
  • The names in a field error are shown as code, without backticks.
  • Rejected: Delete or Backspace on a focused node to delete the stage. There is no undo and no confirmation for a delete, a node is easy to hit by accident, and Delete stage is already reachable by Tab.

Round 6

Rebased on #98 (the session guard and the page policy). No change of its own.

Round 9: rebased on #98. No change of its own. npm test (1360 tests), lint and typecheck pass.

@knihit
knihit added this pull request to stack #101 October 27, 2026 02:47
@knihit
knihit removed this pull request from stack #101 October 27, 2026 02:48
@knihit
knihit added this pull request to stack #102 October 27, 2026 02:48
@knihit
knihit force-pushed the wc/07b-properties branch from faeed54 to fbc3a8c Compare October 27, 2026 15:14
@knihit
knihit force-pushed the wc/07b-properties branch 4 times, most recently from d75da34 to 80e17eb Compare October 27, 2026 21:08
@knihit
knihit force-pushed the wc/07b-properties branch 2 times, most recently from 3a5e71b to e0b27a6 Compare October 27, 2026 22:06
@knihit
knihit force-pushed the wc/07b-properties branch from e0b27a6 to 40e1d5a Compare October 27, 2026 22:23
@knihit
knihit removed this pull request from stack #102 October 27, 2026 22:40
@knihit
knihit added this pull request to stack #117 October 27, 2026 22:42
@knihit
knihit force-pushed the wc/07b-properties branch from 40e1d5a to 09159d3 Compare October 27, 2026 23:15
@knihit
knihit force-pushed the wc/07b-properties branch 2 times, most recently from 5d23e39 to d67c5e6 Compare October 28, 2026 14:31
@knihit
knihit force-pushed the wc/07b-properties branch from d67c5e6 to 11b1405 Compare October 28, 2026 14:54
@knihit
knihit force-pushed the wc/07b-properties branch from 11b1405 to ec43f3a Compare October 28, 2026 15:39
…, add, rename, delete

The Designer tab gets Properties for the selected stage, with a name field,
a list of the agents Konductor ships, and Delete stage. Add stage adds the
next agent-N. A stage is chosen by a click, or by Enter or Space on its node,
and focus moves to its name. The draft is kept in App, so it survives a
switch of tab, and the Execution tab says when it holds changes that are not
saved. Nothing is written to the file yet.

The graph names a node by the id of its stage, so two stages that share a
name for a moment still have two nodes, and the canvas fits the graph again
when a stage is added or deleted.
…aved

The draft lives in the page only, so a reload or a closed tab threw it away
without a word. While the draft differs from the saved file, a beforeunload
handler now makes the browser ask whether to leave.
…r when read-only

- Enter or Space on the stage that is already selected moves focus to its
  name, and Escape on a node no longer throws focus away.
- The Complete and Needs a fix mark shows only for a draft that a check has
  answered for; before that it says nothing.
- A polite live region says that a stage was added, deleted or selected.
- A read-only workflow gets a note that says why, and the card header no
  longer asks to select a stage to edit it.
- An agent that the saved file names stays on offer after another is chosen.
- Two stages with one name say their place in the list to a screen reader.
- The name box turns off spell check and autocomplete; the strong text is a
  Cloudscape strong; the agents test skips without the repository.
The note above the graph spans both columns of the Designer grid, so the
graph keeps the wide column. An add names the new stage, and each
announcement is a new element, so a repeat is read again. Escape is kept from
React Flow only on a canvas that can select. Browser tests cover the note's
layout and Enter, Space and Escape on the selected stage.
Focus went to the name, but the text stayed unselected, so typing was added to
agent-1. The name is now selected.
…d run

Pasting another launch address replaced the workflow and dropped the draft
without a word. The page now asks first. Cancel keeps the page as it is; the
address can be pasted again. The question also names a run being followed,
which is let go when another workflow opens.
@knihit
knihit force-pushed the wc/07b-properties branch from ae371e9 to af55544 Compare October 29, 2026 02:51

This branch has not been deployed

No deployments
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