Skip to content

refactor(threads): move transcript view, session import and turn-state store into tinyagents-session - #6793

Merged
senamakel merged 20 commits into
tinyhumansai:mainfrom
senamakel:vendor-extract-w2-session
Sep 30, 2026
Merged

senamakel merged 20 commits into
tinyhumansai:mainfrom
senamakel:vendor-extract-w2-session

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

Wave 2: move three pieces of session code that aren't product-specific into tinyagents-session: the transcript view, the legacy session importer, and the turn-state store.

Stacked on #6789 (→ #6786 → #6785 → #6781). The base is main because upstream branch creation is restricted.

Upstream: tinyagents#233, stacked on #230. On-disk and wire formats are unchanged. New literal-JSON fixtures pin TurnState, JournalMessage, ItemLedgerRecord and the sha256 ledger key.

Transcript view → tinyagents_session::transcript::view

  • threads/transcript_view/ is deleted (4,040 lines).
  • TOOL_RESULT_FAILURES_METADATA_KEY is now upstream, with its value "openhuman_tool_failures" unchanged. The writer (session_host/codec.rs) imports it from there.
  • project_thread and project_records are now public.
  • Tests: 25 view tests moved upstream. The host-coupled ones stay in threads/transcript_host_tests.rs: the codec-driven tool rounds and the round trip.

Legacy session importer → tinyagents_session::transcript::import

  • The seam is JournalProjector = fn(TranscriptMessage) -> JournalMessage. The OpenHuman projector (session_import/projector.rs) still goes through chat_message_from_transcript, so journal contents are byte-identical.
  • Stays in OpenHuman: the dual-write and shadow-read decision, the env kill switches, the controller (schemas.rs), live.rs, and live_tests.rs. The upstream live module only does the work.
  • Store opening: open_session_stores is now a public upstream constructor. journal, todos, reaper, replay/ops and goals/store import it from there.
  • session_import shrinks from 2,712 to 905 lines.

Turn state → tinyagents_session::turn_state::{store, types}

  • The on-disk layout memory/conversations/turn_states/... and the [threads:turn_state] log prefix are unchanged.
  • Stays in OpenHuman:
    • mirror/*, the AgentProgress projection adapter;
    • rpc_types.rs, which includes From<&ClassifiedFailure> for PersistedToolFailure;
    • ClassifiedFailure.
  • Call sites import tinyagents_session::turn_state directly. The boundary check forbids re-exports.
  • turn_state shrinks from 3,966 to 2,337 lines.

Verification

  • Compile: cargo check --tests -p openhuman -p openhuman-cli --features "$(bash scripts/ci/product-features.sh)" passes. The app manifest and openhuman-embed/openhuman-tinyhumans --tests also compile.

  • Lib suite: the full suite with the product features gives 10311 passed and 1 failed. The failure is the known connected_integrations_cache_is_keyed_per_credential, which fails the same way on the base (see refactor(core): move time/goals tools, conversation store and composio execute into vendor crates #6785).

  • JSON-RPC e2e: scripts/test-rust-with-mock.sh --test json_rpc_e2e json_rpc_thread gives 11/11. It covers transcript get/paginate, turn-state lifecycle, edit/regenerate truncation, goals/todos, labels and titles.

  • Transcript search: transcript_search_e2e gives 3/3.

  • Vendor: tinyagents-session passes 228 unit and 2 integration tests, with fmt and clippy -D warnings clean.

  • CI scripts: these pass:

    • rust:layout
    • check-agent-runtime-boundary
    • check-feature-forwarding
    • check-gated-test-allowlist
    • check-submodule-monotonic upstream/main HEAD (9 pins forward)

    check-module-pins fails on tinywallet and tinychannels, both from test: drop 45 quarantined raw-coverage files, dedupe vendor-covered tests, repoint vendor pins #6781.

Merge order

tinyagents #228 → #229 → #230 → #233, then this PR after #6789.

senamakel and others added 18 commits September 30, 2026 09:21
Adds the tinyagents library as a vendored dependency to support agent-based workflows in the project. This change introduces the external package directly into the repository to ensure consistent builds and avoid runtime resolution issues.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Extracted the transcript view subsystem from the threads module into its own submodule, moving related types, caching, resolution, and subagent logic into a focused directory. This improves code organization and makes the boundaries of the transcript view clearer for future development.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The live dual-write function `write_live_turn` and the shadow-read comparison logic have been removed as they are no longer needed. The TinyAgents submodule is updated to reflect the corresponding dependency changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When the session import file does not exist, the agent now returns an appropriate error instead of panicking. This ensures that missing or incomplete session data is handled without crashing the runtime.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…rojection support

Introduce a new session import subsystem that provides scanning, conversion, and projection capabilities for importing external session data into the OpenHuman core. The module includes type definitions, schema handling, and operations to transform raw session data into the internal representation, enabling flexible ingestion from various external sources.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The session import live tests now properly handle the store initialization by awaiting the store creation before proceeding with test assertions. The replay operations have been updated to correctly process agent journal entries, ensuring that replayed sessions maintain proper state transitions. The reaper and todos modules now use consistent error handling patterns when interacting with the goal store, preventing potential panics during session cleanup and task management workflows.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Return an error instead of panicking when the runtime session is not found during agent execution, ensuring the system remains stable and provides a clear diagnostic message to the caller.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the vendored tinyagents submodule to a newer commit, incorporating upstream changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Removed the filesystem-backed `TurnStateStore` and its associated types, replacing them with a new `rpc_types` module that exposes only the request and response types needed for RPC communication. The store implementation, tests, and internal types were deleted because the turn state persistence is now handled externally, leaving the crate with just the public API types for serialization.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
… paths

Update the turn state mirror module to import types and store from the tinyagents_session crate instead of using relative super paths, aligning with the ongoing extraction of session logic into a shared library.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…on crate

Migrate all usages of the local `crate::threads::turn_state` module to the extracted `tinyagents_session` crate, covering turn state store operations, lifecycle types, and test imports. This change consolidates the turn state management into a shared library for reuse across projects.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The purge operation now returns an error when attempting to purge a thread that does not exist, rather than silently succeeding. This makes the behaviour consistent with other thread operations and prevents accidental data loss from misdirected purge calls.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Added the `turn_state` module from `tinyagents_session` to the turn state operations, enabling proper handling of persisted in-flight turn snapshots for threads. Also introduced several new dependencies including `glob`, `hex`, `parking_lot`, `sha2`, `tempfile`, and `tinytools-agent` to support the underlying storage and hashing infrastructure required for this feature.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The session_import module now only hosts the OpenHuman-specific controller, config flags, and projector, while the core scan, convert, and ops logic has been moved to tinyagents_session::transcript::import. The README and module docs are updated to reflect this split, and the live module is made private.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Removed an extra backtick in the doc comment for `AgentConfig` that was causing the inline code formatting for the `tinyagents_session::transcript::import::convert` path to render incorrectly.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test file imported `turn_state` from `tinyagents_session` but only used `TurnState`, so the module-level import was unnecessary. This change removes the unused import to keep the code clean and avoid compiler warnings. The vendor submodule is also updated to its latest commit.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The `live` submodule in `session_import` is now public, allowing external consumers to access its functionality. New dependencies for glob, hex, parking_lot, sha2, tempfile, and tinytools-agent were added to support the module's expanded capabilities.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the pinned commit for the tinyagents vendored dependency to incorporate upstream changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 269e3da7-8949-4f4b-9bbd-d3ad72822624

📥 Commits

Reviewing files that changed from the base of the PR and between 8b293fa and 3be9684.

⛔ 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 (60)
  • crates/openhuman-core/src/agent/goals/store.rs
  • crates/openhuman-core/src/agent/messages.rs
  • crates/openhuman-core/src/agent/session_host/codec.rs
  • crates/openhuman-core/src/agent/session_host/runtime_session.rs
  • crates/openhuman-core/src/agent/session_import/README.md
  • crates/openhuman-core/src/agent/session_import/convert.rs
  • crates/openhuman-core/src/agent/session_import/convert_tests.rs
  • crates/openhuman-core/src/agent/session_import/live.rs
  • crates/openhuman-core/src/agent/session_import/live_tests.rs
  • crates/openhuman-core/src/agent/session_import/mod.rs
  • crates/openhuman-core/src/agent/session_import/ops.rs
  • crates/openhuman-core/src/agent/session_import/ops_tests.rs
  • crates/openhuman-core/src/agent/session_import/projector.rs
  • crates/openhuman-core/src/agent/session_import/scan.rs
  • crates/openhuman-core/src/agent/session_import/schemas.rs
  • crates/openhuman-core/src/agent/session_import/types.rs
  • crates/openhuman-core/src/agent/tinyagents/journal.rs
  • crates/openhuman-core/src/agent/tinyagents/reaper.rs
  • crates/openhuman-core/src/agent/tinyagents/replay/ops.rs
  • crates/openhuman-core/src/agent/tinyagents/todos.rs
  • crates/openhuman-core/src/config/schema/agent.rs
  • crates/openhuman-core/src/core/runtime/bootstrap.rs
  • crates/openhuman-core/src/flows/ops/streaming.rs
  • crates/openhuman-core/src/threads/README.md
  • crates/openhuman-core/src/threads/mod.rs
  • crates/openhuman-core/src/threads/ops/crud.rs
  • crates/openhuman-core/src/threads/ops/edit.rs
  • crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
  • crates/openhuman-core/src/threads/ops/purge.rs
  • crates/openhuman-core/src/threads/ops/transcript.rs
  • crates/openhuman-core/src/threads/ops/turn_state_ops.rs
  • crates/openhuman-core/src/threads/ops_conversion_tests.rs
  • crates/openhuman-core/src/threads/ops_tests.rs
  • crates/openhuman-core/src/threads/transcript_host_tests.rs
  • crates/openhuman-core/src/threads/transcript_view/cache.rs
  • crates/openhuman-core/src/threads/transcript_view/cache_tests.rs
  • crates/openhuman-core/src/threads/transcript_view/mod.rs
  • crates/openhuman-core/src/threads/transcript_view/project.rs
  • crates/openhuman-core/src/threads/transcript_view/prompt_tools.rs
  • crates/openhuman-core/src/threads/transcript_view/prompt_tools_tests.rs
  • crates/openhuman-core/src/threads/transcript_view/resolve.rs
  • crates/openhuman-core/src/threads/transcript_view/subagents.rs
  • crates/openhuman-core/src/threads/transcript_view/transcript_ordering_tests.rs
  • crates/openhuman-core/src/threads/transcript_view/transcript_subagent_anchor_tests.rs
  • crates/openhuman-core/src/threads/transcript_view/transcript_view_subagent_tests.rs
  • crates/openhuman-core/src/threads/transcript_view/transcript_view_tests.rs
  • crates/openhuman-core/src/threads/transcript_view/types.rs
  • crates/openhuman-core/src/threads/turn_state/mirror.rs
  • crates/openhuman-core/src/threads/turn_state/mirror/lifecycle.rs
  • crates/openhuman-core/src/threads/turn_state/mirror/observe.rs
  • crates/openhuman-core/src/threads/turn_state/mirror/state.rs
  • crates/openhuman-core/src/threads/turn_state/mod.rs
  • crates/openhuman-core/src/threads/turn_state/rpc_types.rs
  • crates/openhuman-core/src/threads/turn_state/store.rs
  • crates/openhuman-core/src/threads/turn_state/store_tests.rs
  • crates/openhuman-core/src/threads/turn_state/types.rs
  • crates/openhuman-core/src/web_chat/progress_bridge.rs
  • crates/openhuman-core/src/web_chat/run_task.rs
  • tests/json_rpc_e2e.rs
  • vendor/tinyagents
 ______________________________________________
< Regex can do anything... badly. Let me help. >
 ----------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

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

@tinysweeper

tinysweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

⚠️ Review failed for 039d27ec0bd0. pull request exceeds review limits: 354 changed files (limit 500), 71442 changed lines (limit 50000)

senamakel and others added 2 commits September 30, 2026 10:29
Pin tinyagents at the session tip merged with main (oh-stack-6793).

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel merged commit d4c9fd0 into tinyhumansai:main Sep 30, 2026
25 of 28 checks passed
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