Skip to content

refactor(agent): pin tinyagents main and migrate host to TurnStates - #7763

Merged
senamakel merged 28 commits into
tinyhumansai:mainfrom
senamakel:tinyagents-main-pin
Oct 13, 2026
Merged

senamakel merged 28 commits into
tinyhumansai:mainfrom
senamakel:tinyagents-main-pin

Conversation

@senamakel

Copy link
Copy Markdown
Member

Part of #7540, #7523
Refs #7688, #7522, #7727
Closes #7632

What

  • Pins vendor/tinyagents to tinyagents main 6d8a9196 (contains feat(refer) : Implement referral system with UI components and API integration #430, [Prompt] Agent prompt improvement #434, Fix: telegram replies #436, the tinystoragedrivers v0.8.0 bump #433, and tinyagents#437 below). Keeps tinystoragedrivers at v0.8.0 and the root [patch] tables pointing at the tinyagents copy.
  • tinyagents#437 (merged, 6d8a9196): main already had tsd 0.8.0 (#433), so the planned merge of tsd-0.8.0-on-oh-pin-7655 was a no-op. The remaining gap was main's vendored tinyinference, which still named tsd by git tag v0.7.0 and split the SecretStore/DocumentStore types. feat(subconscious): stabilize heartbeat + subconscious loop (#392) #437 bumps tinyinference to its main (tsd v0.8.0) and patches the git deps onto the vendored path so --locked passes on Windows.
  • Migrates the host from turn_state::store / TurnStateStore / AttachmentStash to the TurnStates port and BlobAttachmentStash:
    • agent::session_store gains turn_states_for (calling tenant), default_turn_states_for (boot/recovery sweeps) and attachment_stash_for. All resolve through the installed provider, else the workspace default backend, so a session store / storage-URL install supplies the port and a classic workspace gets a DriverSessionStores over its sqlite backend.
    • web_chat (run_task, progress_bridge), flows streaming, threads ops (turn_state_*, delete, purge, edit truncation), profiles recovery and core runtime bootstrap take the port. The truncation helper resolves the store before spawn_blocking because the tenant is task-local.
    • Attachments: stash_image_attachments writes to the blob stash (no cap, no expiry, as before). rehydrate_image_placeholders is now async: it returns the stashed bytes as an inline data: URI and falls back to legacy <id>.<ext> sidecars in <workspace>/attachments for conversations written before the move.
  • Deletes the SharedChatModel wrapper in inference/http/backend.rs (ResolvedChat holds an Arc now).

Behaviour kept

A resumed thread's turn state and its attachments survive a restart: they are in the storage backend, not process memory. Legacy turn_states/ files are still imported by the storage domain (storage::import::sessions); the cold-boot sweep marks leftover non-terminal snapshots interrupted.

Tests added or changed

  • agent::session_store: a_threads_turn_state_survives_a_restart_of_the_workspace_store, a_stashed_attachment_survives_a_restart_of_the_workspace_store (drop every cached handle/backend, then read back; sweep persists).
  • agent::multimodal: stash -> rehydrate -> provider round trip now asserts an inline data URI; legacy_sidecar_files_stay_indexed_by_id.
  • threads purge test now asserts the store is empty (the corrupted-file case no longer exists); the legacy fixture for the sessions import writes the classic file layout directly; edit/profile/progress-bridge/mirror tests use the port.

Verification

  • cargo check --manifest-path Cargo.toml (default), -p openhuman-cli --features "$(scripts/ci/product-features.sh)", -p openhuman --no-default-features, --workspace --tests: pass
  • cargo check --manifest-path crates/openhuman-app/Cargo.toml, cargo build -p openhuman-cli --bin openhuman-core: pass
  • cargo test -p openhuman --lib (RUST_MIN_STACK=16777216) for web_chat (253), flows (574), profiles (191), core::runtime (138), inference (431), agent::session_store (17), agent::multimodal (19), agent::attachments (55), storage::import (27): pass
  • json_rpc_e2e (--features voice,web3): 102 passed, 5 ignored; openhuman-rpc session_store: pass
  • node scripts/ci/check-submodule-monotonic.mjs upstream/main: OK with [pin-rewind] declared (the old pin 047cda3e was a never-merged side branch; main supersedes it); only vendor/tinyagents differs from upstream/main
  • pnpm rust:layout: only core/observability.rs 3479 lines (limit 3477), identical on upstream/main
  • check-saas-ambient.mjs (5 bare-spawn sites in modules/storage_import_*, sandbox/shell_exec.rs) and check-agent-runtime-boundary.mjs (3 re-exports in files this PR does not touch): fail identically on upstream/main

Failing tests (pre-existing, not from this change)

  • threads::store::bus::tests::* (8): channels/module_fixture_tests.rs panics "tinychannels-module fixture unavailable: blocked on tinybus 0.1.4".

#7727 stays open: its other leaves (embeddings, http_error/models/context_window, factory, agent/tinyagents/model.rs) are untouched here.

senamakel and others added 28 commits October 13, 2026 21:51
Update the pinned commits for the vendored submodules to their latest revisions.

Auto-committed-on: dragonfly
Update the vendored tinyconnectors, tinydocs, tinyflows, tinyhosts, tinyhumans-sdk, tinyjuice, tinymcp, tinysearch, tinyvoice, and tinywallet submodules to their latest commits.

Auto-committed-on: dragonfly
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the vendored tinyflows submodule to the latest upstream commit.

Auto-committed-on: dragonfly
Update the vendored tinyflows submodule to a newer revision.

Auto-committed-on: dragonfly
Auto-committed-on: dragonfly
Thread deletion now removes the associated session store entries so
workspace and turn state data do not linger after a thread is gone.
Previously these records were left behind, leaking storage and
occasionally resurfacing stale state for reused thread ids.

Auto-committed-on: dragonfly
Dropped the unused tinyagents_session::turn_state imports from the thread
crud and purge operations, clearing the resulting compiler warnings with no
behaviour change.

Auto-committed-on: dragonfly
Dropped several unused imports from the runtime bootstrap, streaming ops,
profile recovery, thread edit, and web chat modules to keep the code
warning-free.

Auto-committed-on: dragonfly
Use the fully qualified std::sync::Arc for the turn_state_store parameter instead of relying on an imported Arc, avoiding ambiguity with other Arc types in scope.

Auto-committed-on: dragonfly
Sessions are now written to and read from the workspace directory so
conversation state survives restarts. The store resolves paths relative
to the workspace root instead of relying on in-memory state alone.

Auto-committed-on: dragonfly
Adds handling for multimodal content in agent messages so images and
other non-text parts can be carried alongside text through the agent
pipeline.

Auto-committed-on: dragonfly
Attachments are now carried through the agent harness graph and session
driver so multimodal inputs reach the model alongside text. Subagent
dispatch was updated to forward the same attachment context.

Auto-committed-on: dragonfly
ResolvedChat now accepts the shared Arc directly, so the SharedChatModel wrapper that boxed it is no longer needed. This removes the adapter and its imports, passing the chat model through unchanged.

Auto-committed-on: dragonfly
…ut of order

The mirror now reconciles incoming turn-state observations against the
latest known revision instead of overwriting unconditionally, so stale
updates no longer clobber newer state. Tests cover the reordering cases
that previously produced inconsistent mirrored turns.

Auto-committed-on: dragonfly
Adds coverage for host profile handling, session import, turn state
editing, and op conversion. These tests exercise the new behaviour
introduced by the recent refactor.

Auto-committed-on: dragonfly
Turn state now carries multimodal attachments through to the agent so
images and other files sent from the web chat reach the model instead of
being dropped. Added tests covering the attachment handling path and
documented the flow in the web chat README.

Auto-committed-on: dragonfly
The lockfile still pinned tinystoragedrivers-core and tinystoragedrivers-secrets at 0.7.0 alongside their 0.8.0 counterparts, so every dependent had to disambiguate between the two versions. Removing the leftover 0.7.0 packages collapses each dependency onto a single version, and the vendored tinyagents submodule is bumped to match.

Auto-committed-on: dragonfly
Attachment placeholders now resolve from the blob stash first and only fall back to legacy sidecar files for ids the stash lacks, so conversations written before the stash still render while stashed bytes win when both exist. The legacy index lookup was also made testable by taking the directory as a parameter.

Auto-committed-on: dragonfly
Record anyhow as a dependency of tinyagents-runtime in the lockfile so the
resolved dependency graph matches the crate's manifest.

Auto-committed-on: dragonfly
Combine the two separate tinyagents_session use statements into a single grouped import in the progress bridge. No behaviour change.

Auto-committed-on: dragonfly
The end-to-end test now seeds turn snapshots through the session store's
turn_states_for handle instead of the old turn_state store function, matching
the current persistence API.

Auto-committed-on: dragonfly
Update the vendored tinyagents submodule to the latest commit.

Auto-committed-on: dragonfly
[pin-rewind] OpenHuman main pinned tinyagents 047cda3e, a side branch
(tsd-0.8.0-on-oh-pin-7655) that was never merged. tinyagents main (6d8a9196)
already carries the tinystoragedrivers v0.8.0 bump (#433) and adds #430/#434/#436
and #437 (tinyinference on tsd v0.8.0), so the old pin is deliberately dropped.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@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 ✅ Completed 2026-10-13T19:59:01.615184Z d36344c 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.

@senamakel
senamakel merged commit 34ca74b into tinyhumansai:main Oct 13, 2026
11 of 14 checks passed
@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: 7d28a6ad-ea6d-426f-b45d-55fe892d7f11
📥 Commits

Reviewing files that changed from the base of the PR and between aa44c25 and d36344c.

⛔ 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: 31
  • crates/openhuman-core/src/agent/attachments/mod.rs
  • crates/openhuman-core/src/agent/harness/graph.rs
  • crates/openhuman-core/src/agent/multimodal.rs
  • crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs
  • crates/openhuman-core/src/agent/session_host/driver.rs
  • crates/openhuman-core/src/agent/session_store/mod.rs
  • crates/openhuman-core/src/agent/session_store/mod_tests.rs
  • crates/openhuman-core/src/agent/session_store/workspace.rs
  • crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
  • crates/openhuman-core/src/core/runtime/bootstrap.rs
  • crates/openhuman-core/src/flows/ops/streaming.rs
  • crates/openhuman-core/src/inference/http/backend.rs
  • crates/openhuman-core/src/profiles/host_tests.rs
  • crates/openhuman-core/src/profiles/recovery.rs
  • crates/openhuman-core/src/storage/import/sessions_tests.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/turn_state_ops.rs
  • crates/openhuman-core/src/threads/ops_conversion_tests.rs
  • crates/openhuman-core/src/threads/turn_state/mirror.rs
  • crates/openhuman-core/src/threads/turn_state/mirror_observe_tests.rs
  • crates/openhuman-core/src/threads/turn_state/mirror_tests.rs
  • crates/openhuman-core/src/threads/turn_state/mod.rs
  • crates/openhuman-core/src/web_chat/README.md
  • crates/openhuman-core/src/web_chat/progress_bridge.rs
  • crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
  • crates/openhuman-core/src/web_chat/run_task.rs
  • tests/json_rpc_e2e.rs
  • vendor/tinyagents
 ______________________________________________________________________________________________________________________________________________________________
< Find bugs once. Once a human tester finds a bug, it should be the last time a human tester finds that bug. Automatic tests should check for it from then on. >
 --------------------------------------------------------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@tinysweeper

tinysweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 5 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Incomplete
Priority: none
Reviewed head: d36344c553d4
Updated: 2026-10-14T00:29:57Z

Review snapshot

Change surface Files Review signal Count
Production 19 Active findings 0
Tests 10 Noted findings 0
Documentation 1 Resolved findings 0
Configuration 0 Pending checks/questions 6

Completeness: Incomplete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Could not review: crates/openhuman-core/src/agent/session_host/driver.rs, crates/openhuman-core/src/profiles/recovery.rs, crates/openhuman-core/src/threads/ops/purge.rs, crates/openhuman-core/src/web_chat/progress_bridge.rs, crates/openhuman-core/src/web_chat/progress_bridge_tests.rs, crates/openhuman-core/src/web_chat/run_task.rs

Before merge

  • Complete the critique review for crates/openhuman-core/src/profiles/recovery.rs, crates/openhuman-core/src/threads/ops/purge.rs, crates/openhuman-core/src/web_chat/progress_bridge.rs, crates/openhuman-core/src/web_chat/progress_bridge_tests.rs, crates/openhuman-core/src/web_chat/run_task.rs.
  • Complete the security review for crates/openhuman-core/src/agent/session_host/driver.rs.

How this fits together

flowchart LR
  n0["rehydrate_image_placeholders<br/>changed"]:::changed
  n1["row_has_image_placeholders<br/>changed"]:::changed
  n2["stash_image_attachments<br/>changed"]:::changed
  n3["...lder_rehydrates_to_disk_path_for_provider<br/>changed"]:::changed
  n4["...achments_replaces_marker_with_placeholder<br/>changed"]:::changed
  n0 -->|calls| n1
  n3 -->|calls| n0
  n3 -->|tests| n0
  n3 -->|calls| n2
  n3 -->|tests| n2
  n4 -->|calls| n2
  n4 -->|tests| n2
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: incomplete; unanswered: crates/openhuman-core/src/profiles/recovery.rs, crates/openhuman-core/src/threads/ops/purge.rs, crates/openhuman-core/src/web_chat/progress_bridge.rs, crates/openhuman-core/src/web_chat/progress_bridge_tests.rs, crates/openhuman-core/src/web_chat/run_task.rs
  • Lane summary: Reviewed 25 files; 2 findings. 5 files could not be reviewed: crates/openhuman-core/src/profiles/recovery.rs, crates/openhuman-core/src/threads/ops/purge.rs, crates/openhuman-core/src/web_chat/progress_bridge.rs, crates/openhuman-core/src/web_chat/progress_bridge_tests.rs, crates/openhuman-core/src/web_chat/run_task.rs. _The code index is behind this pull request (indexed at `fafa0a0a23e0`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: incomplete; unanswered: crates/openhuman-core/src/agent/session_host/driver.rs
  • Lane summary: Reviewed 28 files; 0 findings. 1 file could not be reviewed: crates/openhuman-core/src/agent/session_host/driver.rs. 1 file was not security-reviewed: crates/openhuman-core/src/web_chat/README.md (prose or tabular data). _The code index is behind this pull request (indexed at `fafa0a0a23e0`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: This change migrates turn-state persistence from the file-backed `tinyagents_session::turn_state::store::TurnStateStore` to the `TurnStates` port resolved per tenant through `agent::session_store`, and moves attachment stashing from on-disk sidecar files to `BlobAttachmentStash` in the workspace blob store, which makes `rehydrate_image_placeholders` async. The migration itself is coherent and the updated tests exercise the new async rehydration path (inline data-URI marker, missing-id fallback) and the restart-survival of both the turn-state store and the attachment stash, so the new persistence claims have real coverage. I found one behaviour regression in the attachment path that no test in the diff pins: the in-process fallback stash is a fresh `OnceLock` singleton that, once initialized while `init_attachments_dir` has not run, is never replaced when a workspace does get installed, despite the diff's own comment promising the opposite. _The code index is behind this pull request (indexed at `fafa0a0a23e0`), so retrieved context may be out of date._

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change migrates host turn-state and attachment handling from the file-backed `TurnStateStore`/`AttachmentStash` to the `TurnStates` port and `BlobAttachmentStash`, and the description accurately covers the pin bump, the port migration, the async rehydration with legacy sidecar fallback, and the removal of `SharedChatModel`. I checked the new `turn_states_for`/`default_turn_states_for`/`attachment_stash_for` helpers against the existing `stores_or_ephemeral`/`provider_for_workspace`/`tenant_agent_key` code they build on, and the `read_data_uri`/`extract_image_placeholders_in_text` behaviour the new index code depends on; I found no defect this change introduces. _The code index is behind this pull request (indexed at `fafa0a0a23e0`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash,
  • Spend: $0.008087
  • Tokens: 1903544 input · 110537 output · 391808 cached · 778 embedding
Head State Pass summary
d36344c553d4 incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-14T00:29:57Z)

tinysweeper 0.1.2

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: crates/openhuman-core/src/agent/session_host/driver.rs, crates/openhuman-core/src/profiles/recovery.rs, crates/openhuman-core/src/threads/ops/purge.rs, crates/openhuman-core/src/web_chat/progress_bridge.rs, crates/openhuman-core/src/web_chat/progress_bridge_tests.rs, crates/openhuman-core/src/web_chat/run_task.rs.

             $0.0081 · 1,903,544 in / 110,537 out · 391,808 cached (21%) · ladder/vectors-oai3, deepseek-v4.1-flash,  · 778 embedded
critique:    $0.0070 · 1,120,899 in / 97,069 out  · 248,192 cached (22%) · deepseek-v4.1-flash,
security:    $0.0006 · 609,727 in   / 6,448 out   · 85,248 cached (14%)  · deepseek-v4.1-flash
tests:       $0.0001 · 102,004 in   / 1,367 out   · 34,560 cached (34%)  · deepseek-v4.1-flash
description: $0.0001 · 48,525 in    / 582 out     · 23,808 cached (49%)  · deepseek-v4.1-flash

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tiny-modules] tinyinference: move the OpenAI-compatible /v1 server types and handler core into tinyinference-providers

1 participant