Skip to content

Let a task set how many turns a do step may spend - #164

Merged
YellowSnnowmann merged 2 commits into
mainfrom
feat/configurable-do-turns
Oct 23, 2026
Merged

YellowSnnowmann merged 2 commits into
mainfrom
feat/configurable-do-turns

Conversation

@YellowSnnowmann

Copy link
Copy Markdown
Member

Summary

A do step had a fixed eight turns (DO_TURNS). In OpenIntents production every Jev run on amazon.in since the worker moved to Jev ended not accomplished after 8 turns (5 of 5, 800 to 1,150 Jev calls each): a shop's cart or checkout can need more moves in one step than a desktop app does. This lets a task, or a flow run, raise the limit, keeping 8 as the default.

Related issue

None.

API or behavior changes

  • New optional field TaskBudget.max_do_turns and RunFlowRequest.max_do_turns (contract 2.28, a minor bump). Unset keeps 8; the module caps it at 32 (MAX_DO_TURNS). Omitted from the wire when unset.
  • The task controller passes the budget's limit to every flow run it starts.
  • Not breaking: callers that do not set it behave exactly as before. A 2.27 module ignores the field.

Validation

Commands actually run, with their outcome (rustc 1.99.1, macOS):

  • cargo fmt --all -- --check: pass
  • cargo clippy --all-targets --all-features -- -D warnings: clean on the crates this touches (cargo clippy --no-deps -p tinycomputer-bus -p tinycomputer-engine -p tinycomputer). The full run stops on 4 lints in tinycomputer-accessibility (focus.rs:135, paste.rs:286, permissions.rs:150,153), untouched here; they fail the same way on main 02f9aac with this newer local toolchain, and CI on main is green.
  • cargo build --all-targets --all-features: pass
  • cargo test --all-features: 1,723 passed, 2 failed: members_tests::a_wait_with_no_mode_is_an_invalid_argument_rather_than_a_hang and an_unknown_surface_wait_is_rejected_by_name, which fail identically on main 02f9aac on this Mac (desktop environment), untouched here. runner_hooks_share_the_task_surface_and_release_its_session failed once under the full parallel run and passed 3/3 alone, and passes on main: flaky, unrelated.
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features: pass

Tests

  • flow_tests/do_loop_tests.rs::a_do_step_spends_the_turns_its_run_allows: simulator, a frozen page; a do step ends after exactly 8 turns unset, 3, 12, and 32 when asked for 500.
  • task_tests/start_tests.rs::a_budget_turn_limit_reaches_every_run, and the existing start test asserts unset stays unset.
  • Wire pins: agent_tests::a_do_turn_limit_pins_its_wire_form, flow_tests (RunFlowRequest omits it unset, round-trips 12).
  • Version pins moved to 2.28 (version_tests, public_api_tests); describe_tests covers the documented budget field.

Documentation

  • docs/technical/decision-thresholds.md: DO_TURNS / MAX_DO_TURNS 8 / 32.
  • docs/technical/specs/desktop-module-contract.md: the 2.28 note.
  • docs/technical/tasks.md, docs/crates/tinycomputer-bus/agent-and-tasks.md, crates/tinycomputer-skills/schemas/start_task.schema.json, and the DescribeModule StartTask schema list the field.

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

A `do` step had a fixed eight turns (`DO_TURNS`). On a shop's cart or
checkout one step can need more moves than that, and the step then fails
as not accomplished while it is still making progress.

- `TaskBudget.max_do_turns` and `RunFlowRequest.max_do_turns`: optional,
  8 when unset, capped by the module at 32 (`MAX_DO_TURNS`).
- The task controller passes the budget's limit to every flow run.
- Contract 2.28; the thresholds table, the task docs, the StartTask
  schema and the described budget list the field.
@tinysweeper

tinysweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Verdict: Incomplete · Priority: none
Coverage: Reviewed 7 of 20 files; not reviewed (large PR): crates/tinycompu…, crates/tinycompu…, and 11 additional unreviewed files.
Pull request purpose (title): Let a task set how m…

Diagnostics and supporting details

