Skip to content

refactor(tinyagents): move tinyagents implementation into its module, wire [components] toggle (#7540) - #7773

Merged
senamakel merged 105 commits into
tinyhumansai:mainfrom
senamakel:tiny-dep-tinyagents-2
Oct 14, 2026
Merged

senamakel merged 105 commits into
tinyhumansai:mainfrom
senamakel:tiny-dep-tinyagents-2

Conversation

@senamakel

@senamakel senamakel commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves tinyagents implementation out of core into the tinyagents module (module PR tinyhumansai/tinyagents#438, merged a7c9d23c; follow-up tinyagents#441 merged 2e706e81; no release, gitlink pin only) and cuts OpenHuman over to thin host adapters. This PR is partial: the leaves below are done or in part.

Per-leaf

Part of #7540, Part of #7523, Part of #7740, Part of #7594 #7598 #7600 #7602 #7609 #7612 #7619 #7621 #7605 #7627 #7727. Closes #7616.

Verification

cargo check (workspace, app, modules-linked --features all), pnpm rust:layout, crate-chain, feature-forwarding, module-pins, agent-runtime-boundary all pass; clippy -D warnings clean. Vendor diff vs upstream/main is only vendor/tinyagents.

Failing tests (not blocking)

  • agent::harness::host_definition::tests::a_legacy_wildcard_table_tool_scope_still_loads_from_a_user_definition: needs tinyagents#441; re-pin blocked on storage Storage: tinyagents/host leftovers after driver-store migration #7688.
  • flows::...composio::tests::backend_dispatch_forwards_the_workflow_connection_id: flaky in parallel, passes alone.
  • channels::tests::runtime_dispatch::dispatch_replies_with_timeout_notice_when_handler_exceeds_deadline: tinychannels-module fixture blocked on tinybus 0.1.4.
  • cargo check --no-default-features -p openhuman fails at modules/mod.rs:305 (pre-existing on upstream/main).
  • Registry tests are not isolated from user-global $OPENHUMAN_HOME/agents (follow-up).

Auto-committed-on: dragonfly
Turns now enter a wind-down phase as their deadline approaches, so the agent can wrap up gracefully instead of being cut off mid-step. Budget and deadline guards share this logic, and the new tests cover the wind-down and turn-deadline paths.

Auto-committed-on: dragonfly
Reformat an over-long let binding in the default harness ceiling test so it
satisfies the line width limit. No behaviour change.

Auto-committed-on: dragonfly
Remove the pub(crate) re-export of SessionTurnSidecar from the host module since it is no longer referenced, keeping the module's exports limited to what is actually used.

Auto-committed-on: dragonfly
…E.md,crates/openhuman-core/src/

Auto-committed-on: dragonfly
Replace the struct update shorthand with explicit fields in the context
wiring test so the fixture no longer depends on Default and stays valid
as the outcome type evolves.

Auto-committed-on: dragonfly
The payload summarizer now builds its child run config through the
harness's summary_child_config helper instead of constructing it inline,
keeping the summarization limits consistent with the rest of the harness.

Auto-committed-on: dragonfly
Reformat the touched modules to satisfy rustfmt, wrapping long call
arguments and reordering use statements. No behaviour changes.

Auto-committed-on: dragonfly
The turn error mapping now calls the harness's classify_run_failure and
matches on RunFailureKind instead of inspecting error variants and message
text locally, so the ordering-sensitive classification lives in one place.
The depth-limit helper moved out of turn_models into the harness, and tests
cover the model-call cap and depth limit taking precedence over a stale
provider error.

Auto-committed-on: dragonfly
…the harness

The turn observer, its observation types, and the compaction log projection now
come from tinyagents-harness instead of living in openhuman-core, so the
embedding crate can depend on them directly. The langfuse feature forwards to
the harness feature, and the duplicated observer and cap-pauser test code is
dropped in favour of the harness implementations.

Auto-committed-on: dragonfly
…vability/cap_pauser.rs

Auto-committed-on: dragonfly
…ss_assembly.rs,crates/openhuman

Auto-committed-on: dragonfly
…ss_assembly/assembled.rs

Auto-committed-on: dragonfly
…vability/event_projection.rs

Auto-committed-on: dragonfly
…vability/event_bridge.rs

Auto-committed-on: dragonfly
…e_types

The observability submodule previously named cap_pauser now only holds the shared bridge types (SubagentScope and the usage/tool maps), since the cap pauser itself lives in tinyagents_harness::events. Renaming it to bridge_types keeps the module name aligned with its contents and updates the imports and README accordingly.

Auto-committed-on: dragonfly
Replaced fully qualified paths for CapPauser, PauseRecorder, and
turn_observer with direct imports, and condensed the comment explaining
why only the top-level turn's cap pause is binding on dispatch.

Auto-committed-on: dragonfly
Collapse the nested pause_at_cap check into a single let-binding and
tighten the accompanying comment. The behaviour is unchanged: the pause
is still recorded on the turn's dispatch guard to prevent a racing
sub-agent dispatch from taking down the turn.

Auto-committed-on: dragonfly
Shorten the comment explaining why the EventSink is created unconditionally, keeping the note that the bridge, cap pauser and durable journal subscribe to it and that it stays inert when nothing does.

Auto-committed-on: dragonfly
The dispatch guard that records a cap pause was being installed whenever
events and a handle were present, even when the turn had not actually
paused at its cap. It is now only installed when pause_at_cap is set, so
a delegated child reaching its own cap no longer stops the parent's
fan-out.

Auto-committed-on: dragonfly
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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 ⚠️ Failed 2026-10-14T01:21:58.724375Z cd40beb New commits
ℹ️ 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 13, 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: 21883985-7689-45a7-98a1-d5cc8d6d6f38
📥 Commits

Reviewing files that changed from the base of the PR and between 52902cd and 8d60510.

📒 Files selected for processing: 36
  • crates/openhuman-core/src/agent/context/channels_prompt.rs
  • crates/openhuman-core/src/agent/orchestration/agent_teams/runtime_tests.rs
  • crates/openhuman-core/src/agent/orchestration/ops_tests.rs
  • crates/openhuman-core/src/agent/orchestration/spawn_parallel.rs
  • crates/openhuman-core/src/agent/orchestration/tools/close_subagent_tests.rs
  • crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
  • crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
  • crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
  • crates/openhuman-core/src/agent/prompts/mod_tests.rs
  • crates/openhuman-core/src/agent/prompts/mod_tests_agents_md_registration_tests.rs
  • crates/openhuman-core/src/agent/prompts/mod_tests_builder_sections_tests.rs
  • crates/openhuman-core/src/agent/prompts/mod_tests_tools_sections_tests.rs
  • crates/openhuman-core/src/agent/prompts/render_helpers/section_renderers.rs
  • crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs
  • crates/openhuman-core/src/agent/prompts/sections.rs
  • crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/image_agent/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/loader_tests_builtin_registration_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/loader_tests_specialist_agents_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/morning_briefing/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs
  • crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/presentation_agent/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/task_manager_agent/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/video_agent/prompt_tests.rs
  • crates/openhuman-core/src/agent/session_host/builder/factory.rs
  • crates/openhuman-core/src/agent/session_host/runtime_session.rs
  • crates/openhuman-core/src/agent/tinyagents/host/context_composer.rs
  • crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs
  • crates/openhuman-core/src/agent/triage/evaluator/prompt.rs
  • crates/openhuman-core/src/flows/agents/flow_discovery/prompt_tests.rs
  • crates/openhuman-core/src/inference/http/backend.rs
  • crates/openhuman-core/src/storage/import/tinyflows_cron_tests.rs
  • crates/openhuman-embed/src/agent/layout.rs
  • scripts/ci/check-openhuman-rust-layout.mjs
  • tests/composio_list_tools_stack_overflow_regression.rs
 ________________________________________________________________
< I like what you did here. I don't like *that* you did it here. >
 ----------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8a6c7dd0-199f-4c14-91e0-33b34db9c3fb
📥 Commits

Reviewing files that changed from the base of the PR and between e1f9e0a and 52902cd.

⛔ 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: 53
  • crates/openhuman-core/src/agent/context/channels_prompt.rs
  • crates/openhuman-core/src/agent/harness/fork_context.rs
  • crates/openhuman-core/src/agent/orchestration/agent_teams/runtime_tests.rs
  • crates/openhuman-core/src/agent/orchestration/ops_tests.rs
  • crates/openhuman-core/src/agent/orchestration/parent_context/builder.rs
  • crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs
  • crates/openhuman-core/src/agent/orchestration/tools/close_subagent_tests.rs
  • crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
  • crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
  • crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread_tests.rs
  • crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
  • crates/openhuman-core/src/agent/prompts/mod_tests.rs
  • crates/openhuman-core/src/agent/prompts/mod_tests_agents_md_registration_tests.rs
  • crates/openhuman-core/src/agent/prompts/mod_tests_builder_sections_tests.rs
  • crates/openhuman-core/src/agent/prompts/mod_tests_subagent_render_tests.rs
  • crates/openhuman-core/src/agent/prompts/mod_tests_tools_sections_tests.rs
  • crates/openhuman-core/src/agent/prompts/render_helpers/section_renderers.rs
  • crates/openhuman-core/src/agent/prompts/render_helpers/subagent.rs
  • crates/openhuman-core/src/agent/prompts/sections.rs
  • crates/openhuman-core/src/agent/prompts/types.rs
  • crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/image_agent/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/loader_tests_builtin_registration_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/morning_briefing/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs
  • crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/presentation_agent/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/task_manager_agent/prompt_tests.rs
  • crates/openhuman-core/src/agent/registry/agents/video_agent/prompt_tests.rs
  • crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
  • crates/openhuman-core/src/agent/session_host/builder/dispatcher.rs
  • crates/openhuman-core/src/agent/session_host/builder/factory.rs
  • crates/openhuman-core/src/agent/session_host/builder/factory_provider_role_tests_tests.rs
  • crates/openhuman-core/src/agent/session_host/builder/mod.rs
  • crates/openhuman-core/src/agent/session_host/driver.rs
  • crates/openhuman-core/src/agent/session_host/runtime/accessors.rs
  • crates/openhuman-core/src/agent/session_host/runtime_session.rs
  • crates/openhuman-core/src/agent/session_host/turn/context.rs
  • crates/openhuman-core/src/agent/subagent_host/ops_tests.rs
  • crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
  • crates/openhuman-core/src/agent/subagent_host/tool_prep_tests.rs
  • crates/openhuman-core/src/agent/tinyagents/host/context_composer.rs
  • crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
  • crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs
  • crates/openhuman-core/src/agent/tools/todo_tests.rs
  • crates/openhuman-core/src/agent/triage/evaluator/prompt.rs
  • crates/openhuman-core/src/flows/agents/flow_discovery/prompt_tests.rs
  • crates/openhuman-core/src/tools/mod.rs
  • crates/openhuman-core/src/tools/policy_session.rs
  • crates/openhuman-core/src/tools/policy_session_tests.rs
  • scripts/ci/check-openhuman-rust-layout.mjs
  • tests/composio_list_tools_stack_overflow_regression.rs
  • tests/in_process/calendar_grounding_e2e.rs
💤 Files with no reviewable changes: 3
  • crates/openhuman-core/src/agent/session_host/builder/factory_provider_role_tests_tests.rs
  • crates/openhuman-core/src/agent/session_host/builder/dispatcher.rs
  • crates/openhuman-core/src/agent/session_host/builder/mod.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

Agent definitions, turn middleware, observability, deadlines, and parallel execution now use TinyAgents APIs. OpenHuman retains host-specific definition extensions and passes task-recency settings through run context. Transcript helpers are sourced from tinyagents-session.

Changes: TinyAgents ownership and runtime migration

Layer / File(s) Summary
Host definition contract and registry
crates/openhuman-core/src/agent/harness/*, crates/openhuman-core/src/agent/*, crates/openhuman-embed/src/agent/*
Host-specific fields and registry behavior reside in host_definition; portable definition types use tinyagents-definition. Definition consumers and fixtures use extension fields and updated type paths.
Turn middleware and observability
crates/openhuman-core/src/agent/tinyagents/*, crates/openhuman-core/src/agent/turn_deadline.rs, crates/openhuman-embed/src/observe.rs
Context-ladder wiring is added in context_wiring. The event bridge uses harness ordering and deduplication APIs. Deadline and observer integration now use harness APIs, and run-failure mapping uses classified failure kinds.
Parallel worker planning and execution
crates/openhuman-core/src/agent/orchestration/spawn_parallel*, crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents*
Staging uses orchestration Plan and Worker types. Worker execution and result collection delegate to shared orchestration APIs.
Task-recency and transcript helpers
crates/openhuman-core/src/agent/session_host/*, crates/openhuman-core/src/agent/tinyagents/host/run_context.rs, crates/openhuman-core/src/cron/scheduler/agent_run.rs, crates/openhuman-core/src/integrations/composio/*, crates/openhuman-core/src/agent/session_store/*, crates/openhuman-embed/src/agent/layout.rs
Session hosts pass task-recency settings through OpenHumanRunExt; morning-briefing runs set a 24-hour window. Transcript helper ownership moves to tinyagents-session.

Priority: ⬇️ Low

Estimated code review effort: 5 (Critical) | ~90 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SpawnParallelStaging
  participant Plan
  participant ParallelRun
  participant run_one_parallel_task
  SpawnParallelStaging->>Plan: stage tasks with admission policy
  Plan->>ParallelRun: provide prepared Worker envelopes
  ParallelRun->>run_one_parallel_task: execute workers with child run contexts
Loading
Merge Risk: 🟡 Moderate · up to 52902

The migration appears functionally consistent, and the channel prompt still carries the tool-call format. The PR author reports one failing test, and the new registry tests may be affected by user-installed definitions. Resolve or explicitly accept these before merging.

Security architecture risk: 🔵 Low · up to 52902

The reviewed paths preserve tenant admission and executable-tool restrictions. No introduced security weakness was demonstrated, but definition compatibility and some interruption behavior remain unresolved, preventing a minimal-risk assessment.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The reviewed spawn path can persist session state and execute detached work within the admitted caller’s workspace and profile scope. The inspected migration does not demonstrate an expansion to another tenant, service identity, or environment.

Security Findings and Attack Paths

  • observed — The selected unscoped-spawn test invokes production dispatch, which performs admission before session persistence or worker launch. This resolves the supplied production-dispatch proof gap for that refusal path; it is counterevidence to the proposed boundary bypass, not proof of all migration behavior.

Trust Boundaries and Controls

  • observed — The new host policy wrapper delegates to the same policy engine with unchanged authority inputs. Rebuilds retain handed-off-pack narrowing, and turns install both policy enforcement and definition-derived tool rules on the execution context. The residual direct engine call uses equivalent controls and does not establish widened authority.

Resilience and Maintainability Implications

  • inferred — Normal detached-worker outcomes and registration refusal settle durable session state. Concurrent reuse is not an atomic lookup-and-create operation, and hard-abort durable settlement remains unproven. These behaviors predate this PR in the inspected files; no new exposure was established, so they are not retained as active PR concerns.

Hardening Proposals

  • proposed — Validate legacy definitions at the actual dependency pin, including rejected same-ID overrides carrying deny rules or sandbox restrictions. Confirm that compatibility failures cannot silently replace intended restrictions with broader built-in behavior. This is a validation proposal, not an observed authorization failure.
Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 73.30% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 176 functions across 115 files. (1 skippe… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main TinyAgents host-adapter changes for wind-down, context-ladder, run-error, and event-sink handling. It omits the related agent-definition migration, but it remains…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 73.30% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 176 functions across 115 files. (1 skipped: 1 over the file limit.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit watched the agents hop,
As TinyAgents took each stop.
A context ladder rose with care,
And task windows traveled there.
Workers planned their branching run,
Then bounded paths returned as one.
The rabbit thumped, “Migration done!”

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

Tools now read the task recency window from an OpenHumanRunExt host
extension installed on the run context instead of per-value task-locals,
which do not cross module boundaries. A helper reads the window from the
explicit tool carrier, returning none for direct dispatch such as CLI,
JSON-RPC, or tests.

Auto-committed-on: dragonfly
The morning briefing cron job now sets a task recency window on the agent, which rides the run context into Composio task-fetch tools so Linear, ClickUp, Notion and Asana only surface recently touched tasks. The window is threaded through the run context instead of a task-local, and other cron agents and chat turns leave it unset.

Auto-committed-on: dragonfly
…ntext

The morning briefing no longer installs a task-local recency window around its turn; the window is now read from the run context via OpenHumanRunExt. The task_recency_context module and its tests are removed since the task-local carrier is no longer needed.

Auto-committed-on: dragonfly
Update the boundary baseline to match the current source layout, shifting
recorded line numbers and dropping entries for the removed task recency
context module. New upstream re-exports in observability and the embed
observer are now tracked.

Auto-committed-on: dragonfly
Dropped a leftover doc comment describing product-specific task recency
scoping that no longer applies to this module.

Auto-committed-on: dragonfly
Add a test asserting that a configured task recency window is exposed to
tools through the host extension rather than as a task local, and that
both an unset window and direct dispatch without a run context remain
unrestricted.

Auto-committed-on: dragonfly
The specialist agent test now reads omit_memory_context from the
presentation agent's extensions field, matching where the flag moved.

Auto-committed-on: dragonfly
Reformatted imports and wrapped a few long expressions across the agent
prompt, orchestration, and session host modules so the tree matches
rustfmt output. No behaviour changes.

Auto-committed-on: dragonfly
The layout check's legacy allowances for runtime_session.rs and the
session-host factory were bumped to match their current sizes, keeping the
exact-limit exceptions accurate after recent additions to those files.

Auto-committed-on: dragonfly
Replace the redundant `chat_model: chat_model` with field shorthand in the
HostChatBackend response. No behaviour change.

Auto-committed-on: dragonfly
Dropped a redundant map_err(Into::into) from the legacy cron jobs test, since the error type already converts without it.

Auto-committed-on: dragonfly
Task recency is now carried on `OpenHumanRunExt` in the tinyagents host run context rather than a Composio-owned module, so the harness and Composio READMEs were corrected to point at the new location. The event bridge doc comment was also rewritten to describe the harness `OrderedSender` behaviour, which tries a synchronous send first and spills to a bounded FIFO drain task under backpressure.

Auto-committed-on: dragonfly
The agent harness and memory docs now point at `context_wiring.rs` for the compression hooks and note that ladder order and sizing are owned by `ContextLadder` in `tinyagents-harness`, replacing the stale `harness_context_ladder.rs` paths.

Auto-committed-on: dragonfly
@senamakel senamakel changed the title refactor(tinyagents): host adapters over harness wind-down, context ladder, run-error and event sinks (#7594 #7598 #7600 #7602 partial) refactor(tinyagents): move tinyagents implementation into its module, wire [components] toggle (#7540) Oct 14, 2026
@senamakel
senamakel merged commit 0c71113 into tinyhumansai:main Oct 14, 2026
8 of 12 checks passed
This was referenced Oct 14, 2026
@tinysweeper

tinysweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

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

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.

[tiny-modules] tinyagents: move spawn_parallel_graph into tinyagents-orchestration (O6)

1 participant