Issue/4249-finish-tinyagents-migration#4399
Draft
senamakel wants to merge 269 commits into
Draft
Conversation
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
…ed crate delta) (tinyhumansai#4249) Claude-Session: https://claude.ai/code/session_01UCE4k5uj5FsjFzgZSvXHQy
Adds DomainEvent::{WorkspacePrepared, WorkspaceViolation, WorkspaceCleanup}
for the 08.5 worktree-isolation workstream, plus cargo fmt normalization
across session_import and payload_summarizer.
Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
Wraps OpenHuman's EmbeddingProvider as tinyagents harness::embeddings::EmbeddingModel, bridging the &[String] vs &[&str] signature and anyhow->TinyAgentsError::Embedding error mapping. Preserves dimensions()/signature() fidelity. Not yet wired into the recall path (09.2); re-exported so it is part of the crate surface. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
Wire GitWorktreeIsolation prepare/cleanup and a new enforce_workspace_path
helper to publish DomainEvent::{WorkspacePrepared,WorkspaceCleanup,
WorkspaceViolation} onto the global bus for the security audit trail.
Descriptor stays a carrier; SecurityPolicy/landlock remains the enforcement
authority. worktree_context.rs deletion + acting-tool migration deferred.
Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…ch (10.2) run_turn_via_tinyagents_shared now inspects registry.diagnostics() after harness assembly and aborts the turn before any model dispatch when an error-severity diagnostic (duplicate name / dangling alias) is present, via new AgentError::RegistryValidationFailed. Warnings are logged only. Existing hand-rolled dedup left intact (deletion deferred until parity). Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
New read-only RPC projecting the CapabilityRegistry inventory (models/tools/graphs/agents with ComponentMetadata) plus a Graphviz DOT export from durable descriptor sources reachable outside a turn. Additive sibling to agent.graph_topologies; the full per-agent tool surface and per-run-only kinds are documented deferrals in the response. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…(06.1) UsageInfo now carries cache_creation_tokens/reasoning_tokens through the bridge into the persisted TokenUsage record instead of hardcoding 0. claude_code provider path populates real cache-creation tokens. Providers that do not report these keep 0. No public cost RPC shape change. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…onMiddleware (03.1) Retain the ContextCompressionMiddleware handle on the assembled turn and drain records() after the run, logging per-compaction provenance (source ids, before/after token estimates, reason) under a grep-friendly [context] prefix. Additive; ToolOutputMiddleware Compressed contract untouched. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…ity gating (02.1) New tinyagents/routes.rs projects the 7 router tiers (chat/reasoning/ agentic/coding/burst/summarization/vision) into the crate ModelRegistry as per-route ProviderModel entries with real ModelProfile (vision/reasoning/ context-window). set_default_model still points at the turn's effective model so dispatch is unchanged; this enables 02.2 fallback ordering. Adds RequiredCapabilitiesMiddleware stamping the turn CapabilitySet onto each ModelRequest so unfit models are rejected pre-dispatch (vision wired; tool/reasoning/BYOK signals documented as follow-ups). Route policy stays in router.rs/factory.rs. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…uman overlays (02.4) unified_model_catalog() seeds from tinyagents ModelCatalog::seed(), overlays KNOWN_MODEL_PRICING rates/windows (source of truth, identical numbers), local runtime models, and pattern-window backfill. Model-picker RPC now sources local models from config. estimate_cost_usd/context_window stay on KNOWN_MODEL_PRICING to guarantee numeric identity; duplicate-table deletion deferred until a snapshot lookup is proven identical. No cost numbers changed. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
Adds PromptCacheSegmentMiddleware stamping content-fingerprinted system/tools PromptSegments, then PromptCacheGuardMiddleware with protect_prompt_prefix=true; CacheLayoutEvents surface as structured [cache] warnings alongside the retained CacheAlignMiddleware. Threads deterministic_cacheable through the shared runner to attach InMemoryResponseCache only for internal deterministic runs — all three production callers (chat/channel/subagent) set false, so interactive turns are never served cached responses. CacheHit/Miss counted in the bridge; cost-footer DTO wiring deferred to 06. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…ent (09.2/09.3) New tinyagents/retriever.rs wraps Memory::recall as the swappable retrieval seam: projects entries to crate ScoredDoc, carries path_scope and applies the id-keyed dedupe rule, and emits AgentEvent::MemoryLoaded. memory_context.rs and memory_loader.rs load recall through the facade; CROSS_CHAT_HEADER, citation format, and collect_recall_citations output stay byte-identical (engine unchanged, adapter-first). Concrete crate Retriever exposed as the engine-swap seam. Embedding usage/cost (09.4) deferred to coordinate with 06. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
… (05.2)
New agent_orchestration/subagent_events.rs centralizes construction + publish
of DomainEvent::Subagent{Spawned,Completed,Failed,AwaitingUser} across 24 sites
in 6 files. Event variants, field values, and ordering are byte-identical, so
RunLedgerFinalizeSubscriber and UI consumers see no change; this is the single
hook point for future ordering/rate-limiting/journal-mirroring (05.1).
Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…rojections (10.1) assemble_turn_harness now registers Agent descriptors deduped from the runtime AgentDefinitionRegistry and agent_registry builtins so they appear in the snapshot/diagnostics streams, and exercises to_model_registry()/to_tool_registry() as validation projections with a [registry] count summary. ComponentMetadata description/tags persistence and register_agent (needs executable blueprint) are documented follow-ups; live register_model/register_tool glue left intact. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…02.2) RunPolicy.fallback now carries an ordered same-family alternate chain from the 02.1 routes; FallbackObserverMiddleware emits AgentEvent::FallbackSelected with no extra dispatch; RetryScheduled surfaces (dormant while max_attempts pinned=1 to avoid double-retry with still-wrapped ReliableProvider). ProviderModel maps permanent/billing rejections to non-retryable via OpenHuman classifiers. Adapter- first: reliable.rs annotated for deletion in the 11-testing conformance pass. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
Tool-argument fragments now ride ModelStreamItem::ToolCallDelta into AgentProgress::ToolCallArgsDelta instead of ThinkingForwarder. Start event + tool_name stay on the forwarder (crate ToolDelta has no name field); a shared per-turn ToolNameMap labels streamed fragments so UI timeline parity holds. Removed emit_tool_args from ThinkingForwarder; its start marker + non-streaming reasoning fallback stay live. Child-run streaming preserved via scope-aware bridge. Ledger row updated. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…uthority (07.3) Maps Redirect/Pause/Resume/Cancel to crate SteeringCommand via a new SteeringDirective, delivered only through the registered SteeringHandle with fail-closed policy checks. SteeringPolicy tightens by run class (background subagent runs accept control-flow steering without transcript injection; interactive keeps InjectMessage+Pause). Steered event projected under [steering]. Recursion: documents why spawn_depth_context stays a thin projector (cross-process MCP-hop depth + synchronous pre-dispatch surface); cap=3 and SpawnDepthExceeded wording unchanged. run_queue mechanics retained. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…4.1)
Behind OPENHUMAN_SESSION_DUAL_WRITE (default OFF), after a successful legacy
JSONL transcript write, also append the turn to the slash-free store stream
session.{stem}.messages and upsert the NS_SESSIONS descriptor, reusing the
session_import convert normalization so live and imported records are
shape-identical. Store writes are fire-and-forget and non-fatal; OFF-default
behavior is byte-identical to today. Reads stay legacy (04.2). Factored shared
open_session_stores() helper. StoreChatHistory adoption evaluated + deferred.
Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
Attaches a second EventSink listener (FanOutSink -> RedactingSink -> JournalSink -> StoreEventJournal over the 04.1 JsonlAppendStore) alongside the unchanged OpenhumanEventBridge, plus a Store-backed FileStatusStore (crate ships only in-memory) writing running/completed/failed snapshots keyed by run_id with list_by_root/thread/active. RedactingSink masks credential-valued env secrets before persistence. Adds read_run_events/read_run_status replay-reader seam for a future replay RPC. Writes are best-effort/non-fatal. BEHAVIOR NOTE: the per-turn EventSink is now created unconditionally (was gated on on_progress/pause) so a run is reconstructable without subscribing at start; all journal/status I/O is non-fatal. Subscribers untouched; no deletions. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…3/09.4) Adds run_id/root_run_id to TokenUsage (serde default + skip_serializing_if, stamped None pending run-tree threading; rollup swap deferred). ProviderEmbedding Model.embed records best-effort embedding usage (provider/model/dims/vectors) priced via the unified catalog, zero-cost when no embedding rate exists. Non-fatal [cost][embed] recording; public cost DTOs backward-compatible. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…perative cancel (07.2) Adds reconcile_orphaned_tasks_on_boot: scans the durable DetachedTaskStore for tasks left live by a prior process, settles them terminal (CancelRequested-> Cancelled, else Failed with an orphaned-by-restart reason), and emits the 05.2 terminal lifecycle event so the run ledger finalizes. Hooked in bootstrap_core_runtime next to run-ledger recovery. Flips the CancellationToken before abort in cancel_for_thread/cancel_all so cooperative cancel is uniform; terminal store write preserved. Best-effort/non-fatal; no deletions, no shrink. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
… review gate (08.3) Adds DelegationConfig::require_review_approval: the durable delegation graph emits NodeResult::Interrupt at the review approval point (persisted Sync via the existing SqlRunLedgerCheckpointer so the pause survives restart) and resumes via Command::resume, mapping the stable ApprovalDecision RPC wire strings (approve_once/approve_always_for_tool/deny) with deny overriding. run_delegation_ durable/resume_delegation added; deny_decision() preserves TTL-deny. Interactive chat approval gate untouched (durable-vs-chat boundary documented). Workflow human-review + live approval-RPC delivery noted as follow-ups. Claude-Session: https://claude.ai/code/session_01Frnx4CvLQBCGoDyT6FT6Sq
…inyagents-migration # Conflicts: # src/openhuman/agent_orchestration/parent_context/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
Solution
Submission Checklist
diff-cover) meet the gate enforced by.github/workflows/pr-ci.yml. Runpnpm test:coverageandpnpm test:rustlocally; PRs below 80% on changed lines will not merge.docs/TEST-COVERAGE-MATRIX.mdreflect this change (orN/A: behaviour-only change)## Relateddocs/RELEASE-MANUAL-SMOKE.md)Closes #NNNin the## RelatedsectionImpact
Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
Validation Run
pnpm --filter openhuman-app format:checkpnpm typecheckValidation Blocked
command:error:impact:Behavior Changes
Parity Contract
Duplicate / Superseded PR Handling