Full summary

Pull request purpose (title): Let a task set how many turns a do step may spend. Tiny Sweeper completed its review; deterministic results follow.

Unreviewed paths

  • crates/tinycomputer-bus/src/agent/agent_tests.rs
  • crates/tinycomputer-bus/src/flow/flow_tests.rs
  • crates/tinycomputer-engine/src/agentic/flow/mod.rs
  • crates/tinycomputer-engine/src/agentic/flow/run.rs
  • crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs
  • crates/tinycomputer-engine/src/task/budget.rs
  • crates/tinycomputer-engine/src/task/describe.rs
  • crates/tinycomputer-engine/src/task/task_tests/describe_tests.rs
  • crates/tinycomputer/tests/public_api_tests.rs
  • docs/crates/tinycomputer-bus/agent-and-tasks.md
  • docs/technical/decision-thresholds.md
  • docs/technical/specs/desktop-module-contract.md
  • docs/technical/tasks.md

Partial review reasons

  • critique: crates/tinycomputer-bus/src/agent/agent_tests.rs — not selected by the large-review budget
  • security: crates/tinycomputer-bus/src/agent/agent_tests.rs — not selected by the large-review budget
  • critique: crates/tinycomputer-bus/src/flow/flow_tests.rs — not selected by the large-review budget
  • security: crates/tinycomputer-bus/src/flow/flow_tests.rs — not selected by the large-review budget
  • critique: crates/tinycomputer-engine/src/agentic/flow/mod.rs — not selected by the large-review budget
  • security: crates/tinycomputer-engine/src/agentic/flow/mod.rs — not selected by the large-review budget
  • critique: crates/tinycomputer-engine/src/agentic/flow/run.rs — not selected by the large-review budget
  • security: crates/tinycomputer-engine/src/agentic/flow/run.rs — not selected by the large-review budget
  • critique: crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs — not selected by the large-review budget
  • security: crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs — not selected by the large-review budget
  • critique: crates/tinycomputer-engine/src/task/budget.rs — not selected by the large-review budget
  • security: crates/tinycomputer-engine/src/task/budget.rs — not selected by the large-review budget
  • critique: crates/tinycomputer-engine/src/task/describe.rs — not selected by the large-review budget
  • security: crates/tinycomputer-engine/src/task/describe.rs — not selected by the large-review budget
  • critique: crates/tinycomputer-engine/src/task/task_tests/describe_tests.rs — not selected by the large-review budget
  • security: crates/tinycomputer-engine/src/task/task_tests/describe_tests.rs — not selected by the large-review budget
  • critique: crates/tinycomputer/tests/public_api_tests.rs — not selected by the large-review budget
  • security: crates/tinycomputer/tests/public_api_tests.rs — not selected by the large-review budget
  • critique: docs/crates/tinycomputer-bus/agent-and-tasks.md — not selected by the large-review budget
  • critique: docs/technical/decision-thresholds.md — not selected by the large-review budget
  • critique: docs/technical/specs/desktop-module-contract.md — not selected by the large-review budget
  • critique: docs/technical/tasks.md — not selected by the large-review budget

Review snapshot

Change surface Files Review signal Count
Production 8 Active findings 0
Tests 7 Noted findings 0
Documentation 4 Resolved findings 0
Configuration 1 Pending checks/questions 35

Completeness: Incomplete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

A new optional `max_do_turns` field is added to `TaskBudget` and, with `skip_serializing_if` so it is omitted when unset, to `RunFlowRequest`. The flow runtime clamps a set value to 1..=32 against the new `MAX_DO_TURNS` constant and otherwise falls back to `DO_TURNS` (8), which becomes `pub(super)`; the `do` step's turn allowance now reads `run.do_turns` instead of the constant. The task controller copies the budget value into every run request, and the DescribeModule StartTask schema and `start_task.schema.json` document the field with minimum 1 and maximum 32. The contract constant moves to (2, 28) with compatibility pins and comments updated, and the relevant technical docs list the new lever.

Features

  • Added — Optional max_do_turns on TaskBudget: Hosts can set a per-task turn limit for a `do` step; an unset value leaves the module's own default in force. (crates/tinycomputer-bus/src/agent/types/request.rs pub struct TaskBudget {)
  • Added — Optional max_do_turns on RunFlowRequest: A flow run can set its own turn limit; the field is left off the wire when unset so unset callers' wire form is unchanged. (crates/tinycomputer-bus/src/flow/types/request.rs pub struct RunFlowRequest {, crates/tinycomputer-bus/src/flow/types/request.rs impl Default for RunFlowRequest {)
  • Modified — Do-step turn allowance made configurable and capped: A `do` step spends the run's configured turns rather than a fixed 8, clamped to 1..=32; without a set value behavior is exactly as before. (crates/tinycomputer-engine/src/agentic/flow/mod.rs const MAX_ACTIONS: u32 = 120;, crates/tinycomputer-engine/src/agentic/flow/run.rs impl<'r, B: AgentBackend + Sync> FlowRun<'r, B> {, crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs pub(super) async fn run<B: AgentBackend + Sync>(, crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs use tinycomputer_bus::FlowAction;, crates/tinycomputer-engine/src/agentic/flow/mod.rs pub(super) struct FlowRun<'r, B> {)
  • Modified — Budget pass-through from the task controller: Every flow run a task starts receives the budget's turn limit, so the setting applies uniformly across runs within a task. (crates/tinycomputer-engine/src/task/budget.rs pub(super) fn run_request()
  • Modified — Contract version bump to 2.28: A 2.27 module is now considered incompatible because it ignores the field and would keep every `do` step at 8 turns; hosts and modules agree on the new field's presence. (crates/tinycomputer-bus/src/version/mod.rs pub const CONTRACT_VERSION: (u32, u32) = (2, 27);)
  • Modified — Threshold and contract documentation updated: The constant table records the 8 default and 32 cap, and the contract spec and task docs describe the 2.28 field and its purpose. (docs/technical/decision-thresholds.md Change a constant and its row together., docs/technical/specs/desktop-module-contract.md serves the interface and fails to answer, turns the approval into a decline, so, docs/technical/tasks.md is acted on: `deep` (the default), `standard`, or `off`, docs/crates/tinycomputer-bus/agent-and-tasks.md for the fuller picture of what does and does not get automated here.)

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Before merge

  • Complete the critique review for crates/tinycomputer-bus/src/flow/flow_tests.rs, crates/tinycomputer-bus/src/agent/agent_tests.rs, crates/tinycomputer-engine/src/agentic/flow/mod.rs, crates/tinycomputer-engine/src/agentic/flow/run.rs, crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs, crates/tinycomputer-engine/src/task/describe.rs, docs/technical/specs/desktop-module-contract.md, docs/crates/tinycomputer-bus/agent-and-tasks.md, docs/technical/tasks.md, crates/tinycomputer/tests/public_api_tests.rs, docs/technical/decision-thresholds.md, crates/tinycomputer-engine/src/task/budget.rs, crates/tinycomputer-engine/src/task/task_tests/describe_tests.rs.
  • Complete the security review for crates/tinycomputer-bus/src/flow/flow_tests.rs, crates/tinycomputer-bus/src/agent/agent_tests.rs, crates/tinycomputer-engine/src/agentic/flow/mod.rs, crates/tinycomputer-engine/src/agentic/flow/run.rs, crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs, crates/tinycomputer-engine/src/task/describe.rs, crates/tinycomputer/tests/public_api_tests.rs, crates/tinycomputer-engine/src/task/budget.rs, crates/tinycomputer-engine/src/task/task_tests/describe_tests.rs.
  • Review uncovered paths: crates/tinycomputer-bus/src/agent/agent_tests.rs, crates/tinycomputer-bus/src/flow/flow_tests.rs, crates/tinycomputer-engine/src/agentic/flow/mod.rs, crates/tinycomputer-engine/src/agentic/flow/run.rs, crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs, crates/tinycomputer-engine/src/task/budget.rs, crates/tinycomputer-engine/src/task/describe.rs, crates/tinycomputer-engine/src/task/task_tests/describe_tests.rs, crates/tinycomputer/tests/public_api_tests.rs, docs/crates/tinycomputer-bus/agent-and-tasks.md, docs/technical/decision-thresholds.md, docs/technical/specs/desktop-module-contract.md, docs/technical/tasks.md.
