Skip to content

feat: finish TinyAgents harness migration (#4249) - #4399

Merged
senamakel merged 298 commits into
tinyhumansai:mainfrom
senamakel:issue/4249-finish-tinyagents-migration
Jul 3, 2026
Merged

senamakel merged 298 commits into
tinyhumansai:mainfrom
senamakel:issue/4249-finish-tinyagents-migration

Conversation

@senamakel

@senamakel senamakel commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Hard-migrates OpenHuman's agent harness onto the tinyagents crate as the orchestration/model/context/events/cost/subagent/embeddings library, adapter-first (prove parity, then delete), per docs/tinyagents-full-migration-plan/.
  • Models: workload routes projected into the crate ModelRegistry with capability gating; SDK-owned cross-route fallback + retry classification; tool-call argument streaming via ToolCallDelta; one unified ModelCatalog snapshot.
  • Context/cache & events: prompt-prefix protection + gated response cache; durable StoreEventJournal + status store; single typed owner for subagent lifecycle events; summarization provenance.
  • Subagents/orchestration: crate-native steering commands + unified recursion authority; boot reconciliation of orphaned detached tasks; durable approval interrupt/resume for the delegation review gate; workspace-isolation events.
  • Registry/embeddings/cost: fail-closed CapabilityRegistry diagnostics + agent.registry_snapshot introspection RPC + agent projection; EmbeddingModel adapter + retriever facade (MemoryLoaded); reasoning/cache-creation token accounting + embedding cost.
  • Deletions landed with parity coverage: worktree_context.rs (CWD now from WorkspaceDescriptor) and SqlRunLedgerCheckpointer (durable graphs use the crate SqliteCheckpointer); reliable.rs classifiers extracted to error_classify.rs.

Problem

OpenHuman maintained a large bespoke agent harness (retry/fallback, context reducers, event bridge, checkpointer, subagent pipeline, registries) that duplicated capabilities now shipped by tinyagents 1.3.x. Issue #4249 tracks converging onto the crate as the single source of truth for orchestration, keeping only product policy (prompts, registry, security/approval, credentials, UX projections), and deleting the superseded OpenHuman files.

Solution

  • Adapter-first per workstream: wire the crate primitive alongside the legacy path, prove behavioral parity, then delete the legacy file and tick 99-deletion-ledger.md. Deletions that would regress behavior the mock suite cannot validate (e.g. ReliableProvider's model-fallback/key-rotation/streaming-failover for non-turn callers) are explicitly left gated with documented rationale rather than forced.
  • Conformance pass (workstream 11): restored the full test target to compilation, re-baselined migration behavior changes, and fixed two real regressions found in the process (a catalog context-window substring overmatch; a cross-route fallback masking terminal provider errors in test doubles). Lib suite 13700 passed / 0 failed and all integration/e2e binaries green under the project's canonical RUST_MIN_STACK=16777216 --test-threads=1 runner (scripts/test-rust-with-mock.sh).
  • Security/approval/sandbox/workspace/credential boundaries are unchanged; JSON-RPC contracts are preserved (new surfaces are additive, e.g. agent.registry_snapshot).

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy — conformance pass + per-slice adapter/parity tests (worktree descriptor CWD, checkpointer swap, unknown-tool recovery, fallback error propagation, cache prefix stability, steering policy, boot reconciliation).
  • Diff coverage ≥ 80% — enforced by .github/workflows/pr-ci.yml; the conformance suites are green and changed-line coverage is reconciled against the CI gate during review (the diff spans many adapter-first slices each landed with tests).
  • N/A: Coverage matrix — adapter-first migration re-expresses existing agent-harness behavior on the crate; no new user-facing feature rows (the added agent.registry_snapshot is a read-only diagnostic surface).
  • N/A: Affected feature IDs — no coverage-matrix feature rows changed (see above).
  • No new external network dependencies introduced — mock-backend policy preserved; no new runtime network deps.
  • N/A: Manual smoke checklist — behavior-preserving harness migration; no release-cut smoke surface changes.
  • Linked issue closed via Closes #4249 in Related.

Impact

  • Runtime/platform: desktop/CLI Rust core (agent harness, inference, orchestration, cost, embeddings, session/event stores). No frontend user-flow changes in the migration slices.
  • Compatibility/migration: durable graph checkpoints move to the crate SqliteCheckpointer at {workspace}/graph_checkpoints.db; nothing else read the old run-ledger graph_checkpoints table, so pre-swap in-flight graphs expire and orphaned tasks reconcile at boot. Session dual-write is behind OPENHUMAN_SESSION_DUAL_WRITE (default off). Toolchain pinned to Rust 1.96.1 for crates.io rusqlite 0.40 / libsqlite3-sys 0.38 (cfg_select!).
  • Security: SecurityPolicy/landlock remains the enforcement authority; worktree isolation now carries the root via WorkspaceDescriptor (parity-tested). Registry diagnostics fail closed pre-dispatch.

Related

  • Closes: Improve agent harness with LangGraph-style state machine or Polaris-like architecture #4249
  • Follow-up PR(s)/TODOs: gated deletion-ledger rows (reliable.rs ReliableProvider struct — needs routing non-turn callers through the crate; tool_filter.rs/tool_prep.rs ownership flip; ThinkingForwarder — blocked on crate ToolDelta lacking tool_name; progress_tracing.rs journal-parity; CostBudgetMiddleware UsageRecorded de-dup; 04.2 session-store read cutover on live user data).

AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: issue/4249-finish-tinyagents-migration
  • Commit SHA: 7bf56fc

Validation Run

  • N/A: pnpm --filter openhuman-app format:check — no frontend source changes in the migration slices.
  • N/A: pnpm typecheck — no frontend source changes in the migration slices.
  • Focused tests: lib 13700 passed / 0 failed and integration/e2e binaries green via scripts/test-rust-with-mock.sh (RUST_MIN_STACK=16777216 --test-threads=1).
  • Rust fmt/check (if changed): GGML_NATIVE=OFF cargo check --manifest-path Cargo.toml clean on Rust 1.96.1.
  • N/A: Tauri fmt/check — no app/src-tauri source changes in the migration slices.

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: agent harness orchestration/model/context/events/cost/subagent/embeddings now run on the tinyagents crate; unknown tools recover via crate UnknownToolPolicy; durable graphs checkpoint via the crate SqliteCheckpointer.
  • User-visible effect: none intended (parity-preserving); adds a read-only agent.registry_snapshot diagnostic RPC.

Parity Contract

  • Legacy behavior preserved: adapter-first with per-slice parity tests; non-isolated tool CWD, cost estimates, retry/fallback classification, unknown-tool recovery, and JSON-RPC shapes preserved.
  • Guard/fallback/dispatch parity checks: registry diagnostics fail-closed pre-dispatch; SecurityPolicy/landlock unchanged; gated deletions left in place where a faithful replacement is unverifiable by the mock suite.

Duplicate / Superseded PR Handling

@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 385 files, which is 85 over the limit of 300.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3daa89e6-5574-4c61-a00d-f05b64ce6b4d

📥 Commits

Reviewing files that changed from the base of the PR and between d6f178f and 65daddb.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • app/src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (385)
  • Cargo.toml
  • app/src-tauri/Cargo.toml
  • app/src/hooks/useCostDashboard.ts
  • app/src/services/chatService.ts
  • docs/tinyagents-full-migration-plan/00-baseline.md
  • docs/tinyagents-full-migration-plan/01-tooling/01-tool-policy.md
  • docs/tinyagents-full-migration-plan/01-tooling/02-unknown-tool.md
  • docs/tinyagents-full-migration-plan/01-tooling/03-dynamic-exposure.md
  • docs/tinyagents-full-migration-plan/01-tooling/04-tool-output.md
  • docs/tinyagents-full-migration-plan/01-tooling/README.md
  • docs/tinyagents-full-migration-plan/02-models/01-model-registry.md
  • docs/tinyagents-full-migration-plan/02-models/02-fallback-retry.md
  • docs/tinyagents-full-migration-plan/02-models/03-streaming-reasoning.md
  • docs/tinyagents-full-migration-plan/02-models/04-catalog.md
  • docs/tinyagents-full-migration-plan/02-models/README.md
  • docs/tinyagents-full-migration-plan/03-context-cache/01-delete-legacy-context.md
  • docs/tinyagents-full-migration-plan/03-context-cache/02-cache-layer.md
  • docs/tinyagents-full-migration-plan/03-context-cache/README.md
  • docs/tinyagents-full-migration-plan/04-sessions/01-live-writes.md
  • docs/tinyagents-full-migration-plan/04-sessions/02-read-cutover.md
  • docs/tinyagents-full-migration-plan/04-sessions/03-checkpointer.md
  • docs/tinyagents-full-migration-plan/04-sessions/README.md
  • docs/tinyagents-full-migration-plan/05-events/01-journals.md
  • docs/tinyagents-full-migration-plan/05-events/02-bridge-consolidation.md
  • docs/tinyagents-full-migration-plan/05-events/03-domainevent-projection.md
  • docs/tinyagents-full-migration-plan/05-events/README.md
  • docs/tinyagents-full-migration-plan/06-cost/README.md
  • docs/tinyagents-full-migration-plan/07-subagents/01-subagent-pipeline.md
  • docs/tinyagents-full-migration-plan/07-subagents/02-detached-taskstore.md
  • docs/tinyagents-full-migration-plan/07-subagents/03-steering-recursion.md
  • docs/tinyagents-full-migration-plan/07-subagents/README.md
  • docs/tinyagents-full-migration-plan/08-orchestration/01-map-reduce.md
  • docs/tinyagents-full-migration-plan/08-orchestration/02-spawn-parallel-graph.md
  • docs/tinyagents-full-migration-plan/08-orchestration/03-interrupt-resume.md
  • docs/tinyagents-full-migration-plan/08-orchestration/04-graph-stubs.md
  • docs/tinyagents-full-migration-plan/08-orchestration/05-worktree-isolation.md
  • docs/tinyagents-full-migration-plan/08-orchestration/README.md
  • docs/tinyagents-full-migration-plan/09-embeddings.md
  • docs/tinyagents-full-migration-plan/10-registry.md
  • docs/tinyagents-full-migration-plan/11-testing.md
  • docs/tinyagents-full-migration-plan/99-deletion-ledger.md
  • docs/tinyagents-full-migration-plan/README.md
  • docs/tinyagents-harness-migration-audit.md
  • docs/tinyagents-migration-spec.md
  • docs/tinyagents-sdk-gaps.md
  • docs/tinyagents-session-migration-design.md
  • gitbooks/developing/architecture/agent-harness.md
  • gitbooks/features/channels.md
  • gitbooks/features/token-compression.md
  • rust-toolchain.toml
  • scripts/test-rust-e2e.sh
  • src/bin/harness_subagent_audit.rs
  • src/core/all.rs
  • src/core/event_bus/README.md
  • src/core/event_bus/events.rs
  • src/core/event_bus/events_tests.rs
  • src/core/event_bus/native_request.rs
  • src/core/jsonrpc.rs
  • src/openhuman/agent/cost.rs
  • src/openhuman/agent/debug/mod.rs
  • src/openhuman/agent/error.rs
  • src/openhuman/agent/harness/agent_graph.rs
  • src/openhuman/agent/harness/compaction/cache_align.rs
  • src/openhuman/agent/harness/compaction/mod.rs
  • src/openhuman/agent/harness/engine/checkpoint.rs
  • src/openhuman/agent/harness/engine/mod.rs
  • src/openhuman/agent/harness/fork_context.rs
  • src/openhuman/agent/harness/graph.rs
  • src/openhuman/agent/harness/harness_gap_tests.rs
  • src/openhuman/agent/harness/memory_context.rs
  • src/openhuman/agent/harness/mod.rs
  • src/openhuman/agent/harness/parse.rs
  • src/openhuman/agent/harness/run_queue/mod.rs
  • src/openhuman/agent/harness/run_queue/run_queue_tests.rs
  • src/openhuman/agent/harness/session/agent_tool_exec.rs
  • src/openhuman/agent/harness/session/builder/factory.rs
  • src/openhuman/agent/harness/session/builder/setters.rs
  • src/openhuman/agent/harness/session/mod.rs
  • src/openhuman/agent/harness/session/runtime.rs
  • src/openhuman/agent/harness/session/runtime_tests.rs
  • src/openhuman/agent/harness/session/tool_progress.rs
  • src/openhuman/agent/harness/session/turn/core.rs
  • src/openhuman/agent/harness/session/turn/graph.rs
  • src/openhuman/agent/harness/session/turn/mod.rs
  • src/openhuman/agent/harness/session/turn/session_io.rs
  • src/openhuman/agent/harness/session/turn/tools.rs
  • src/openhuman/agent/harness/session/turn_tests.rs
  • src/openhuman/agent/harness/session/types.rs
  • src/openhuman/agent/harness/spawn_depth_context.rs
  • src/openhuman/agent/harness/subagent_runner/handoff.rs
  • src/openhuman/agent/harness/subagent_runner/mod.rs
  • src/openhuman/agent/harness/subagent_runner/ops/checkpoint.rs
  • src/openhuman/agent/harness/subagent_runner/ops/graph.rs
  • src/openhuman/agent/harness/subagent_runner/ops/handoff_helper.rs
  • src/openhuman/agent/harness/subagent_runner/ops/mod.rs
  • src/openhuman/agent/harness/subagent_runner/ops/prompt.rs
  • src/openhuman/agent/harness/subagent_runner/ops/provider.rs
  • src/openhuman/agent/harness/subagent_runner/ops/runner.rs
  • src/openhuman/agent/harness/subagent_runner/ops/usage.rs
  • src/openhuman/agent/harness/subagent_runner/ops_tests.rs
  • src/openhuman/agent/harness/subagent_runner/tool_prep.rs
  • src/openhuman/agent/harness/subagent_runner/types.rs
  • src/openhuman/agent/harness/tool_filter.rs
  • src/openhuman/agent/harness/tool_result_artifacts/mod.rs
  • src/openhuman/agent/harness/turn_attachments_context.rs
  • src/openhuman/agent/harness/turn_subagent_usage.rs
  • src/openhuman/agent/harness/worktree_context.rs
  • src/openhuman/agent/host_runtime.rs
  • src/openhuman/agent/memory_loader.rs
  • src/openhuman/agent/mod.rs
  • src/openhuman/agent/progress_tracing.rs
  • src/openhuman/agent/progress_tracing/langfuse.rs
  • src/openhuman/agent/progress_tracing/tests.rs
  • src/openhuman/agent/prompts/render_helpers.rs
  • src/openhuman/agent/schemas.rs
  • src/openhuman/agent/stop_hooks.rs
  • src/openhuman/agent/task_dispatcher/dispatch.rs
  • src/openhuman/agent/task_dispatcher/mod.rs
  • src/openhuman/agent/tests.rs
  • src/openhuman/agent/tools/delegate_to_personality.rs
  • src/openhuman/agent/tools/run_workflow.rs
  • src/openhuman/agent/tree_loader.rs
  • src/openhuman/agent/triage/escalation.rs
  • src/openhuman/agent/triage/evaluator.rs
  • src/openhuman/agent/triage/routing.rs
  • src/openhuman/agent_memory/agent/graph.rs
  • src/openhuman/agent_memory/agent/mod.rs
  • src/openhuman/agent_memory/memory_loader.rs
  • src/openhuman/agent_memory/tools.rs
  • src/openhuman/agent_orchestration/agent_teams/runtime_tests.rs
  • src/openhuman/agent_orchestration/background_completions.rs
  • src/openhuman/agent_orchestration/background_delivery.rs
  • src/openhuman/agent_orchestration/delegation.rs
  • src/openhuman/agent_orchestration/harness_audit.rs
  • src/openhuman/agent_orchestration/mod.rs
  • src/openhuman/agent_orchestration/ops.rs
  • src/openhuman/agent_orchestration/ops_tests.rs
  • src/openhuman/agent_orchestration/parent_context/builder.rs
  • src/openhuman/agent_orchestration/run_ledger_finalize.rs
  • src/openhuman/agent_orchestration/run_ledger_finalize_tests.rs
  • src/openhuman/agent_orchestration/running_subagents.rs
  • src/openhuman/agent_orchestration/spawn_parallel_graph.rs
  • src/openhuman/agent_orchestration/subagent_events.rs
  • src/openhuman/agent_orchestration/subagent_sessions/mod.rs
  • src/openhuman/agent_orchestration/tools/agent_prepare_context.rs
  • src/openhuman/agent_orchestration/tools/archetype_delegation.rs
  • src/openhuman/agent_orchestration/tools/close_subagent.rs
  • src/openhuman/agent_orchestration/tools/continue_subagent.rs
  • src/openhuman/agent_orchestration/tools/delegate_graph.rs
  • src/openhuman/agent_orchestration/tools/dispatch.rs
  • src/openhuman/agent_orchestration/tools/list_subagents.rs
  • src/openhuman/agent_orchestration/tools/skill_delegation.rs
  • src/openhuman/agent_orchestration/tools/spawn_async_subagent.rs
  • src/openhuman/agent_orchestration/tools/spawn_parallel_agents.rs
  • src/openhuman/agent_orchestration/tools/spawn_parallel_agents_tests.rs
  • src/openhuman/agent_orchestration/tools/spawn_subagent.rs
  • src/openhuman/agent_orchestration/tools/spawn_worker_thread.rs
  • src/openhuman/agent_orchestration/tools/steer_subagent.rs
  • src/openhuman/agent_orchestration/tools/tools_e2e_tests.rs
  • src/openhuman/agent_orchestration/tools/wait_subagent.rs
  • src/openhuman/agent_orchestration/workflow_runs/engine.rs
  • src/openhuman/agent_orchestration/workflow_runs/engine_tests.rs
  • src/openhuman/agent_orchestration/workflow_runs/graph.rs
  • src/openhuman/agent_orchestration/workflow_runs/mod.rs
  • src/openhuman/agent_orchestration/worktree.rs
  • src/openhuman/agent_registry/agents/account_admin_agent/graph.rs
  • src/openhuman/agent_registry/agents/account_admin_agent/mod.rs
  • src/openhuman/agent_registry/agents/archivist/graph.rs
  • src/openhuman/agent_registry/agents/archivist/mod.rs
  • src/openhuman/agent_registry/agents/code_executor/graph.rs
  • src/openhuman/agent_registry/agents/code_executor/mod.rs
  • src/openhuman/agent_registry/agents/context_scout/graph.rs
  • src/openhuman/agent_registry/agents/context_scout/mod.rs
  • src/openhuman/agent_registry/agents/critic/graph.rs
  • src/openhuman/agent_registry/agents/critic/mod.rs
  • src/openhuman/agent_registry/agents/crypto_agent/graph.rs
  • src/openhuman/agent_registry/agents/crypto_agent/mod.rs
  • src/openhuman/agent_registry/agents/desktop_control_agent/graph.rs
  • src/openhuman/agent_registry/agents/desktop_control_agent/mod.rs
  • src/openhuman/agent_registry/agents/goals_agent/graph.rs
  • src/openhuman/agent_registry/agents/goals_agent/mod.rs
  • src/openhuman/agent_registry/agents/help/graph.rs
  • src/openhuman/agent_registry/agents/help/mod.rs
  • src/openhuman/agent_registry/agents/image_agent/graph.rs
  • src/openhuman/agent_registry/agents/image_agent/mod.rs
  • src/openhuman/agent_registry/agents/integrations_agent/graph.rs
  • src/openhuman/agent_registry/agents/integrations_agent/mod.rs
  • src/openhuman/agent_registry/agents/loader.rs
  • src/openhuman/agent_registry/agents/markets_agent/graph.rs
  • src/openhuman/agent_registry/agents/markets_agent/mod.rs
  • src/openhuman/agent_registry/agents/mcp_agent/graph.rs
  • src/openhuman/agent_registry/agents/mcp_agent/mod.rs
  • src/openhuman/agent_registry/agents/mcp_setup/graph.rs
  • src/openhuman/agent_registry/agents/mcp_setup/mod.rs
  • src/openhuman/agent_registry/agents/morning_briefing/graph.rs
  • src/openhuman/agent_registry/agents/morning_briefing/mod.rs
  • src/openhuman/agent_registry/agents/orchestrator/graph.rs
  • src/openhuman/agent_registry/agents/orchestrator/mod.rs
  • src/openhuman/agent_registry/agents/orchestrator/prompt.rs
  • src/openhuman/agent_registry/agents/planner/graph.rs
  • src/openhuman/agent_registry/agents/planner/mod.rs
  • src/openhuman/agent_registry/agents/presentation_agent/graph.rs
  • src/openhuman/agent_registry/agents/presentation_agent/mod.rs
  • src/openhuman/agent_registry/agents/profile_memory_agent/graph.rs
  • src/openhuman/agent_registry/agents/profile_memory_agent/mod.rs
  • src/openhuman/agent_registry/agents/researcher/graph.rs
  • src/openhuman/agent_registry/agents/scheduler_agent/graph.rs
  • src/openhuman/agent_registry/agents/scheduler_agent/mod.rs
  • src/openhuman/agent_registry/agents/screen_awareness_agent/graph.rs
  • src/openhuman/agent_registry/agents/screen_awareness_agent/mod.rs
  • src/openhuman/agent_registry/agents/settings_agent/graph.rs
  • src/openhuman/agent_registry/agents/settings_agent/mod.rs
  • src/openhuman/agent_registry/agents/skill_creator/graph.rs
  • src/openhuman/agent_registry/agents/skill_creator/mod.rs
  • src/openhuman/agent_registry/agents/summarizer/graph.rs
  • src/openhuman/agent_registry/agents/summarizer/mod.rs
  • src/openhuman/agent_registry/agents/task_manager_agent/graph.rs
  • src/openhuman/agent_registry/agents/task_manager_agent/mod.rs
  • src/openhuman/agent_registry/agents/tool_maker/graph.rs
  • src/openhuman/agent_registry/agents/tool_maker/mod.rs
  • src/openhuman/agent_registry/agents/tools_agent/graph.rs
  • src/openhuman/agent_registry/agents/tools_agent/mod.rs
  • src/openhuman/agent_registry/agents/trigger_reactor/graph.rs
  • src/openhuman/agent_registry/agents/trigger_reactor/mod.rs
  • src/openhuman/agent_registry/agents/trigger_triage/graph.rs
  • src/openhuman/agent_registry/agents/trigger_triage/mod.rs
  • src/openhuman/agent_registry/agents/video_agent/graph.rs
  • src/openhuman/agent_registry/agents/video_agent/mod.rs
  • src/openhuman/agent_registry/agents/vision_agent/graph.rs
  • src/openhuman/agent_registry/agents/vision_agent/mod.rs
  • src/openhuman/app_state/ops.rs
  • src/openhuman/app_state/ops_tests.rs
  • src/openhuman/approval/README.md
  • src/openhuman/channels/README.md
  • src/openhuman/channels/commands.rs
  • src/openhuman/channels/mod.rs
  • src/openhuman/channels/providers/matrix.rs
  • src/openhuman/channels/providers/matrix_tests.rs
  • src/openhuman/channels/providers/mod.rs
  • src/openhuman/channels/providers/presentation.rs
  • src/openhuman/channels/providers/web/ops.rs
  • src/openhuman/channels/providers/web/progress_bridge.rs
  • src/openhuman/channels/providers/web/schemas.rs
  • src/openhuman/channels/providers/web/types.rs
  • src/openhuman/channels/providers/web_errors.rs
  • src/openhuman/channels/providers/whatsapp_web.rs
  • src/openhuman/channels/runtime/startup.rs
  • src/openhuman/codegraph/tools.rs
  • src/openhuman/config/schema/agent.rs
  • src/openhuman/config/schema/context.rs
  • src/openhuman/config/schema/observability.rs
  • src/openhuman/context/README.md
  • src/openhuman/context/guard.rs
  • src/openhuman/context/manager.rs
  • src/openhuman/context/microcompact.rs
  • src/openhuman/context/mod.rs
  • src/openhuman/context/pipeline.rs
  • src/openhuman/context/session_memory.rs
  • src/openhuman/context/stats.rs
  • src/openhuman/context/tool_result_budget.rs
  • src/openhuman/cost/README.md
  • src/openhuman/cost/catalog.rs
  • src/openhuman/cost/global.rs
  • src/openhuman/cost/mod.rs
  • src/openhuman/cost/rpc.rs
  • src/openhuman/cost/types.rs
  • src/openhuman/cron/scheduler.rs
  • src/openhuman/embeddings/README.md
  • src/openhuman/embeddings/mod.rs
  • src/openhuman/inference/model_context.rs
  • src/openhuman/inference/provider/billing_error.rs
  • src/openhuman/inference/provider/claude_code/event_mapper.rs
  • src/openhuman/inference/provider/compatible_helpers.rs
  • src/openhuman/inference/provider/error_classify.rs
  • src/openhuman/inference/provider/error_code.rs
  • src/openhuman/inference/provider/mod.rs
  • src/openhuman/inference/provider/reliable.rs
  • src/openhuman/inference/provider/reliable_tests.rs
  • src/openhuman/inference/provider/traits.rs
  • src/openhuman/integrations/client.rs
  • src/openhuman/learning/README.md
  • src/openhuman/mcp_server/subagent_depth.rs
  • src/openhuman/media_generation/tools.rs
  • src/openhuman/memory_search/tools/vector_search.rs
  • src/openhuman/memory_search/vector/mmr.rs
  • src/openhuman/memory_search/vector/mod.rs
  • src/openhuman/memory_search/vector/store.rs
  • src/openhuman/memory_store/vectors/store.rs
  • src/openhuman/memory_sync/composio/providers/sync_state.rs
  • src/openhuman/memory_sync/composio/providers/traits.rs
  • src/openhuman/mod.rs
  • src/openhuman/model_council/graph.rs
  • src/openhuman/security/policy/types.rs
  • src/openhuman/session_db/mod.rs
  • src/openhuman/session_db/ops.rs
  • src/openhuman/session_db/run_ledger/store.rs
  • src/openhuman/session_db/schemas.rs
  • src/openhuman/session_import/convert.rs
  • src/openhuman/session_import/live.rs
  • src/openhuman/session_import/mod.rs
  • src/openhuman/session_import/ops.rs
  • src/openhuman/session_import/ops_tests.rs
  • src/openhuman/session_import/scan.rs
  • src/openhuman/session_import/schemas.rs
  • src/openhuman/session_import/types.rs
  • src/openhuman/skill_registry/agent/skill_setup/graph.rs
  • src/openhuman/skill_registry/agent/skill_setup/mod.rs
  • src/openhuman/skill_runtime/agent/skill_executor/graph.rs
  • src/openhuman/skill_runtime/agent/skill_executor/mod.rs
  • src/openhuman/subconscious/agent/graph.rs
  • src/openhuman/subconscious/agent/mod.rs
  • src/openhuman/subconscious/session.rs
  • src/openhuman/tinyagents/checkpoint.rs
  • src/openhuman/tinyagents/delegation.rs
  • src/openhuman/tinyagents/embeddings.rs
  • src/openhuman/tinyagents/journal.rs
  • src/openhuman/tinyagents/middleware.rs
  • src/openhuman/tinyagents/mod.rs
  • src/openhuman/tinyagents/model.rs
  • src/openhuman/tinyagents/observability.rs
  • src/openhuman/tinyagents/orchestration.rs
  • src/openhuman/tinyagents/payload_summarizer.rs
  • src/openhuman/tinyagents/retriever.rs
  • src/openhuman/tinyagents/routes.rs
  • src/openhuman/tinyagents/run_cancellation_context.rs
  • src/openhuman/tinyagents/stop_hooks.rs
  • src/openhuman/tinyagents/subagent_graph.rs
  • src/openhuman/tinyagents/summarize.rs
  • src/openhuman/tinyagents/tests.rs
  • src/openhuman/tinyagents/tools.rs
  • src/openhuman/tinyagents/topology.rs
  • src/openhuman/tinyplace/agent/graph.rs
  • src/openhuman/tinyplace/agent/mod.rs
  • src/openhuman/tokenjuice/README.md
  • src/openhuman/tokenjuice/compress.rs
  • src/openhuman/tokenjuice/mod.rs
  • src/openhuman/tokenjuice/savings.rs
  • src/openhuman/tokenjuice/tool_integration.rs
  • src/openhuman/tool_registry/README.md
  • src/openhuman/tool_timeout/README.md
  • src/openhuman/tools/README.md
  • src/openhuman/tools/impl/filesystem/apply_patch.rs
  • src/openhuman/tools/impl/filesystem/csv_export.rs
  • src/openhuman/tools/impl/filesystem/edit_file.rs
  • src/openhuman/tools/impl/filesystem/file_read.rs
  • src/openhuman/tools/impl/filesystem/file_write.rs
  • src/openhuman/tools/impl/filesystem/git_operations.rs
  • src/openhuman/tools/impl/filesystem/git_operations_tests.rs
  • src/openhuman/tools/impl/filesystem/glob_search.rs
  • src/openhuman/tools/impl/filesystem/grep.rs
  • src/openhuman/tools/impl/filesystem/list_files.rs
  • src/openhuman/tools/impl/filesystem/mod.rs
  • src/openhuman/tools/impl/filesystem/read_diff.rs
  • src/openhuman/tools/impl/filesystem/run_linter.rs
  • src/openhuman/tools/impl/filesystem/run_tests.rs
  • src/openhuman/tools/impl/filesystem/update_memory_md.rs
  • src/openhuman/tools/impl/system/command_output.rs
  • src/openhuman/tools/impl/system/mod.rs
  • src/openhuman/tools/impl/system/node_exec.rs
  • src/openhuman/tools/impl/system/npm_exec.rs
  • src/openhuman/tools/impl/system/retrieve_tool_output.rs
  • src/openhuman/tools/impl/system/shell.rs
  • src/openhuman/tools/ops_tests.rs
  • src/openhuman/tools/traits.rs
  • src/openhuman/workflows/e2e_plumbing_tests.rs
  • tests/agent_archivist_debug_round21_raw_coverage_e2e.rs
  • tests/agent_harness_e2e.rs
  • tests/agent_harness_leftovers_raw_coverage_e2e.rs
  • tests/agent_harness_public.rs
  • tests/agent_harness_raw_coverage_e2e.rs
  • tests/agent_large_round25_raw_coverage_e2e.rs
  • tests/agent_memory_loader_public.rs
  • tests/agent_prompts_subagent_raw_coverage_e2e.rs
  • tests/agent_round26_raw_coverage_e2e.rs
  • tests/agent_session_round24_raw_coverage_e2e.rs
  • tests/agent_session_turn_raw_coverage_e2e.rs
  • tests/agent_tool_loop_raw_coverage_e2e.rs
  • tests/agent_turn_builder_leftovers_raw_coverage_e2e.rs
  • tests/agent_turn_toolloop_round22_raw_coverage_e2e.rs
  • tests/calendar_grounding_e2e.rs
  • tests/channels_bus_presentation_raw_coverage_e2e.rs
  • tests/composio_list_tools_stack_overflow_regression.rs
  • tests/inference_agent_raw_coverage_e2e.rs
  • tests/json_rpc_e2e.rs
  • tests/tools_agent_credentials_state_raw_coverage_e2e.rs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

senamakel added 29 commits July 1, 2026 23:54

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

let worktree_path = repo_top.join(WORKTREE_SUBDIR).join(&run_slug);

P2 Badge Avoid dirtying the parent checkout with nested worktrees

When a user's repo does not already ignore .claude/, creating each worker checkout under repo_top/.claude/worktrees makes the parent checkout itself dirty; I checked this in a scratch repo and git status --porcelain reports ?? .claude/ immediately after git worktree add. That undermines the isolation guarantee and can leave/commit worker plumbing in the user's main tree, so place worktrees outside the repo or add a local exclude before creating them.


forward_collects(&queue, &handle).await;

P2 Badge Preserve turn history when injecting collect messages

Forwarding collect messages during the run injects new user turns after the model may already have emitted assistant/tool messages, but the turn result later persists only messages_since_last_user(&run.messages). If a collect arrives after the first model/tool round, that injected user becomes the "last user" and all earlier assistant/tool messages from the same turn are dropped from outcome.conversation, so transcripts and tool-call records lose part of the turn; track the original user index or exclude injected collect turns from the persistence cut.


BaseRef::Head => "HEAD".to_string(),

P2 Badge Include parent working-tree changes in head worktrees

For base_ref = head, this passes HEAD as the git worktree add commit-ish (per git worktree add -h, the command takes <path> [<commit-ish>]), so the worker starts from the last commit and never sees uncommitted parent edits. In the normal coding flow where the parent has already modified files before spawning isolated workers, those workers analyze and patch a stale tree; either require a clean parent or copy/stash-apply the current diff into the worker worktree.

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@senamakel
senamakel merged commit c43f796 into tinyhumansai:main Jul 3, 2026
6 checks passed

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

let worktree_path = repo_top.join(WORKTREE_SUBDIR).join(&run_slug);

P2 Badge Keep worker worktrees out of the parent checkout

When isolation="worktree" runs in a repo that does not already ignore .claude/, this creates the linked worktree inside the parent working tree. I checked the Git behavior with git worktree add .claude/worktrees/w1 followed by git status --porcelain, which reports ?? .claude/; so merely spawning a worker dirties the user's checkout and can surface the worktree directory in later diffs/commits. Put these worktrees outside the repo or ensure the containing path is ignored before creating them.

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

sanil-23 added a commit to sanil-23/openhuman that referenced this pull request Jul 3, 2026
…tinyagents migration + versioned world-diff migration

Rebased onto current main (c43f796) which merged tinyhumansai#4399 (finish TinyAgents
migration) after tinyhumansai#4430 — leaving main red (Rust Quality) from two semantic
conflicts this repairs:
- agent_registry loader: BuiltinAgent.graph_fn is now Option<fn()->AgentGraph>;
  wrap frontend_agent/reasoning_agent in Some(...) (E0308).
- orchestration graph: tinyhumansai#4399 retired SqlRunLedgerCheckpointer for the tinyagents
  crate SqliteCheckpointer (graph_checkpoints.db). Migrate graph/mod.rs + the
  ops resume test to SqliteCheckpointer::open, mirroring delegation.rs (E0432).

Also addresses CodeRabbit on the world-diff unique index: move it into a
user_version-gated one-time migrate() (was CREATE UNIQUE INDEX IF NOT EXISTS —
a no-op on already-created stores), de-dupe legacy race rows, and reconcile
terminal_state so it can't point at a deleted duplicate's mutation. Test extended
with distinct mutations + stale terminal_state + user_version assertions.
YellowSnnowmann added a commit to YellowSnnowmann/openhuman that referenced this pull request Jul 3, 2026
Resolves a semantic conflict introduced by upstream tinyhumansai#4399
("finish TinyAgents harness migration"): that change retired
`SqlRunLedgerCheckpointer` (delegation.rs already moved to the crate's
`SqliteCheckpointer`) but left dangling references, so `main` at
c43f796 does not compile on its own:

  - orchestration/graph/mod.rs — imported + constructed the removed
    `SqlRunLedgerCheckpointer`; now opens `SqliteCheckpointer` against a
    dedicated `graph_checkpoints.db` under `workspace_dir`, matching the
    delegation-graph pattern.
  - orchestration/ops.rs — test used the removed checkpointer; swapped to
    `SqliteCheckpointer::open` at the same path/thread.
  - agent_registry/agents/loader.rs — `graph_fn` became
    `Option<fn() -> AgentGraph>`; the frontend/reasoning builtins were left
    as bare fn items (E0308). Wrapped in `Some(...)`.
  - orchestration/graph/state.rs — fixed the stale intra-doc link.

Merge is otherwise conflict-free. Full gate green: fmt, clippy -p openhuman,
lib check, checkpointer persistence test, and the channels suite.
sanil-23 added a commit to sanil-23/openhuman that referenced this pull request Jul 3, 2026
…ce mock

tinyhumansai#4399 raised RUNTIME_SNAPSHOT_TTL 2s -> 10s to fix a rebuild-stampede perf bug,
but app_state_snapshot_degrades_runtime_service_status_failures ages the cache
out with a 2.1s sleep — fine for the old 2s TTL, now < the 10s one, so the test
reads a stale cached snapshot from a prior test and never sees the injected
'forced status failure' (asserts service degrades to Unknown). Deterministic;
only surfaced now because main (with tinyhumansai#4399) doesn't compile until tinyhumansai#4431 repairs
the tinyhumansai#4399/tinyhumansai#4430 conflict, so this is the first branch to actually run it.

Fix: when OPENHUMAN_SERVICE_MOCK is active (a test-only env hook production
service status already honors), never serve from or write to the process-global
runtime cache — the mock's state changes between calls, so caching masks the
injected value and poisons later non-mocked reads. Full
config_auth_app_state_connectivity_e2e binary: 50 passed.
sanil-23 added a commit to sanil-23/openhuman that referenced this pull request Jul 3, 2026
…n review fixes

Rebased onto current main (8aab529), which already carries the tinyhumansai#4399/tinyhumansai#4430
compile reconciliation (graph_fn Some, SqliteCheckpointer migration, MCP
catalog) via tinyhumansai#4433 — so this is slimmed to the fixes main still lacks:

- app_state: bypass the runtime-snapshot cache when OPENHUMAN_SERVICE_MOCK is
  active. tinyhumansai#4399 raised RUNTIME_SNAPSHOT_TTL 2s->10s, so the mock-service e2e
  (which ages the cache with a 2.1s sleep) reads a stale snapshot and never sees
  the injected failure. Bypassing read+write under the mock fixes it (full
  config_auth_app_state_connectivity_e2e binary: 50 passed).
- orchestration/ops: split steering out of seed_state into apply_cycle_steering,
  invoked only after the has_new_work guard, so no-op wakes don't consume a cycle
  tick and prematurely expire steering (CodeRabbit).
- orchestration/store: user_version-gated world-diff migration — drop legacy
  non-unique index, de-dupe race rows, unique index, reconcile terminal_state
  (M3gA-Mind + CodeRabbit) + test.
- orchestration/graph/state: agent-scoped cycle_id (avoid cross-peer collision)
  + migration-seam note (Codex + M3gA-Mind).
- orchestration/schemas: ingest-health MAX(last_message_at) excludes pinned
  master/subconscious windows (CodeRabbit).
- frontend: orchestration socket listeners via socketService.on/off (queues
  through startup/reconnect) + messages Retry -> refresh() (CodeRabbit/Codex).
- docs: orchestration.md fenced-block language (markdownlint).
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Jul 3, 2026
Rework of tinyhumansai#4390 onto post-tinyhumansai#4399 code. tinyhumansai#4399 relocated the tool policy gate
from the deleted session/agent_tool_exec.rs to the tinyagents adapter
middleware (ToolPolicyMiddleware), which still emitted bare denial lines.

- Ports the deleted policy_denial.rs into the adapter seam as
  src/openhuman/tinyagents/policy_denial.rs: a `PolicyDenial` renderer that
  turns each denial into a structured `Blocked / Reason / Workaround / relay`
  message (with the concrete "raise the channel's agent-access tier" or
  "permitted alternative / ask for approval" workaround) so the agent relays
  the block to the user instead of dead-ending.
- Swaps the three bare `format!` denials in ToolPolicyMiddleware
  (channel_permission_block session-forbidden + per-call permission-too-low,
  and the pluggable-policy Deny/RequireApproval branch in wrap_tool) for
  PolicyDenial::render().

5 unit tests for the renderer (session-forbidden with/without required,
permission-too-low, policy-denied, approval-required).
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Jul 3, 2026
…dex protocol (tinyhumansai#4116)

Rework of tinyhumansai#4388 onto post-tinyhumansai#4399 code. tinyhumansai#4399 deleted the original home
(agent/harness/memory_protocol.rs did not exist yet; the enforcement was to
live in the turn engine); the turn loop now runs on the tinyagents crate, so
this re-expresses the protocol as a crate middleware.

- Ports the pure `MemoryProtocolTracker` state machine as
  src/openhuman/agent/harness/memory_protocol.rs: classifies each memory tool
  call (IndexRead / Write / IndexUpdate / Other) and, on a write, flags a
  missing dedupe read or a stale index (a prior write never followed by
  update_memory_md).
- Adds `MemoryProtocolMiddleware` in the tinyagents adapter seam: before_tool
  captures the classified op by call id; after_tool advances the tracker on
  success and appends a `[memory-protocol]` corrective note to the tool result
  so the model is nudged back onto the cycle; after_agent warns when the run
  ends with a stale index. Registered outermost in assemble_turn_harness so its
  after_tool runs after the byte-cap truncation, preserving the note.
- Fixes a stale classification from the original PR: `memory_search` is not a
  real tool — replaced with the actual dedupe-read search tools
  (memory_vector_search / memory_chunk_context / memory_hybrid_search).

9 unit tests (classification + tracker ladder) + 4 middleware integration
tests (corrective note, SKILL.md doesn't close the cycle, consolidated
memory_tree ingest = write, failed write doesn't advance). All green.
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Jul 3, 2026
…ent (tinyhumansai#4254, backend)

Rework of tinyhumansai#4413's backend onto post-tinyhumansai#4399 code. tinyhumansai#4399 deleted the original
classification hook (session/agent_tool_exec.rs) and the ProgressReporter
trait; the tool loop now runs on the tinyagents crate, so the hook is
re-homed on the adapter seam.

- New `src/openhuman/tool_status/` module: `classify(error_text, timed_out)`
  and `describe(class)` map a tool outcome to a `ClassifiedFailure`
  (class + category + plain-language cause + next action). Pure, unit-tested
  (16 tests: all classes, timeout/unknown/precedence, category mapping,
  recoverability).
- `AgentProgress::ToolCallCompleted` + `WebChannelEvent` gain a `failure`
  field carrying that classification to the chat "View processing" timeline.
- Core hook + latent-bug fix: the crate's `AgentEvent::ToolCompleted` carries
  only call_id + tool_name, so the bridge previously hardcoded `success: true`
  (a failed tool never surfaced). `ToolOutcomeCaptureMiddleware::after_tool`
  now classifies each result and writes a `call_id → (success, failure)`
  side-channel (mirroring the existing `ToolNameMap`); the bridge reads it to
  emit real `success` + `failure`. Absent entry falls back to `(true, None)`.
- `progress_bridge` serializes `failure` onto the `tool_result` socket event
  and the run ledger.

Backend only. The frontend consumer (chat timeline "why / next" render) and
i18n keys are a companion — they rebase cleanly onto current `main` from
tinyhumansai#4413 (only the Rust hook conflicted with tinyhumansai#4399), so they are not re-included
here to avoid reverting unrelated locale drift.

NOTE: the middleware-before-event ordering that populates the side-channel is
crate-internal; the fallback keeps behavior no worse than before if the event
is ever projected first. Needs runtime validation once tinyhumansai#4442 lands (drive a
deliberately-failing tool and confirm `success:false` + `failure` on the wire).
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Jul 3, 2026
…ed in tinyhumansai#4445

tinyhumansai#4413 originally shipped both the tool-failure classification backend and the
chat "View processing" render. The backend conflicted with tinyhumansai#4399 (harness
migration) and has been reworked separately in tinyhumansai#4445 (tool_status module +
ToolOutcomeCaptureMiddleware + WebChannelEvent.failure). This reduces tinyhumansai#4413 to
just the frontend that consumes tinyhumansai#4445's `failure` field off the tool_result
socket event, rebased cleanly onto current main.

Kept (21 files):
- chat timeline render: ProcessingTranscriptView (+test), ChatRuntimeProvider,
  chatService, chatRuntimeSlice (+toolFailure test), turnState.
- i18n: conversations.toolFailure.* keys across all 14 locales (3-way unioned
  onto current main so no existing translations are reverted).

Dropped (now owned by tinyhumansai#4445): tool_status/, agent progress/observability,
middleware, event_bus, socketio failure plumbing, and the deleted-file conflict
on agent_tool_exec.rs.

Verified: pnpm typecheck clean, i18n:check parity 0 missing/0 extra, 13 frontend
tests pass (chatRuntimeSlice.toolFailure + ProcessingTranscriptView).
Stacked on tinyhumansai#4445 (merge that first — it emits the field this renders).
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.

Improve agent harness with LangGraph-style state machine or Polaris-like architecture

1 participant