Skip to content

fix(flows): correct workflow_builder prompt posture (B27, B28) - #4834

Merged
graycyrus merged 2 commits into
tinyhumansai:mainfrom
graycyrus:fix/flows-builder-prompt-posture
Jul 13, 2026
Merged

graycyrus merged 2 commits into
tinyhumansai:mainfrom
graycyrus:fix/flows-builder-prompt-posture

Conversation

@graycyrus

@graycyrus graycyrus commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fix B27: workflow_builder's prompt described a phantom "review card" whose
    Accept persists a flow via flows_create — the real instant-canvas flow is
    copilot-panel Accept → local unsaved draft, then the canvas's own Save →
    updateFlow/createFlow persists.
  • Fix B27: the agent's own turn directive (DIRECTIVE_BUILD_PROPOSE_ONLY)
    echoed the same stale "Accept the proposal explicitly and the canvas's Save
    persists it" wording, which contradicted the agent sometimes auto-calling
    save_workflow itself.
  • Fix B28: add explicit prompt guidance distinguishing a benign
    mock-LLM-output placeholder null (sandbox SchemaAwareMockAgentRunner —
    expected, note and proceed) from a real binding null / dry-run ok:false
    (a wrong =nodes.* path — a real bug that must be fixed, never dismissed
    as a "sandbox limitation").
  • Doc-comment cleanup in builder_prompt.rs to match the corrected framing.
  • Prompt-only change (plus one Rust constant + doc comments); no tool logic
    or frontend code changed.

Problem

The workflow_builder agent's system prompt (prompt.md) and its
Build-mode turn directive (builder_prompt.rs) told the agent there is a
"review card" with an "Accept" action that persists the flow, and separately
that "the canvas's Save" persists it too — describing two different
persistence paths for what is actually a single two-step UI flow (Accept →
local draft, Save → persist). The agent echoed this stale phrasing verbatim
to users even in turns where it had itself already called save_workflow,
producing contradictory messaging (B27).

Separately, the prompt told the agent to "fix every" null_resolutions
finding from dry_run_workflow, but gave no guidance distinguishing a
legitimate mock-LLM-output placeholder (expected in the sandbox — no real
LLM ran) from a real wiring bug (a wrong =nodes.* binding path). Observed
agent behavior dismissed a real dry-run failure as a "known sandbox
limitation... at runtime this works perfectly" and saved anyway — the prompt
did not forbid this pattern (B28).

Solution

B27 — src/openhuman/flows/agents/workflow_builder/prompt.md:

  • Removed the phantom "Save & enable click in the review card" /
    flows_create language; replaced with an accurate statement that only the
    user's own canvas Save persists the flow.
  • Rewrote the authoring-arc step 2 to describe the real Accept (copilot
    panel, applies to canvas draft) → Save (canvas, persists) sequence, and
    made explicit that the agent must not call save_workflow unless asked.

