Skip to content

refactor(harness-tools): move built-in tools into a dedicated crate - #497

Draft
senamakel wants to merge 156 commits into
tinyhumansai:mainfrom
senamakel:epic-8088-57-harness-tools
Draft

senamakel wants to merge 156 commits into
tinyhumansai:mainfrom
senamakel:epic-8088-57-harness-tools

Conversation

@senamakel

@senamakel senamakel commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Built-in tool families currently span the harness, orchestration, and graph crates. This moves their implementations into tinyagents-harness-tools, with features for todos, goals, skills, and subagents. The harness retains the shared tool snapshot and call-binding contracts; workspace callers, hooks, examples, documentation, and tests use the new owners.

The crate also provides per-call tool binding and goal preparation, observation, and synchronized accounting. Retired wait tools and goal continuation entry points are removed. The move preserves the existing control-tool policy, metadata, timeout, message routing, cancellation, and deadline-race regressions.

Consumers must depend on the new crate instead of enabling the removed harness builtin-tools/tools features. ToolSnapshot now lives at tinyagents_harness::tool::ToolSnapshot; no old-path re-export shims are retained.

This PR is stacked on #496. It remains a draft until that entry-tree removal lands. Then merge canonical main into this branch, rerun the affected checks, and mark it ready.

Validation:

  • Workspace all-target check and Clippy with -D warnings; workspace tests: 5,637 passed, zero failed, 35 existing ignores.
  • Harness-tools all-feature suite: 180 passed; feature-disabled all-target check and Clippy passed. The final test-only timeout assertion also passed its focused test.
  • Final manifests passed cargo machete crates, affected-crate all-target/all-feature check and Clippy, and library tests (graph: 429; harness-tools: 180).
  • Workspace all-features Rustdoc passed with broken intra-doc links treated as errors.
  • Regression-first evidence covers concurrent goal accounting and forwarding per-call host/presentation metadata. Independent review verified the retained 32 behavior contracts.

Refs senamakel#57. Part of tinyhumansai/openhuman#8088.

The expected schema list still contained ledger.entries and its head, index and label tables, which no longer exist. Removing them keeps the assertion aligned with the current schema.

Auto-committed-on: dragonfly
The opt-in entry tree API and its RunLedgerStore entry_* methods have been
dropped, leaving the linear transcript paths as the only conversation shape.
This removes the second, parallel ledger abstraction so the session crate
exposes a single history model.

Auto-committed-on: dragonfly
The entry tree collections and their driver implementations are no longer
needed, so the storage specs, migration steps, and RunLedgerStore methods
that backed them have been dropped. This trims the ledger surface to the
remaining event and tool-effect storage.

Auto-committed-on: dragonfly
The entry tree migration test was dropped along with its now-unused
Entry import, since the migration path it covered is no longer part of
the driver schema.

Auto-committed-on: dragonfly
The historical migration step for the conversation entry tree is now an
empty placeholder and the corresponding row readers were removed, since
the entry tree tables are no longer part of the classic schema. The
classic source check no longer treats entry_tree_entries as a known table.

Auto-committed-on: dragonfly
The legacy import tests no longer seed or verify the entry tree, so the
fixture and the assertions covering entry ids, ordinals and labels were
removed to match the current import surface.

Auto-committed-on: dragonfly
The legacy importer no longer reads or writes the entry-tree collections,
so the entries count and the loaded trees map are gone from the report
and the schema table no longer lists those tables.

Auto-committed-on: dragonfly
Add a regression test asserting that importing a classic database which
still contains retired entry-tree tables leaves those tables and their
rows untouched. The now-obsolete documentation describing the native
entry trees and their schema mapping was removed to match.

Auto-committed-on: dragonfly
Update crate and module documentation to drop mentions of the
conversation entry tree, which is no longer part of the storage ports.
The run ledger test no longer exercises entry tree import and index
rebuild, so its name and body were trimmed to match.

Auto-committed-on: dragonfly
Reworded the CompactionRecord and CompactionSink documentation to describe
persistence in terms of a host-provided store rather than the session crate's
EntryTree, since the harness cannot depend on tinyagents-session. The comments
now describe the coordinate system exposed to a host sink instead of naming a
specific session-backed implementation.

