Repository navigation
[tiny-modules] tinyagents: move turn policy, outcome, deadline, stop, error and cost accounting into tinyagents-harness #7600
Copy link
Copy link
Labels
harnessAgent harness / orchestrationAgent harness / orchestrationpriority: p3Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.refactorStructural code change without a primary behavior change.Structural code change without a primary behavior change.rust-coreCore Rust runtime in src/: CLI, core_server, shared infrastructure.Core Rust runtime in src/: CLI, core_server, shared infrastructure.subtaskSubtask of a larger tracked effort.Subtask of a larger tracked effort.
Description
Parent: #7540
Context
Turn-level run policy, outcome classification, finalisation, wall-clock deadline, stop reasons, agent-loop error types and per-call cost accounting are generic harness concerns. The harness already has terminal.rs, cost/ and turn_clock. The host keeps only the product projection of errors, progress and cost.
What moves
| Path | LOC | Class |
|---|---|---|
agent/tinyagents/turn_policy.rs |
499 | Split: generic run policy up |
agent/tinyagents/turn_outcome.rs |
173 | Split |
agent/tinyagents/turn_run_error.rs |
91 | Split |
agent/tinyagents/turn_run_finalize.rs |
342 | Split: finalisation up; product error and progress projection stays |
agent/tinyagents/response_shape.rs |
410 | Moves: per-turn response format and output cap; drop the task-local (Task 4) |
agent/turn_deadline.rs |
151 | Moves (harness turn_clock) |
agent/turn_stop.rs |
165 | Moves (harness terminal.rs) |
agent/error.rs |
249 | Moves (host-free agent-loop errors) |
agent/cost.rs |
185 | Moves partly (harness cost/); pricing lookup stays |
agent/tool_policy.rs |
141 | Moves: duplicates harness library/tool_policy.rs |
What stays in OpenHuman
Product projection: AgentProgress and the cost UI, Sentry classification, OpenHuman pricing table lookup, failure_copy.
Upstream target
tinyhumansai/tinyagents:tinyagents-harness(terminal.rs,cost/,middleware/library/{turn_clock,tool_policy}).- Plan Task 4 (
response_shapetask-local) and Task 8.
Host adapter after the move
The host maps harness TurnOutcome/StopReason/CostRecord to RPC and progress events in one projection module.
Acceptance criteria
- Upstream PR merged in the owning repo first, then the gitlink bumped here to that merged commit. This is a Cargo library (kernel), so there is no cdylib release; CI builds the merged upstream commit.
- Tests move with the code; host keeps only composition/adapter tests.
- Old core code and its
*_tests.rsdeleted in the same PR — no re-export shims, nopub usealiases. - Matching entries removed from
scripts/ci/agent-runtime-boundary-baseline.json(where applicable) and the ratchet still passes. -
pnpm rust:layout,cargo check --manifest-path Cargo.toml,cargo check --manifest-path crates/openhuman-app/Cargo.tomlgreen. - Every behaviour change ships with a regression test (failing before, passing after);
pnpm debug rust <filter>for the affected suites. - The
rg 'task_local!' agent/tinyagents/response_shape.rshit is gone. - Cost totals for a scripted multi-call turn on the mock backend are unchanged (regression test).
Depends on
- No hard blocker. E0 ([tiny-modules] E0: module source modes — load modules from release, linked or source build (no release per change) #7524) on-demand module builds are for local dev and testing only and do not affect this Cargo-library move
Metadata
Metadata
Assignees
Labels
harnessAgent harness / orchestrationAgent harness / orchestrationpriority: p3Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.refactorStructural code change without a primary behavior change.Structural code change without a primary behavior change.rust-coreCore Rust runtime in src/: CLI, core_server, shared infrastructure.Core Rust runtime in src/: CLI, core_server, shared infrastructure.subtaskSubtask of a larger tracked effort.Subtask of a larger tracked effort.
Type
Projects
- StatusShow more project fieldsDone
Activity
tinysweeper commentedon Oct 13, 2026
Refactoring task in the tiny-modules series (parent #7540): move generic turn policy, outcome, deadline, stop, error, and cost accounting from OpenHuman's agent/tinyagents into the tinyagents-harness upstream crate, keeping only the host product projection and adapter.
Labelled
priority: p3.senamakel commentedon Oct 13, 2026
Module side (partial) merged: tinyhumansai/tinyagents#436 (merge e1f8e93b5fe79dce7494a271d0065453fdfae4ce on tinyagents main). Pin vendor/tinyagents to that commit; host-side deletion/adaptation still to do. Unported items are listed in the PR body.
senamakel commentedon Oct 13, 2026
Module side merged: tinyhumansai/tinyagents#438 (merge commit a7c9d23cae087b305dbaece7d44e01d1161235d3 on tinyagents main). No release (library-gitlink): pin vendor/tinyagents to that commit. Host-side deletion/adaptation for this leaf is still to do; see the PR body for the per-leaf summary.
senamakel commentedon Oct 14, 2026
Partially landed in #7773 (module: tinyhumansai/tinyagents#438). Done: turn_run_error delegates to harness. Remaining: turn_policy, turn_outcome, turn_run_finalize, response_shape, agent/tool_policy, projection module, cost regression test.
senamakel commentedon Oct 14, 2026
Module side merged: tinyagents#445 (merge a2bf2b0d). Pin vendor/tinyagents to a2bf2b0df6b70fbeed3bd171ff8f54521f94e496 (main). Host-side cutover/deletions still pending in OpenHuman.
senamakel commentedon Oct 14, 2026
Merged in #7787; module PR tinyhumansai/tinyagents#445. Deleted agent/error.rs, turn_stop.rs, response_shape (task-local gone), generic halves of turn_policy/outcome/finalize, cost types. Remaining: agent/turn_deadline.rs (close_budget), agent/tool_policy.rs migration to ToolCallPolicy (public seam), unify host TurnCost (needs tinyagents pricing injection).
senamakel commentedon Oct 14, 2026
Module slice merged: tinyhumansai/tinyagents#448 (merge c7bce17370b9d7425fec679cb331a93a5e362033 on tinyagents main) adds
TurnDeadline::close_budget+CLOSE_RESERVEwith a test. Host cutover NOT landed: any tinyagents main commit containing it also contains #446/#447 (artifacts offload moved to a tinystoragedrivers BlobStore:ArtifactOffload::new(blobs,..),with_render_rootremoved), so bumping vendor/tinyagents breaksagent/harness/artifact_offloadandsubagent_host/ops/runner.rsuntil the host supplies a BlobStore and materialises/exposes artifacts to file_read (storage work). Remaining after that pin bump: replaceturn_deadline::close_budget(&d, now)insession_host/driver.rswithd.close_budget(now)and delete agent/turn_deadline.rs (keep the env + task-local scope in a host-side file, e.g. session_host/turn_backstop.rs); migrate agent/tool_policy.rs to a harnessToolCallPolicy<Ctx>(does not exist in tinyagents yet, tinyagents change first, public seam); unify host TurnCost with harness one (needs tinyagents pricing injection); scripted-turn cost regression test.Merge pull request #7798 from senamakel/ta-final-7600
senamakel commentedon Oct 14, 2026
Slice landed: openhuman#7798 (a6462c1) with tinyagents#450 (c7a763b6); close_budget was tinyagents#448.
Done:
ArtifactOffloadruns over the acting tenant's blob store and the stored body is materialised under the parent's action root so the pointer path still opens withfile_read; the workspace-internal guard now checks the materialised target.agent/turn_deadline.rsdeleted;d.close_budget(now)from the harness; env override and task-local insession_host/turn_backstop.rs.agent/tool_policy.rsdeleted. Correction to the earlier note:ToolCallPolicy<Ctx>andPolicyDecisionalready existed in the harness (middleware/library/policy_gate.rs), so no upstream change was needed; the host uses them directly.TurnCostdeleted. The harnessTurnCostnow prices recorded responses through an injected lookup (TurnCost::with_pricing,impl StopHookMetrics,StopHookMiddleware::with_metrics_seed). The scripted four-call cost regression test now runs through that path with unchanged totals.Remaining on this leaf (not started):
tinyagents/turn_policy.rs,turn_outcome.rs,turn_run_error.rs,turn_run_finalize.rs.response_shape.rsmove and itstask_local!(Task 4).agent/turn_stop.rsinto harnessterminal.rs;agent/error.rshost-free errors;agent/cost.rscall_cost helpers (lookup stays).EarlyExitre-export in tinyagents-runtime,ExposureProbealias in harness tool tests) arrived with the [Bug] Release script never bumps root Cargo.toml — core binary reports stale version since v0.49.17 #449 pin and should be fixed upstream, then dropped.Merge pull request #7812 from senamakel/ta-rem-7600
senamakel commentedon Oct 14, 2026
Closed by openhuman#7812 with tinyagents#455 (616fc23c). Last items: EarlyExit re-export and ExposureProbe alias fixed upstream, baseline entries dropped. Everything else on the list landed earlier in #7773, #7787, #7798.