Skip to content

fix(flows): builder turn-budget wiring + prompt guidance + capped UX (B31-B34)#4865

Merged
graycyrus merged 7 commits into
tinyhumansai:mainfrom
graycyrus:fix/flows-builder-turn-budget
Jul 14, 2026
Merged

fix(flows): builder turn-budget wiring + prompt guidance + capped UX (B31-B34)#4865
graycyrus merged 7 commits into
tinyhumansai:mainfrom
graycyrus:fix/flows-builder-turn-budget

Conversation

@graycyrus

@graycyrus graycyrus commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • B31 (backend, High): flows_build built the workflow_builder agent via Agent::from_config_for_agent, which stamps the session's iteration cap from the GLOBAL config.agent.max_tool_iterations (default 10) — not the workflow_builder AgentDefinition's effective_max_iterations() (50, from agent.toml's iteration_policy = "extended"). Only the sub-agent-runner path (chat delegate) applied the definition's cap; the direct RPC path silently got 10. Fixed by overriding config.agent.max_tool_iterations from the resolved definition before building the agent. Also bumped FLOW_BUILD_TIMEOUT_SECS 300 → 600 to match FLOW_RUN_TIMEOUT_SECS (50 iterations × ~10s can now approach 500s).
  • B32 (prompt, Med): the builder prompt's "Interpreting dry-run results honestly" section didn't document what each node type actually produces against the sandbox mocks, so the agent burned tool calls running throwaway probe graphs to rediscover it experimentally. Replaced with an authoritative per-node-type table (verified against SchemaAwareMockAgentRunner, the vendored tinyflows mock, and the envelope/non-envelope node executors) + an explicit "NEVER run isolated probe graphs" directive.
  • B33 (prompt, Med): no complexity guidance existed, so the agent over-engineered graphs (11 nodes for a 4-node task). Added a "Graph complexity — prefer the minimal viable graph" subsection (fold formatting into the agent node, skip split/merge for single-item flows, target 3–6 nodes).
  • B34 (backend + frontend, Med): a cap-hit turn returned a raw checkpoint indistinguishable from a voluntary clarifying question. Added a last_turn_hit_cap accessor on Agent, a capped field on flows_build's response, and a "Continue building" card in WorkflowCopilotPanel (with i18n in all 14 locales) that one-click resumes the turn.

Problem

The workflow_builder agent frequently failed to complete non-trivial workflow builds. Root cause investigation (see commit messages) found the effective iteration budget was silently 10, not the 50 the agent's own agent.toml intends (B31) — and that budget was further wasted on the agent re-discovering sandbox mock behavior through probe graphs (B32) and building needlessly large graphs (B33). When the budget did run out, the UI gave no signal that the turn was capped rather than finished (B34).

Solution

See per-bug summary above; each bug is an isolated commit:

  1. 2fb0c8a9b — B32 + B33, prompt-only, zero code risk.
  2. 8e5be721d — B31, apply_builder_iteration_cap override in src/openhuman/flows/ops.rs::flows_build + timeout bump, with a unit test asserting the resolved cap is 50 (not the global default of 10), both directly and through the actually-built Agent.
  3. 1d0b8a1b7 — B34, last_turn_hit_cap threaded from the tinyagents turn outcome (session/types.rs, session/turn/core.rs, session/runtime.rs) through flows_build's capped response field, to BuilderTurnResult/useWorkflowBuilderChat/WorkflowCopilotPanel on the frontend, with i18n in en.ts + all 13 other locales.

Verification

  • GGML_NATIVE=OFF cargo check --manifest-path Cargo.toml — clean.
  • GGML_NATIVE=OFF cargo check --manifest-path app/src-tauri/Cargo.toml — clean.
  • cargo test --manifest-path Cargo.toml --lib openhuman::flows:: -- --test-threads=1288 passed, 0 failed.
  • cargo test --manifest-path Cargo.toml --lib openhuman::agent::harness::session -- --test-threads=1136 passed, 0 failed, excluding two confirmed pre-existing flakes reproduced identically on the base commit before any of this PR's changes: turn_dispatches_spawn_subagent_through_full_path (stack overflow — deep async recursion in a debug build, unrelated to this diff) and turn_triggers_configured_memory_agent_before_parent_prompt (a SequenceProvider response-ordering assertion, unrelated to this diff — fails in isolation on main too).
  • pnpm typecheck — clean.
  • pnpm lint (full app/) — 0 errors (pre-existing unrelated warnings only; 0 in touched files).
  • Touched Vitest suites (WorkflowCopilotPanel.test.tsx, useWorkflowBuilderChat.test.ts) — 52 passed.
  • pnpm i18n:check — 0 missing/extra keys across all 14 locales.
  • cargo fmt + pnpm format — applied, no diffs.

Confirmed manually against source (not just the plan): apply_builder_iteration_cap resolves the builder's cap to 50 (workflow_builder's agent.toml declares iteration_policy = "extended", max(max_iterations, EXTENDED_MAX_TOOL_ITERATIONS) = max(12, 50) = 50), and the B32 sandbox table was verified row-by-row against SchemaAwareMockAgentRunner (src/openhuman/tinyflows/caps.rs), the vendored mock (vendor/tinyflows/src/caps/mock.rs), and the envelope/non-envelope node executors (vendor/tinyflows/src/nodes/**) — including a code-node subtlety the plan draft implied correctly but that took a Item/envelope trace to confirm (code does not envelope; .item.result resolves directly).

Impact

  • Desktop core (Rust) + frontend (React/Tauri renderer). No new external network dependencies, no schema/migration changes.
  • FLOW_BUILD_TIMEOUT_SECS raised 300s → 600s — a flows_build RPC call can now legitimately run up to 10 minutes server-side; the client-side timeout (flowsApi.ts) was raised in lockstep.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) — Rust unit test for B31's cap resolution; Vitest coverage for B34's capped state (set/cleared/reset-on-new-turn) and the "Continue building" card (renders only when capped && !proposal, does not render for a normal turn, does not render alongside a stale-capped + proposal turn, click dispatches a follow-up).
  • Diff coverage ≥ 80% — all new logic (backend cap override, last_turn_hit_cap plumbing, frontend capped state/card) is covered by the tests above; pnpm test:coverage / pnpm test:rust not run in full locally (long-running), but every changed code path has an explicit assertion.
  • N/A — Coverage matrix: no existing/new feature ID in docs/TEST-COVERAGE-MATRIX.md for the internal workflow_builder copilot RPC; this is a bug fix to existing untracked behavior, not a new user-facing feature row.
  • N/A — no feature-matrix rows added/changed (see above).
  • No new external network dependencies introduced — all changes are in-process (Rust core logic, prompt text, frontend state/UI); tests use the existing mock provider/mock capabilities.
  • N/A — Manual smoke checklist: does not touch release-cut surfaces (onboarding, auth, core lifecycle).
  • N/A — no linked GitHub issue; this PR was scoped directly from an incident writeup (see commit messages for root-cause detail).

Related

  • Closes:
  • Follow-up PR(s)/TODOs: the plan's "systemic fix" note — build_session_agent_inner could apply AgentDefinition.effective_max_iterations() for every agent built via from_config_for_agent, not just this one call site — is intentionally deferred as a broader, separate change.

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

Linear Issue

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

Commit & Branch

  • Branch: fix/flows-builder-turn-budget
  • Commit SHA: 1d0b8a1

Validation Run

  • pnpm --filter openhuman-app format:check — clean (ran pnpm format, no diff produced).
  • pnpm typecheck — clean.
  • Focused tests: WorkflowCopilotPanel.test.tsx, useWorkflowBuilderChat.test.ts (52 passed); cargo test --lib openhuman::flows:: (288 passed).
  • Rust fmt/check (if changed): cargo fmt --manifest-path Cargo.toml, cargo check --manifest-path Cargo.toml — clean.
  • Tauri fmt/check (if changed): cargo check --manifest-path app/src-tauri/Cargo.toml — clean.

Validation Blocked

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

Behavior Changes

  • Intended behavior change: the workflow_builder copilot now gets its intended 50-iteration budget instead of the global 10-iteration default; the prompt steers it away from wasted probe graphs and over-large graphs; a cap-hit turn is now visually distinct with a one-click resume.
  • User-visible effect: fewer failed/incomplete workflow builds in the Flows copilot; when a build does run out of steps, the user sees a clear "Continue building" card instead of an ambiguous raw checkpoint message.

Parity Contract

  • Legacy behavior preserved: the chat-delegate (spawn_subagent) path for workflow_builder is untouched — it already applied effective_max_iterations() correctly. Non-capped turns (proposal or clarifying question) are unaffected; capped is false for both.
  • Guard/fallback/dispatch parity checks: apply_builder_iteration_cap falls back to the unmodified global config if the agent registry or the workflow_builder definition isn't available (same as pre-fix behavior), rather than failing the RPC.

Duplicate / Superseded PR Handling

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

Summary by CodeRabbit

  • New Features
    • Workflow Copilot now shows a “capped” notice when it pauses mid-build due to reaching its tool-call limit.
    • Added a Continue building action that resumes from the current draft.
    • Workflow-building sessions now use a longer completion timeout.
  • Bug Fixes
    • The capped state is cleared at the start of each new turn, and the notice is suppressed when a proposal is pending.
  • Documentation
    • Expanded Workflow Builder guidance, including graph-complexity and sandbox interpretation details.
  • Tests
    • Added/updated coverage for capped detection, resume behavior (including flow and graph context), and updated API timeout expectations.

…aph guidance

B32: replace "Interpreting dry-run results honestly" with an expanded
version that adds an authoritative per-node-type sandbox mock behavior
table (trigger/agent/tool_call/http_request/code echo shapes vs.
transform/condition/switch/split_out/merge real execution), verified
against SchemaAwareMockAgentRunner (tinyflows/caps.rs), the vendored
tinyflows mock (vendor/tinyflows/src/caps/mock.rs), and the envelope/
non-envelope node executors in vendor/tinyflows/src/nodes/. Adds an
explicit "NEVER run isolated probe graphs" directive — in the observed
incident the agent burned 3 of its 10-step budget re-discovering
documented-but-undocumented mock behavior.

B33: add a "Graph complexity — prefer the minimal viable graph"
subsection (fold formatting into the agent node, skip split/merge for
single-item flows, chain reasoning steps in one agent node, target
3-6 nodes) — the agent previously built an 11-node graph for a task
that needs ~4.

Zero code risk: prompt-only change.
…on cap (B31)

flows_build built the workflow_builder agent via
Agent::from_config_for_agent, which stamps config.agent.clone() onto
the session unconditionally — reading the GLOBAL
config.agent.max_tool_iterations (default 10) rather than the
workflow_builder AgentDefinition's effective_max_iterations() (50,
from agent.toml's iteration_policy = "extended"). Only the
sub-agent-runner path (spawn_subagent, used when workflow_builder runs
as a chat delegate) applied the definition's cap; the direct
flows_build RPC path silently got 10, burning its whole budget on a
handful of dry-run cycles for anything past a trivial graph.

Add apply_builder_iteration_cap, which clones the config and overrides
agent.max_tool_iterations from the resolved AgentDefinition before
building the agent, with a debug log of the override and a safe
fallback to the global default if the registry/definition isn't
available. Also raise FLOW_BUILD_TIMEOUT_SECS 300 -> 600 to match
FLOW_RUN_TIMEOUT_SECS: at 50 iterations x ~10s, a worst-case run can
now approach 500s, which the old 300s bound would have clipped before
the (now-correct) iteration cap ever got a chance to.

Unit test asserts the builder's resolved cap is 50 (effective_max_iterations()),
not the global default of 10, both directly and through the actually-built
Agent's agent_config().
…hit (B34)

When a flows_build turn hits the tool-call budget with no proposal
yet, flows_build returned { proposal: null, assistant_text: "<Done so
far / Next steps checkpoint>", error: null } — indistinguishable, in
the response shape, from the agent voluntarily asking a clarifying
question. The frontend rendered the checkpoint as a plain agent
bubble with no signal that the turn was budget-capped and no
one-click way to resume.

Backend: add last_turn_hit_cap (session/types.rs), set from the
tinyagents outcome right after it resolves in turn/core.rs (before
any early return, so it always reflects the latest turn), and expose
it via a new Agent::last_turn_hit_cap() accessor (runtime.rs).
flows_build (ops.rs) reads it after the run and adds a `capped` field
to its response JSON, true only when the turn hit the cap AND
produced no proposal (a turn that squeezed out a proposal despite
hitting the cap has nothing left to continue).

Frontend: BuilderTurnResult gains `capped` (flowsApi.ts);
useWorkflowBuilderChat exposes a `capped` state, reset at the start
of every send() and set from the turn result so it never reflects a
stale prior turn; WorkflowCopilotPanel renders a "Continue building"
card (amber-bordered, matching the existing ocean proposal / coral
error card pattern) when capped, with a button that routes through
the same `submit` path a typed follow-up would — the existing
pendingAskRef mechanism (a capped turn also has proposed === false)
automatically carries the original ask forward so the resumed turn
keeps full context.

i18n: flows.copilot.cappedNotice / flows.copilot.continueBuilding
added to en.ts with real (non-placeholder) translations in all 13
other locales; pnpm i18n:check passes with 0 missing/extra keys.

Tests: Vitest coverage for the hook (capped set/cleared/reset-on-new-turn)
and the panel (card renders only when capped && !proposal, click
dispatches a follow-up turn).
@graycyrus
graycyrus requested a review from a team July 14, 2026 15:16
@coderabbitai

coderabbitai Bot commented Jul 14, 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: 1ec17f21-60c6-47d9-8a3a-d6873a264cd8

📥 Commits

Reviewing files that changed from the base of the PR and between 1d0b8a1 and dd15e78.

📒 Files selected for processing (17)
  • app/src/components/flows/WorkflowCopilotPanel.test.tsx
  • app/src/components/flows/WorkflowCopilotPanel.tsx
  • app/src/lib/i18n/ar.ts
  • app/src/lib/i18n/bn.ts
  • app/src/lib/i18n/de.ts
  • app/src/lib/i18n/en.ts
  • app/src/lib/i18n/es.ts
  • app/src/lib/i18n/fr.ts
  • app/src/lib/i18n/hi.ts
  • app/src/lib/i18n/id.ts
  • app/src/lib/i18n/it.ts
  • app/src/lib/i18n/ko.ts
  • app/src/lib/i18n/pl.ts
  • app/src/lib/i18n/pt.ts
  • app/src/lib/i18n/ru.ts
  • app/src/lib/i18n/zh-CN.ts
  • app/src/services/api/flowsApi.test.ts
🚧 Files skipped from review as they are similar to previous changes (12)
  • app/src/lib/i18n/de.ts
  • app/src/lib/i18n/zh-CN.ts
  • app/src/lib/i18n/pt.ts
  • app/src/lib/i18n/pl.ts
  • app/src/lib/i18n/ko.ts
  • app/src/components/flows/WorkflowCopilotPanel.test.tsx
  • app/src/lib/i18n/id.ts
  • app/src/components/flows/WorkflowCopilotPanel.tsx
  • app/src/lib/i18n/ar.ts
  • app/src/lib/i18n/hi.ts
  • app/src/lib/i18n/en.ts
  • app/src/lib/i18n/it.ts

📝 Walkthrough

Walkthrough

The workflow builder now detects iteration-cap pauses, exposes capped status through the API and chat hook, and renders a localized “Continue building” action when no proposal is pending. Backend timeout and effective-cap handling, tests, and builder prompt guidance were also updated.

Changes

Workflow builder cap handling

Layer / File(s) Summary
Backend cap tracking and response
src/openhuman/agent/harness/session/*, src/openhuman/flows/ops*
The builder applies its effective iteration cap, records cap state per turn, and returns capped when no proposal is produced.
Client contract and turn state
app/src/services/api/flowsApi.ts, app/src/hooks/useWorkflowBuilderChat*
The client propagates capped responses, while the hook resets stale cap state and tests capped and proposal scenarios.
Continue-building UI and localization
app/src/components/flows/*, app/src/lib/i18n/*
The panel conditionally renders the capped notice and submits a revise request with the current graph; translations are added across supported locales.
Workflow builder execution guidance
src/openhuman/flows/agents/workflow_builder/prompt.md
Builder guidance now covers minimal graph construction and detailed sandbox behavior and limitations.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WorkflowCopilotPanel
  participant useWorkflowBuilderChat
  participant buildWorkflow
  participant flows_build
  participant Agent
  WorkflowCopilotPanel->>useWorkflowBuilderChat: click Continue building
  useWorkflowBuilderChat->>buildWorkflow: submit revise request with baseGraph
  buildWorkflow->>flows_build: send builder turn
  flows_build->>Agent: run with effective iteration cap
  Agent-->>flows_build: cap state and proposal result
  flows_build-->>buildWorkflow: return capped response
  buildWorkflow-->>useWorkflowBuilderChat: update capped state
  useWorkflowBuilderChat-->>WorkflowCopilotPanel: render continuation state
Loading

Possibly related PRs

Suggested labels: rust-core, agent, bug

Suggested reviewers: senamakel, oxoxdev, yellowsnnowmann

Poem

A rabbit saw the builder pause,
Then thumped a cheerful “carry on!”
With graphs in tow and steps restored,
The cap became a hopping board.
“Continue building!” — off we spring! 🐇

🚥 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 accurately summarizes the main changes: builder turn-budget wiring, prompt guidance, and capped-turn UX.
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.

@coderabbitai coderabbitai Bot added agent Built-in agents, prompts, orchestration, and agent runtime in src/openhuman/agent/. bug feature Net-new user-facing capability or product behavior. rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. labels Jul 14, 2026

@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: 1d0b8a1b72

ℹ️ 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 +341 to +342
const continueBuilding = useCallback(() => {
void submit(t('flows.copilot.continueBuilding'));

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 Preserve capped-turn state before resuming

When a builder turn hits the cap before producing a proposal, the canvas graph is still the old draft and flows_build creates a fresh workflow_builder agent for each RPC, so the prior tool history/checkpoint text is not included in the next BuilderTurnRequest. In that case this button sends only the generic continue text through submit() (plus the original ask via pendingAskRef), which restarts from the stale graph rather than picking up from the capped turn and can repeatedly hit the same cap. Include the checkpoint/prior transcript or a partial graph in the follow-up before advertising this as a resume action.

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 216e98b. Verified: WorkflowCopilotPanel's submit already sends the Continue turn as mode: 'revise' over the CURRENT graph prop and the existing flowId (never a blank create) — so it does resume ON the built-so-far draft, not from scratch. That said, flows_build (ops.rs) spins up a fresh workflow_builder agent per RPC with no server-side tool-history/checkpoint to reattach to, so this was never a literal seamless mid-thought resume — the copy overpromised that. Reworded flows.copilot.cappedNotice (all 14 locales) and the surrounding code comments in WorkflowCopilotPanel.tsx to accurately say Continue builds forward from the current draft (graph + accumulated instruction via pendingAskRef), not that it resumes the exact in-flight reasoning. Added a regression test asserting the Continue turn carries flowId.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
src/openhuman/flows/ops.rs (1)

3310-3364: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

ops.rs continues to grow past the repo's file-size guideline.

This PR adds apply_builder_iteration_cap to an already very large src/openhuman/flows/ops.rs (well over 3500 lines by the shown line numbers). As per coding guidelines, "**/*.rs: Keep Rust files near or below approximately 500 lines and favor small, single-responsibility modules." Not blocking for this PR, but worth tracking for a future extraction pass (e.g. splitting builder-turn concerns into their own module).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openhuman/flows/ops.rs` around lines 3310 - 3364, Track the file-size
guideline concern for src/openhuman/flows/ops.rs as a future refactoring item
rather than changing this PR’s implementation. When extracting later, move
builder-turn responsibilities such as apply_builder_iteration_cap into a focused
module while preserving its existing fallback and iteration-cap behavior.

Source: Coding guidelines

app/src/hooks/useWorkflowBuilderChat.ts (1)

362-367: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a diagnostic log when a capped turn is detected.

Every other state transition in this hook (thread creation, rehydrate skip, send blocked/ignored, dispatch failure) is logged via log(...), but the new cap-hit detection (setCapped(result.capped && !result.proposal)) is silent. This is exactly the kind of new state transition that benefits from a grep-friendly log line when debugging capped-turn/continuation behavior.

As per path instructions, **/*.{rs,ts,tsx}: "New or changed flows must include verbose, grep-friendly diagnostics for entry/exit, branches, external calls, retries/timeouts, state transitions, and errors."

🩹 Proposed diagnostic addition
-        setCapped(result.capped && !result.proposal);
+        const nextCapped = result.capped && !result.proposal;
+        if (nextCapped) {
+          log('send: turn capped (no proposal) thread=%s', targetThreadId);
+        }
+        setCapped(nextCapped);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/hooks/useWorkflowBuilderChat.ts` around lines 362 - 367, Add a
verbose, grep-friendly diagnostic via the hook’s existing log(...) helper when
cap-hit detection occurs near setCapped(result.capped && !result.proposal). Log
the relevant capped and proposal values and the resulting continuation state,
while preserving the current state update behavior.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/src/lib/i18n/de.ts`:
- Around line 4221-4222: Update the German translation for
flows.copilot.cappedNotice to state that the iteration limit was reached before
the workflow completed, while preserving the existing message that the Builder
can continue from where it stopped.

In `@app/src/lib/i18n/es.ts`:
- Around line 4175-4177: Update the Spanish translation for
flows.copilot.cappedNotice to describe reaching the builder’s iteration or turn
limit before producing a proposal, rather than running out of workflow steps.
Keep flows.copilot.continueBuilding unchanged and preserve the instruction that
users can continue from where they stopped.

In `@app/src/lib/i18n/it.ts`:
- Around line 4172-4173: Update the Italian translation for
flows.copilot.cappedNotice to describe reaching the iteration limit rather than
exhausting workflow steps, while preserving the existing message that the
builder can resume from where it stopped.

In `@app/src/lib/i18n/pt.ts`:
- Around line 4167-4169: Update the Portuguese translation for
flows.copilot.cappedNotice to describe reaching the iteration/turn limit before
completing the workflow, replacing the wording that indicates running out of
steps. Preserve the meaning that continuing resumes from where the builder
stopped.

In `@app/src/lib/i18n/ru.ts`:
- Around line 4139-4141: Update the Russian translation for
flows.copilot.cappedNotice to replace “шаги” with terminology referring to
iterations or turns, while preserving the message’s meaning that the builder can
continue from where it stopped. Leave flows.copilot.continueBuilding unchanged.

---

Nitpick comments:
In `@app/src/hooks/useWorkflowBuilderChat.ts`:
- Around line 362-367: Add a verbose, grep-friendly diagnostic via the hook’s
existing log(...) helper when cap-hit detection occurs near
setCapped(result.capped && !result.proposal). Log the relevant capped and
proposal values and the resulting continuation state, while preserving the
current state update behavior.

In `@src/openhuman/flows/ops.rs`:
- Around line 3310-3364: Track the file-size guideline concern for
src/openhuman/flows/ops.rs as a future refactoring item rather than changing
this PR’s implementation. When extracting later, move builder-turn
responsibilities such as apply_builder_iteration_cap into a focused module while
preserving its existing fallback and iteration-cap behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9ab54078-68f3-490c-ab54-bace9795eb83

📥 Commits

Reviewing files that changed from the base of the PR and between cb9d5e6 and 1d0b8a1.

📒 Files selected for processing (26)
  • app/src/components/flows/WorkflowCopilotPanel.test.tsx
  • app/src/components/flows/WorkflowCopilotPanel.tsx
  • app/src/hooks/useWorkflowBuilderChat.test.ts
  • app/src/hooks/useWorkflowBuilderChat.ts
  • app/src/lib/i18n/ar.ts
  • app/src/lib/i18n/bn.ts
  • app/src/lib/i18n/de.ts
  • app/src/lib/i18n/en.ts
  • app/src/lib/i18n/es.ts
  • app/src/lib/i18n/fr.ts
  • app/src/lib/i18n/hi.ts
  • app/src/lib/i18n/id.ts
  • app/src/lib/i18n/it.ts
  • app/src/lib/i18n/ko.ts
  • app/src/lib/i18n/pl.ts
  • app/src/lib/i18n/pt.ts
  • app/src/lib/i18n/ru.ts
  • app/src/lib/i18n/zh-CN.ts
  • app/src/services/api/flowsApi.ts
  • src/openhuman/agent/harness/session/builder/setters.rs
  • src/openhuman/agent/harness/session/runtime.rs
  • src/openhuman/agent/harness/session/turn/core.rs
  • src/openhuman/agent/harness/session/types.rs
  • src/openhuman/flows/agents/workflow_builder/prompt.md
  • src/openhuman/flows/ops.rs
  • src/openhuman/flows/ops_tests.rs

Comment thread app/src/lib/i18n/de.ts Outdated
Comment thread app/src/lib/i18n/es.ts
Comment thread app/src/lib/i18n/it.ts Outdated
Comment thread app/src/lib/i18n/pt.ts
Comment thread app/src/lib/i18n/ru.ts
…t/pt/ru)

CodeRabbit review: in these five locales the cappedNotice translated
'ran out of steps' with a word that literally means workflow steps/nodes
(Schritte/pasos/passaggi/etapas/шаги), which reads as if the workflow graph
is incomplete rather than the builder hitting its turn/iteration budget.
Reword to convey 'reached its limit' — accurate, non-technical, and free of
the workflow-domain collision. EN source and unflagged locales unchanged.
@M3gA-Mind

Copy link
Copy Markdown
Collaborator

Maintainer review changes

Synced onto fresh upstream/main (no conflicts) and addressed the review feedback.

Fixed — CodeRabbit CHANGES_REQUESTED (22a92fd7)

CodeRabbit flagged the flows.copilot.cappedNotice translation in de/es/it/pt/ru: each rendered "ran out of steps" with a word that literally means workflow steps/nodes (Schritte / pasos / passaggi / etapas / шаги), which in those languages reads as if the workflow graph is incomplete rather than the builder hitting its turn/iteration budget. Reworded all five to convey "reached its limit" — accurate, non-technical, and free of the workflow-domain collision:

  • de: "…hat sein Limit erreicht, bevor dieser Workflow fertig war."
  • es: "…alcanzó su límite antes de terminar este flujo de trabajo."
  • it: "…ha raggiunto il suo limite prima di completare questo flusso di lavoro."
  • pt: "…atingiu o seu limite antes de concluir este fluxo de trabalho."
  • ru: "Конструктор достиг своего предела до завершения этого рабочего процесса."

EN source and the unflagged locales were left unchanged — CodeRabbit's point was a per-language lexical collision in those five, and "ran out of steps" reads idiomatically (not graph-steps) in English.

Declined-with-reason — Codex P2 (WorkflowCopilotPanel.tsx:342, "Preserve capped-turn state before resuming")

Valid observation, but out of scope / pre-existing: flows_build is stateless per-RPC by design — it builds a fresh workflow_builder agent from render_prompt(&req) each call, carrying the current canvas graph but not prior conversation/tool history. The B34 "Continue building" button routes through the exact same submit() path a typed follow-up already uses (and forwards the original ask via pendingAskRef + the canvas graph), so it is strictly a net improvement over the pre-B34 status quo (no signal at all), not a regression. Threading the capped turn's full transcript across RPCs is a real architectural change to flows_build's statelessness and belongs in a dedicated follow-up, not this capped-UX PR. This is a non-blocking COMMENTED note from the Codex bot, not a CHANGES_REQUESTED gate.

Not changed (verified correct)

The Rust wiring is sound: last_turn_hit_cap is stamped from the established TinyagentsTurnOutcome::hit_cap (agent_graph.rs:95, already used at turn/core.rs:1000) before any early-return; apply_builder_iteration_cap correctly resolves the builder's effective_max_iterations() (50) with a fail-open fallback; the capped = hit_cap && proposal.is_none() signal is guarded consistently server→api→hook→panel. i18n keys present in all 14 locales.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 14, 2026
M3gA-Mind
M3gA-Mind previously approved these changes Jul 14, 2026

@M3gA-Mind M3gA-Mind left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed — CI green and no outstanding review comments. Approving and merging.

…aft (tinyhumansai#4865)

CodeRabbit (5 locales, same issue): the capped-turn notice said the builder
"ran out of steps" — confusing against graph nodes, which are also called
"steps" elsewhere in the UI. Reword to name the real condition: the builder
hit its iteration limit before producing a proposal. Fixed en.ts first, then
retranslated all 14 locales.

Codex (WorkflowCopilotPanel.tsx:342): verified "Continue building" already
carries the CURRENT draft graph + the existing flowId through a `revise` turn
(never a blank `create` restart) — `flows_build` has no server-side
session/tool-history checkpoint to resume (a fresh `workflow_builder` agent
runs per RPC), so this was never a literal seamless resume. What actually
carries forward is the live draft graph (untouched by a capped turn, since
revise_workflow/propose_workflow never persist without reaching this panel)
plus the accumulated instruction text via `pendingAskRef`. Reworded the
capped notice and the surrounding code comments to say "continuing builds
from the current draft" instead of implying continuity the architecture
doesn't provide, and added a regression test asserting the Continue turn
carries `flowId`.

No Rust changes — flows_build's revise-mode wiring was already correct.
@graycyrus
graycyrus dismissed stale reviews from M3gA-Mind and coderabbitai[bot] via 216e98b July 14, 2026 15:41
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 14, 2026
The B31 fix bumped FLOW_BUILD_TIMEOUT_MS 310_000 -> 610_000 (matching the
backend FLOW_BUILD_TIMEOUT_SECS 300 -> 600), but two buildWorkflow test
assertions in flowsApi.test.ts still expected the old 310_000. Discover
tests correctly stay at 310_000 (FLOW_DISCOVER unchanged).
@coderabbitai coderabbitai Bot removed the feature Net-new user-facing capability or product behavior. label Jul 14, 2026
@graycyrus
graycyrus merged commit f746890 into tinyhumansai:main Jul 14, 2026
22 of 26 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Team Openhuman Jul 14, 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.

2 participants