src/openhuman/flows/agents/workflow_builder/builder_prompt.rs:

  • Rewrote DIRECTIVE_BUILD_PROPOSE_ONLY to drop the "I will Accept the
    proposal explicitly and the canvas's Save persists it" phrasing in favor
    of an accurate description ("I will review the proposal in the copilot
    panel, accept it onto the canvas draft, and save it myself"). The
    Do NOT save_workflow instruction (critical for Rejecting a seeded flow build leaves the graph persisted #4596) is unchanged.
  • Updated three developer-facing doc comments referencing "the review
    card's Accept" / "explicit Accept + Save" to say "the copilot panel's
    Accept + the canvas's Save".

B28 — src/openhuman/flows/agents/workflow_builder/prompt.md:

  • Added a sentence to the existing dry-run checklist: never dismiss a
    dry-run ok: false as a sandbox limitation.
  • Added a new "Interpreting dry-run results honestly" subsection after the
    verify-loop section explaining the two classes of null/placeholder values
    (mock-LLM-output placeholder vs. real binding null) and explicitly
    forbidding "known sandbox limitation" / "at runtime this works perfectly"
    as a way to wave off a real finding.

No tool logic or frontend changes — DryRunWorkflowTool, SaveWorkflowTool,
ReviseWorkflowTool, ProposeWorkflowTool, WorkflowCopilotPanel, and
FlowCanvasPage's save flow are all correct today; only the agent's prompt
described them wrong.

Submission Checklist

If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy — added a regression assertion to build_is_propose_only_and_injects_flow_id_as_context that the build directive no longer contains "review card" or "Accept the proposal explicitly"; existing positive/negative assertions on Do NOT save_workflow still pass.
  • N/A: Diff coverage ≥ 80% — changed lines are a markdown prompt file (not covered by coverage tooling) plus a Rust string constant + doc comments fully exercised by the existing/extended unit test in the same module.
  • N/A: Coverage matrix — behaviour-only prompt/wording change, no feature added/removed/renamed.
  • N/A: no feature-matrix IDs apply (prompt wording fix only).
  • No new external network dependencies introduced (mock backend used per Testing Strategy) — no network code touched.
  • N/A: Manual smoke checklist — no release-cut surface touched (agent prompt text only, no UI/RPC surface change).
  • N/A: no linked issue tracks B27/B28 (internal review findings); see Related.

Impact

  • Runtime/platform impact: none — this changes only the workflow_builder agent's system prompt text and one Rust string constant/doc comments; no RPC, schema, or UI changes.
  • No performance, security, or migration implications.
  • Behavioral effect: the agent's chat replies during a Build/Create/Revise turn will describe the Accept → draft → Save flow accurately instead of referencing a nonexistent "review card", and will no longer wave off a real dry-run failure as a "sandbox limitation".

Related

  • Closes: N/A (no linked GitHub issue; fixes internally-tracked bugs B27 and B28 from workflow_builder prompt review)
  • Follow-up PR(s)/TODOs: none

AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/flows-builder-prompt-posture
  • Commit SHA: 05717a0

Validation Run

  • pnpm --filter openhuman-app format:check — N/A no app/ files changed; ran cargo fmt + pnpm format (repo-wide) with no diffs beyond the two intended files.
  • pnpm typecheck — N/A no TypeScript changed; not run.
  • Focused tests: GGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib openhuman::flows:: -- --test-threads=1 → 271 passed, 0 failed (single-threaded per known validate_tool_contracts* parallel-only flake).
  • Rust fmt/check (if changed): GGML_NATIVE=OFF cargo check --manifest-path Cargo.toml passed; cargo fmt applied (no diffs).
  • N/A Tauri fmt/check (if changed): no app/src-tauri files changed.

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: workflow_builder agent chat replies describe the real Accept (copilot panel, local draft) → Save (canvas, persists) flow instead of a nonexistent "review card"; the agent no longer dismisses a real dry-run ok: false as a "sandbox limitation".
  • User-visible effect: clearer, non-contradictory instructions from the agent on how to persist a proposed workflow, and more honest reporting of dry-run failures.

Parity Contract

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none known
  • Canonical PR: this PR
  • Resolution (closed/superseded/updated): N/A

Summary by CodeRabbit

  • Documentation
    • Clarified persistence behavior: workflow updates save only via the copilot Accept action and the canvas Save action.
    • Strengthened instructions for creating new flows, including that they can’t be enabled automatically.
    • Improved guidance on when authoring stops and how to interpret dry-run results (treat ok: false as real wiring/validation issues, and distinguish placeholder outputs from genuine failures).
  • Bug Fixes
    • Updated validation to avoid misleading persistence/verification messaging.
  • Tests
    • Tightened regression checks to ensure outdated phrasing is not generated.

B27: the prompt and DIRECTIVE_BUILD_PROPOSE_ONLY described a phantom
"review card" whose Accept persists the flow via flows_create. The
actual instant-canvas flow is: copilot panel Accept -> local unsaved
draft overlay, then the canvas's own Save -> updateFlow/createFlow
persists. The agent also echoed the stale wording verbatim while
sometimes auto-calling save_workflow itself, contradicting its own
message. Rewrite prompt.md and the build directive/doc comments to
match the real UI, and stop implying Accept persists anything.

B28: add prompt guidance distinguishing a mock-LLM-output placeholder
null (sandbox SchemaAwareMockAgentRunner - expected, note and proceed)
from a real binding null / dry-run ok:false (a wrong =nodes.* path -
a genuine bug that must be fixed). The agent had previously waved off
a real dry-run failure as a "known sandbox limitation," which the
prompt did not explicitly forbid.

Adds a regression assertion that the build directive no longer
contains "review card" or "Accept the proposal explicitly".
@graycyrus
graycyrus requested a review from a team July 13, 2026 18:15
@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 40ca55c5-8b80-40dd-af8e-5d2c05e343f7

📥 Commits

Reviewing files that changed from the base of the PR and between 05717a0 and 46a3571.

📒 Files selected for processing (1)
  • src/openhuman/flows/agents/workflow_builder/prompt.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openhuman/flows/agents/workflow_builder/prompt.md

📝 Walkthrough

Walkthrough

The workflow-builder prompts now clarify user-controlled Accept and Save persistence, prohibit implicit saving, strengthen authoring boundaries, and require real handling of failed dry runs. Build-mode regression tests reject legacy persistence wording.

Changes

Workflow Builder Prompt Contract

Layer / File(s) Summary
Build persistence contract
src/openhuman/flows/agents/workflow_builder/builder_prompt.rs
Build-mode comments and generated directives reference copilot Accept followed by canvas Save, while regression tests reject obsolete phrasing.
Authoring and dry-run guidance
src/openhuman/flows/agents/workflow_builder/prompt.md
Prompt guidance limits authoring turns, defines persistence and enablement rules for new flows, and distinguishes valid dry-run outcomes from real binding failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: rust-core, agent, bug

Poem

I’m a rabbit with prompts tucked neat,
Accept, then Save, the contract’s beat.
No secret hops to store or start,
Dry-run flaws must play their part.
Clear paths bloom beneath my feet.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and clearly points to the workflow_builder prompt fix, which matches the main changes in the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05717a012e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +22 to +24
If there is no existing flow to save to, only the user's own **Save** on
the canvas persists the flow. If a user says "just turn it on for me",
explain that enabling stays in their hands — you cannot enable a flow.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep non-copilot proposal save paths in the prompt

When workflow_builder is reached from main chat or Suggested Workflows without a saved flow_id, the proposal still renders in WorkflowProposalCard, whose user-clicked “Save & enable” path calls flows_create directly, not the canvas Save flow. This new wording tells the agent that only canvas Save can persist in exactly those no-existing-flow cases, so its user-facing guidance can contradict the actual card shown in those contexts.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 46a3571. Verified the claim first: WorkflowProposalCard's "Save & enable" button (app/src/components/chat/WorkflowProposalCard.tsx) calls createFlow → openhuman.flows_create directly, and it's rendered both from main chat (Conversations.tsx) and Suggested Workflows (SuggestedWorkflows.tsx) — both no-existing-flow_id contexts, distinct from the canvas copilot's Accept+Save flow. Reworded the two spots in prompt.md (the invariants section and the authoring-loop step) to describe both persist paths: canvas copilot Accept→Save, and the chat/Suggested-Workflows proposal card's "Save & enable". Kept the B28 dry-run-honesty additions and the "do NOT call save_workflow unless asked" rule intact; cargo test --lib openhuman::flows:: (271 tests) still passes, including the B27 regression test asserting the phantom "review card"/"Accept the proposal explicitly" language stays gone.

@coderabbitai coderabbitai Bot added agent Built-in agents, prompts, orchestration, and agent runtime in src/openhuman/agent/. bug rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. labels Jul 13, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 13, 2026
B27 over-corrected: it taught the agent that only the canvas's Save
persists a flow when there's no existing flow_id. That's true for the
canvas copilot, but main chat and Suggested Workflows render the same
proposal in WorkflowProposalCard, whose "Save & enable" button calls
flows_create directly — no canvas Save step exists in that path. Describe
both so the agent's guidance to the user matches whichever surface is
actually showing them the proposal.

Addresses Codex review comment on PR tinyhumansai#4834 (id 3573085947,
src/openhuman/flows/agents/workflow_builder/prompt.md:24).
@graycyrus
graycyrus merged commit 0d9c126 into tinyhumansai:main Jul 13, 2026
21 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Team Openhuman Jul 13, 2026
senamakel pushed a commit to nocstah/openhuman that referenced this pull request Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Built-in agents, prompts, orchestration, and agent runtime in src/openhuman/agent/. bug rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant