Repository navigation
Conversation
edit_workflow resolved the workflow name but never wrote it into edited.name, so the durable draft kept the base graph's name and a later save_workflow persisted that stale name. Fixes tinyhumansai/openhuman#8453 Co-authored-by: Saim Shafique <128062316+sx4im@users.noreply.github.com>
Tiny Sweeper reviewReviewed head: FindingsNo active actionable findings. Advisory notes
Resolved this pass
Verdict: Ready for maintainer review · Priority: medium Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(copilot): stamp the resolved name into edit_workflow draft graphs. The pull request addresses tinyhumansai/openhuman#8453: `edit_workflow` resolved a workflow name but never wrote it into the edited graph, so the name only travelled alongside the graph into the draft write-back and the proposal; the durable draft kept the base graph's name, and a later `save_workflow` persisted that stale name onto the flow. The change makes the edited graph mutable and stamps the resolved name into `edited.name` after the ops are applied and before structural validation and both write-back paths, and it also changes the fallback used when no `name` argument is supplied to come from the base graph / flow graph rather than the draft or flow record metadata. A new sibling test module covers the explicit-name case, the graph-name fallback, the "Untitled workflow" fallback, edit→save round trips, two edit→save→edit→save staleness chains, and the flow-linked draft next-step hint. On this revision the critique lane's previously reported loss of the draft branch's `edited_from_flow` assignment is reported fixed, with a test covering the next-step hint; one gap remains, reported by the critique lane: a flow-based edit whose flow graph carries no `name` resolves to "Untitled workflow" rather than the flow's real name. The description lane also notes the PR description does not mention the fallback-source change. Review snapshot
Completeness: Complete What changedIn `crates/tinyflows-copilot/src/tools/draft_edit.rs`, the result of `tinyflows::graph_ops::apply_ops` is bound as `let mut edited`, and a new statement sets `edited.name = name.clone()` before structural validation of the result and before the draft write-back and proposal paths, so the resolved name is carried in the graph itself rather than only alongside it. The draft branch keeps `edited_from_flow = draft.flow_id.clone();` but now resolves its default name from `graph.name.clone()` instead of `draft.name`; the flow branch resolves it from `flow.graph.name.clone()` instead of `flow.name`. The same file registers a new `#[cfg(test)]`/`#[path]` module pointing at `draft_edit_tests.rs`. The new `crates/tinyflows-copilot/src/tools/draft_edit_tests.rs` provides graph/args/proposal helpers and regression tests over the in-memory host fake, including one asserting a flow-linked draft edit's `next` hint points at `save_workflow` rather than `create_workflow`. Features
Tests
Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50. Or wait 8 minutes for your next included review. View limit details
Walkthrough
Merge Risk:
|
The draft/flow metadata name can go stale: save_workflow without a name arg advances the flow's graph but not its top-level name, so a later edit resolved the stale record name and (since the #8453 stamp) baked it into the durable graph, clobbering the current name on the next save. Fall back to the base graph's name instead, per the issue's resolution order (name arg, else graph name, else Untitled workflow). Co-authored-by: Saim Shafique <128062316+sx4im@users.noreply.github.com>
| (graph, draft.name) | ||
| // Fall back to the base GRAPH's name — the draft metadata name | ||
| // can go stale and would then be stamped into the graph itself. | ||
| let default_name = graph.name.clone(); |
There was a problem hiding this comment.
Restore edited_from_flow for draft-based edits
The diff removes `edited_from_flow = draft.flow_id.clone();` from the draft branch while leaving the comment that says it exists ("A draft may already be linked to a saved flow — carry that through so the proposal echoes it.") and while the sibling `flow_id` branch still sets `edited_from_flow = Some(flow.id.clone());`. The consequence is reachable on the most common iteration path: call `edit_workflow { flow_id: "f1", ops: [...] }` (seeds draft d1 linked to f1 and correctly returns `flow_id: "f1"` plus "persist with save_workflow { flow_id, draft_id }"), then call `edit_workflow { draft_id: d1, ops: [...] }`. In that second call `edited_from_flow` stays `None`, so `build_proposal` omits the `flow_id` from the payload and the `next` hint flips to "Edits live on draft … (not yet linked to a saved flow) … persist with create_workflow, or save_workflow { flow_id, draft_id } once a flow exists." — actively steering the agent to mint a duplicate flow instead of saving back onto f1.
[RULE] dropped-assignment ·
The CodeRabbit follow-up changed the draft branch's name fallback from draft.name to the base graph's name (correct), but also deleted the 'edited_from_flow = draft.flow_id.clone();' line it was never asked to touch. Draft-based edits on flow-linked drafts then left edited_from_flow as None, pointing the proposal's next-step hint at create_workflow instead of save_workflow. Restore the line with its original comment, keeping the corrected (graph, default_name) fallback. Adds a regression test asserting a flow-linked draft edit's next-step hint references save_workflow. Co-authored-by: Saim Shafique <128062316+sx4im@users.noreply.github.com>
|
Closing this PR as I am narrowing my contribution focus to other repos. |
Summary
edit_workflowresolved the workflow name (thenameargument, else the base graph's name, else "Untitled workflow") but never wrote it into the edited graph itself. The name traveled alongside the graph to the draft write-back and the proposal, so the durable draft kept the base graph's name, and a latersave_workflowpersisted that stale name onto the flow.API Or Behavior Changes
Behavior fix only: the draft graph written by
edit_workflownow carries the resolved name ingraph.name. No API shape changes.Tests
New regression tests in
crates/tinyflows-copilot/src/tools/draft_edit_tests.rs: the resolved name lands in the draft graph, the draft-name fallback works when nonamearg is given, and edit -> save_workflow persists the name end to end. All three failed before the fix and pass after it.cargo fmt --checkcargo clippy --all-targets -- -D warningscargo clippy --all-targets --all-features -- -D warnings(blocked by disk quota on this machine, unrelated to the change)cargo build --all-targets(covered by the clippy run above)cargo build --all-targets --all-features(blocked, same as above)cargo test(cargo test -p tinyflows-copilot: 84/84 pass)cargo test --all-features(blocked, same as above)Documentation
Not needed: the behavior now matches the documented contract (the
nameparameter is already described as "Name for the resulting proposed flow").Fixes tinyhumansai/openhuman#8453
Summary by CodeRabbit