Auto-committed-on: dragonfly
The compaction and summarization docs no longer describe the session-backed
`SessionCompactionSink` implementation. The harness treats `CompactionSink` as a
generic trait with no prescribed persistence backend, so the docs now reflect
that a host may attach any implementation.

Auto-committed-on: dragonfly
…ion_sink.rs,crates/tinyagents-s

Auto-committed-on: dragonfly
Tool modules for goals, todos, skills, thread locks, time, plan exit, and
ask clarification now live in the dedicated tinyagents-harness-tools crate
instead of being split across tinyagents-harness and tinyagents-graph. This
consolidates tool code in one place so the harness and graph crates no longer
need to own it.

Auto-committed-on: dragonfly
The README listed entry trees among the data covered by the ledger API and
among the things retention does not prune. Entry trees are no longer part of
that scope, so both mentions were dropped to keep the documentation accurate.

Auto-committed-on: dragonfly
The native entry-tree slice documentation and its Mongo integration proof
are dropped, and the feature-gap entry for the conversation entry tree is
marked removed. The run context doc comment now describes persistence as a
host-provided trait object without naming the removed type.

Auto-committed-on: dragonfly
Phase 5 no longer lists EntryTree among the shipped pieces, leaving
compaction, the prepare_for_model handoff transform, the tool-effect
ledger, and Message::Custom as the completed work.

Auto-committed-on: dragonfly
…d types

The crate referenced its own module paths for types that actually live in
tinyagents_harness, so the imports now point at the real crate. The crate is
also added to the workspace default members and a time_parse test module is
registered.

Auto-committed-on: dragonfly
Reword the comparison notes so the linear TinyAgents transcript is
distinguished from pi's conversation entry tree, and attribute the two
coexisting pi session designs to pi rather than to TinyAgents. Also
generalize the compaction sink doc comment to describe a host-provided
store rather than a session entry tree.

Auto-committed-on: dragonfly
The lock map and its constructor and accessor are now public so
downstream crates can share per-thread locks. Documentation comments
were also updated to drop stale references to the removed goal
continuation module.

Auto-committed-on: dragonfly
Test modules now reference types through the tinyagents_harness crate
rather than the local crate root, and the ask_clarification and plan_exit
test modules are no longer registered. This aligns the tests with the
relocated tool and context types.

Auto-committed-on: dragonfly
The per-thread lock helper is now a dedicated execution_locks module
with a RunLockMap type, replacing the previous ThreadLockMap and its
constructor argument. The goals and todos modules and their re-exports
were dropped from the crate root.

Auto-committed-on: dragonfly
…uation.rs,crates/tinyagents-har

Auto-committed-on: dragonfly
Drops the `continuation_suppressed` field and the `GoalProgress` and
`TurnOutcome` re-exports, since goal continuation is now driven by the
host's turn lifecycle rather than an out-of-band heartbeat.

Auto-committed-on: dragonfly
The continuation_suppressed field and its compare-and-set helper are no longer needed, so the field and the set_continuation_suppressed_if function have been removed along with the test covering their behaviour.

Auto-committed-on: dragonfly
Dropped the unused Message and json imports from the run ledger driver
modules to keep the build warning-free.

Auto-committed-on: dragonfly
Introduce a per-call module that records tool invocations so each call
can be tracked and inspected independently. Tests cover the new
tracking behaviour.

Auto-committed-on: dragonfly
… docs

Corrected the module documentation so the parenthetical listing the contents of the SQLite database closes properly and the transcript and snapshot paths read as separate items rather than being nested inside it.

Auto-committed-on: dragonfly
Introduce a goal runtime and observer layer that prepares turns and
charges token and elapsed-time usage under a per-thread lock, so
concurrent turns cannot lose usage or report the same budget transition
twice. Elapsed time now tracks sub-second precision while keeping the
legacy whole-second field intact.

Auto-committed-on: dragonfly
…cascade

Adds a case asserting that a fixed query alias rejects a null configured
identifier with an error naming the field. Also switches the cancel tool
setup to use the identifier field helper and adds a test verifying that
cancelling the parent run settles a running background driver job as
cancelled.

Auto-committed-on: dragonfly
The file contained two identical copies of the parent cancellation cascade test, so the redundant copy was dropped to keep the suite free of duplicate coverage.

Auto-committed-on: dragonfly
The driver tool test now captures the child run's cancellation token and
asserts it is cancelled after the parent is cancelled. This verifies that
cancellation actually propagates to the child context rather than only
terminating the driver job.

Auto-committed-on: dragonfly
The blocking test executor now races its release permit against the
execution's cancellation signal, returning SubagentError::Cancelled when
cancellation fires first. This lets tests exercise cancellation of
subagent executions that would otherwise block indefinitely.

Auto-committed-on: dragonfly
Adds a regression test asserting that cancelling one driver job leaves its
sibling running and able to complete. The remaining edits are formatting
and whitespace cleanup in the affected test modules.

Auto-committed-on: dragonfly
The assertion in the driver alias test now prints the unexpected terminal error when it fails, making debugging easier without changing the test's behaviour.

Auto-committed-on: dragonfly
The driver alias end-to-end test now attaches the owner scope to the
terminal message so the scoped job is exercised under the same owner as
the rest of the flow.

Auto-committed-on: dragonfly
The recoverable selector denial check was duplicated across the cancel and
message dispatch paths, so it now lives in a shared selector_error helper.
Tests were updated to exercise the registry cancellation API directly and to
drop a redundant registry failure test.

Auto-committed-on: dragonfly
Extend the subagent tests to exercise selector retries for terminal and
cancelling denials, and verify that a poisoned detached registry surfaces
typed registry errors across all job control operations. A test-only clone
hook on the job metadata makes the poisoning reproducible.

Auto-committed-on: dragonfly
Move the panic trigger reset out of the caught closure so it runs even
when the intentional panic unwinds, preventing the flag from leaking into
later assertions or awaits on the same worker.

Auto-committed-on: dragonfly
Adds a test asserting that a pinned pack call merges the outer tool's
approval requirement while the selected tool's own policy stays unclassified,
and that a canonical shared adapter forwards the tool call binding so the
selected pack target and effective args survive dispatch.

Auto-committed-on: dragonfly
…iver_tool_tests.rs

Auto-committed-on: dragonfly
…eadline

Adds a regression test for the bounded await path where the child job
reaches a terminal state after the wait deadline but before the same
future is polled again. Also applies rustfmt formatting to the affected
test modules.

Auto-committed-on: dragonfly
Assert that an await tool without a configured timeout field falls back to the shared inherited timeout policy, covering the default branch that the existing clamping test did not exercise.

Auto-committed-on: dragonfly
Update the workspace docs to cover the new tinyagents-harness-tools
package, describing its reusable tool implementations and feature flags.
Also refresh the crate list in the spec README and fix relative wiki
links in the graph goals and todos notes.

Auto-committed-on: dragonfly
Document the crate's purpose and usage so the harness tools are easier to discover and integrate.

Auto-committed-on: dragonfly
Added links to the tinyagents-harness-tools crate README from the top-level README and the spec index so the crate guide is reachable from the main documentation entry points.

Auto-committed-on: dragonfly
Reworded the subagent orchestration section to describe the `subagents`
feature as exposing the `tinyagents_harness_tools::subagents` module rather
than naming the module path directly. This makes the feature-to-module
relationship clearer for readers.

Auto-committed-on: dragonfly
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

The doc comments on the subagent job registry and role constants now refer
to the feature-gated tools in the tinyagents-harness-tools crate by name
instead of using intra-doc links. This avoids broken links when the
optional dependency is not enabled.

Auto-committed-on: dragonfly
The module documentation referenced `super::discover`, which no longer resolves since the discover module lives in tinyagents_harness. Point the link at the fully qualified path so the doc comment stays accurate.

Auto-committed-on: dragonfly
Removed the anyhow dependency from tinyagents-graph and the uuid
dependency from tinyagents-harness-tools, as neither crate references
them anymore.

Auto-committed-on: dragonfly

This branch has not been deployed

No deployments
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