Agent review details

critique

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered files: crates/tinycomputer-bus/src/flow/flow_tests.rs, crates/tinycomputer-bus/src/agent/agent_tests.rs, crates/tinycomputer-engine/src/agentic/flow/mod.rs, crates/tinycomputer-engine/src/agentic/flow/run.rs, crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs, crates/tinycomputer-engine/src/task/describe.rs, docs/technical/specs/desktop-module-contract.md, docs/crates/tinycomputer-bus/agent-and-tasks.md, docs/technical/tasks.md, crates/tinycomputer/tests/public_api_tests.rs, docs/technical/decision-thresholds.md, crates/tinycomputer-engine/src/task/budget.rs, crates/tinycomputer-engine/src/task/task_tests/describe_tests.rs
  • Lane summary: Reviewed 7 of 20 files — 13 not reviewed. Reviewed 7 files; 1 finding. 13 files were omitted: not selected by the large-review budget.

security

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered files: crates/tinycomputer-bus/src/flow/flow_tests.rs, crates/tinycomputer-bus/src/agent/agent_tests.rs, crates/tinycomputer-engine/src/agentic/flow/mod.rs, crates/tinycomputer-engine/src/agentic/flow/run.rs, crates/tinycomputer-engine/src/agentic/flow/steps/mod.rs, crates/tinycomputer-engine/src/task/describe.rs, crates/tinycomputer/tests/public_api_tests.rs, crates/tinycomputer-engine/src/task/budget.rs, crates/tinycomputer-engine/src/task/task_tests/describe_tests.rs
  • Lane summary: Reviewed 7 of 16 files — 9 not reviewed. Reviewed 7 files; 0 findings. 9 files were omitted: not selected by the large-review budget. 4 files were not security-reviewed: docs/crates/tinycomputer-bus/agent-and-tasks.md (prose or tabular data), docs/technical/decision-thresholds.md (prose or tabular data), docs/technical/specs/desktop-module-contract.md (prose or tabular data), docs/technical/tasks.md (prose or tabular data).

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change is a contract bump adding an optional `max_do_turns` to `TaskBudget` and `RunFlowRequest`, clamped in `run.rs` to 1..=32 with the module default of 8, and threaded through the task controller into every run. Tests pin the wire form in both directions, the unset default, the clamping and default in the do loop, and the controller passing the value through; the contract version pins are updated consistently. I found nothing reportable. _The code index is behind this pull request (indexed at `174f08ddacad`), so retrieved context may be out of date._

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The commits lane answered and found no sensitive content in committed files.
  • Lane summary: No sensitive content in committed files. _The code index is behind this pull request (indexed at `174f08ddacad`), so retrieved context may be out of date._

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change adds an optional `max_do_turns` to `TaskBudget` and `RunFlowRequest`, threads it through the task controller into the flow runtime with a default of 8 and a cap of 32, bumps the contract to 2.28, and adds simulator, controller, wire-pin and doc coverage that matches what the description claims. The description is accurate and complete: the new fields, the version bump, the cap, the pass-through and the docs are all described and all present in the diff. _The code index is behind this pull request (indexed at `174f08ddacad`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.001555
  • Tokens: 531840 input · 8411 output · 61440 cached · 600 embedding
  • Updated: 2026-10-23T05:55:25Z
Head State Pass summary
fe1874771f5f incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-23T05:55:25Z)

tinysweeper 0.1.2

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 97c2be18-0105-4792-aa0a-756220ecc265
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@tinysweeper tinysweeper 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.

tinysweeper could not complete coverage (13 unanswered item(s)), so this is not an approval.

Diagnostics

Total spend: $0.0016

@YellowSnnowmann
YellowSnnowmann merged commit 23e1180 into main Oct 23, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant