Skip to content

refactor(agent): pin tinyagents main; harness close_budget, TurnCost and ToolCallPolicy (#7600) - #7798

Merged
senamakel merged 24 commits into
tinyhumansai:mainfrom
senamakel:ta-final-7600
Oct 14, 2026
Merged

senamakel merged 24 commits into
tinyhumansai:mainfrom
senamakel:ta-final-7600

Conversation

@senamakel

Copy link
Copy Markdown
Member

Slice of #7600 (epic #7540). Module PR: tinyhumansai/tinyagents#450 (merged, c7a763b6); close_budget landed in tinyagents#448.

What changed

Tests

  • Scripted four-call turn totals (2 charged, 1 catalogue estimate, 1 free route) now run through the real StopHookMetrics path and are unchanged.
  • Artifact: pointer path opens from the action root, redaction reaches the blob store, action_dir inside workspace_dir is refused and nothing is written, failed materialisation keeps the inline payload.
  • Existing turn_backstop, host-only policy, attachments policy suites ported. 1127 core lib tests in the affected areas pass; embed lib and usage/runtime tests pass.

Gates

cargo check (default, product features, --no-default-features -p openhuman), app manifest check, openhuman-core build, pnpm rust:layout, agent-runtime boundary, submodule monotonic.

Not in this PR (stays open on #7600)

turn_policy, turn_outcome, turn_run_error, turn_run_finalize, response_shape (task-local), turn_stop, error.rs moves. The boundary baseline gained 2 vendor entries that arrive with the #449 pin (EarlyExit re-export, ExposureProbe); no baseline entry mapped to the removed files.

senamakel and others added 24 commits October 14, 2026 09:07
Bumped the tinystoragedrivers crates to 0.11.0 and advanced the vendored
tinyagents submodule to its latest commit. The lockfile also picks up
transitive dependency adjustments that follow from these updates.

Auto-committed-on: dragonfly
The session store now records the workspace associated with a session so
that it can be restored when the session is resumed. This keeps workspace
context available across restarts instead of relying on the caller to
supply it again.

Auto-committed-on: dragonfly
Tool results that exceed the inline size budget are now written to
artifact storage and replaced with a compact reference, keeping
conversation context small without losing the underlying data. The
subagent runner resolves these references when replaying results.

Auto-committed-on: dragonfly
…on is empty, and the stat is

Could you paste the diff (or at least the stat and the relevant hunks) for `artifact_offload_tests.rs`? Once I can see the `+`/`-` lines I'll write the Conventional Commits message.

Auto-committed-on: dragonfly
Turns can now be bounded by a deadline and a backstop so a session that
stops making progress is detected and ended instead of hanging. The
backstop and deadline logic live in their own modules with tests covering
the expiry paths.

Auto-committed-on: dragonfly
Introduce turn guard checks in the session host driver and runtime session turn so web chat turns can be validated before execution. This prevents overlapping or invalid turns from being processed and adds tests covering the new guard behaviour.

Auto-committed-on: dragonfly
The doc comment pointed at `turn_deadline_tests.rs`, which no longer holds the backstop ordering tests, so it now references `turn_backstop_tests.rs`.

Auto-committed-on: dragonfly
Turn cost accumulation now lives in tinyagents_harness, which owns the
pricing-aware TurnCost and records model usage itself, so the host only
seeds the accumulator with the product catalog. This removes the local
TurnCost type and its StopHookMetrics impl, and the vendored tinyagents
submodule is bumped to the revision that provides them.

Auto-committed-on: dragonfly
Introduce a runtime adapter that drives session turns through the
session host, wiring the turn lifecycle into the runtime session API.
Tests cover the adapter's turn handling.

Auto-committed-on: dragonfly
Introduce a session host builder that assembles runtime sessions from
host-only and host-tools configurations, along with a tool policy module
that governs which tools a turn may invoke. This separates session
construction from execution so hosts can be composed and tested
independently.

Auto-committed-on: dragonfly
Introduce a tool policy middleware that is wired into the tinyagents harness during assembly, allowing tool calls to be filtered or gated before execution. The live harness and session host builder were updated to construct and pass the middleware through, with tests covering the policy behaviour.

Auto-committed-on: dragonfly
Introduce a turn policy layer in the tinyagents middleware and wire it into
the session host so live tool calls and runtime sessions share consistent
per-turn behaviour. This centralises turn handling that was previously
duplicated across the session host paths.

Auto-committed-on: dragonfly
Embedded agent sessions can now carry file attachments through to the
runtime session host. This lets callers pass attachments when starting a
session instead of only supplying plain text input.

Auto-committed-on: dragonfly
Update the host-only and attachment policy tests to use the new
RunContext and ToolCall based policy interface, replacing the removed
ToolPolicyRequest and ToolPolicyDecision types. The attachments module
also picks up import reordering and rustfmt line wrapping with no
behaviour change.

Auto-committed-on: dragonfly
…pty, and the stat is blank to

Could you paste the diff (or at least the stat and a summary of what changed in `crates/openhuman-core/src/agent/cost_tests.rs`)? Once I have that, I'll produce the Conventional Commits message.

Auto-committed-on: dragonfly
The host-only gate test referenced a policy binding that no longer
exists, so the assertions now read the policy from the built agent and
the inline blocks were reformatted for readability.

Auto-committed-on: dragonfly
Adds unit tests covering cost accounting, artifact offload behaviour, and
middleware tool policy so these paths are exercised by the suite.

Auto-committed-on: dragonfly
The goal runtime tests now build turn costs through the shared cost helpers so
priced calls are recorded consistently. The tool policy test drops the removed
session argument from the middleware constructor.

Auto-committed-on: dragonfly
…rkspace state

The blob key is relative, so the crate's path policy cannot see where the
reader's copy will land; offload_oversized_result now takes the security
policy and keeps the inline result when the resolved target would reach
core state. Tests were updated to cover the fail-closed path end to end.

Auto-committed-on: dragonfly
Re-export PolicyDecision and ToolCallPolicy from the embed seams so hosts can
supply a tool-call policy to HostTools::with_policy. The runtime boundary check
now allowlists these exports along with the TurnCost stop-hook metrics type.

Auto-committed-on: dragonfly
Update the boundary baseline to match current line numbers and add newly
detected moved-symbol aliases and upstream re-exports so the CI check
stays in sync with the code.

Auto-committed-on: dragonfly
…se_budget)

Co-authored-by: Medulla <medulla@tinyhumans.ai>
Move the tenant blob-store lookup and oversized-output offload out of the
sub-agent runner into a reusable `offload_run_result` helper in the artifact
offload module, so other callers can offload a finished run's output the same
way. The runner now delegates to it, and the layout budget entries shrink to
match the reduced line counts.

Auto-committed-on: dragonfly
Update the lockfile to resolve windows-sys to 0.61.2 across the dependency
graph and bump the tinystoragedrivers crates to 0.11.0. Also allowlist the
artifact offload module in the storage-bypass check, since its JSON write is
a derived view of a blob-stored artifact rather than a source of truth.

Auto-committed-on: dragonfly
@tinysweeper

tinysweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

⚠️ Review failed for d4f9678dd1c8. the review of #7798 did not finish within 900s

@senamakel
senamakel merged commit a6462c1 into tinyhumansai:main Oct 14, 2026
6 of 8 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T07:00:51.991585Z d4f9678 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1a8bcd16-a5cd-4ef5-9d4f-eed31a9cd846
📥 Commits

Reviewing files that changed from the base of the PR and between e452a41 and d4f9678.

⛔ Files ignored due to path filters: 2
  • Cargo.lock is excluded by !**/*.lock
  • crates/openhuman-app/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing: 51
  • crates/openhuman-core/src/agent/cost.rs
  • crates/openhuman-core/src/agent/cost_tests.rs
  • crates/openhuman-core/src/agent/goals/runtime.rs
  • crates/openhuman-core/src/agent/goals/runtime_tests.rs
  • crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests.rs
  • crates/openhuman-core/src/agent/harness/artifact_offload/mod.rs
  • crates/openhuman-core/src/agent/hooks_scope.rs
  • crates/openhuman-core/src/agent/mod.rs
  • crates/openhuman-core/src/agent/progress.rs
  • crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
  • crates/openhuman-core/src/agent/session_host/builder/builder_tests_host_only_tests.rs
  • crates/openhuman-core/src/agent/session_host/builder/host_only.rs
  • crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
  • crates/openhuman-core/src/agent/session_host/builder/setters.rs
  • crates/openhuman-core/src/agent/session_host/driver.rs
  • crates/openhuman-core/src/agent/session_host/live_tools.rs
  • crates/openhuman-core/src/agent/session_host/mod.rs
  • crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs
  • crates/openhuman-core/src/agent/session_host/runtime_session.rs
  • crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs
  • crates/openhuman-core/src/agent/session_host/session_api.rs
  • crates/openhuman-core/src/agent/session_host/tool_progress.rs
  • crates/openhuman-core/src/agent/session_host/turn_backstop.rs
  • crates/openhuman-core/src/agent/session_host/turn_backstop_tests.rs
  • crates/openhuman-core/src/agent/session_host/types.rs
  • crates/openhuman-core/src/agent/session_store/mod.rs
  • crates/openhuman-core/src/agent/session_store/workspace.rs
  • crates/openhuman-core/src/agent/stop_hooks.rs
  • crates/openhuman-core/src/agent/stop_hooks_tests.rs
  • crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
  • crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
  • crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
  • crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
  • crates/openhuman-core/src/agent/tinyagents/live_harness.rs
  • crates/openhuman-core/src/agent/tinyagents/middleware.rs
  • crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
  • crates/openhuman-core/src/agent/tinyagents/middleware_tool_policy_tests.rs
  • crates/openhuman-core/src/agent/tinyagents/stop_hooks.rs
  • crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
  • crates/openhuman-core/src/agent/tool_policy.rs
  • crates/openhuman-core/src/agent/tool_policy_tests.rs
  • crates/openhuman-core/src/web_chat/ops/turn_guards.rs
  • crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs
  • crates/openhuman-embed/src/agent/attachments.rs
  • crates/openhuman-embed/src/agent/attachments_tests.rs
  • crates/openhuman-embed/src/lib.rs
  • scripts/ci/agent-runtime-boundary-baseline.json
  • scripts/ci/check-agent-runtime-boundary.mjs
  • scripts/ci/check-openhuman-rust-layout.mjs
  • scripts/ci/check-storage-bypass.mjs
  • vendor/tinyagents
 _________________________________________________________________
< This is Sparta! And I'm here to kick bugs into the pit of doom. >
 -----------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant