Skip to content

Consume focused TinyInference crates and own prompt-guided providers - #152

Merged
senamakel merged 31 commits into
mainfrom
migrate-inference-to-tinyinference
Sep 18, 2026
Merged

senamakel merged 31 commits into
mainfrom
migrate-inference-to-tinyinference

Conversation

@senamakel

@senamakel senamakel commented Sep 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Consume language-model APIs directly from tinyinference-llm.
  • Consume embedding APIs directly from tinyinference-embeddings.
  • Advance the vendored TinyInference revision containing the complete local, embeddings, providers/OAuth, and voice migration.
  • Keep direct crate ownership throughout; no compatibility aliases or inference re-export shims.

Depends on tinyhumansai/tinyinference#12. This PR remains draft until that dependency lands and the gitlink is refreshed to its merged commit.

Validation

  • TinyInference focused tests, strict workspace Clippy, and rustdoc pass at the pinned revision.
  • Existing TinyAgents workspace validation from the preceding migration pass remains green.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Warning

Review paused — included plan limit reached

Keep your review moving with free on-demand reviews.

  • Run this review for free

On-demand reviews are free for the next 2 days.

Promotion and pricing details

On-demand reviews are free for the next 2 days. After that, they cost $0.25 per reviewed file.

Review limit details

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: e6eacbd2-f2a7-4773-b63e-4cbbc34c4a57

📥 Commits

Reviewing files that changed from the base of the PR and between c1bf05f and 86a67c9.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (216)
  • README.md
  • crates/tinyagents-graph/Cargo.toml
  • crates/tinyagents-graph/src/goals/test.rs
  • crates/tinyagents-graph/src/goals/tool.rs
  • crates/tinyagents-graph/src/orchestration/test.rs
  • crates/tinyagents-graph/src/orchestration/tool.rs
  • crates/tinyagents-graph/src/recursion/types.rs
  • crates/tinyagents-graph/src/subagent_node/test.rs
  • crates/tinyagents-graph/src/subagent_node/types.rs
  • crates/tinyagents-graph/src/subgraph/mod.rs
  • crates/tinyagents-graph/src/testkit/mod.rs
  • crates/tinyagents-graph/src/testkit/test.rs
  • crates/tinyagents-graph/src/todos/test.rs
  • crates/tinyagents-graph/src/todos/tool.rs
  • crates/tinyagents-harness/Cargo.toml
  • crates/tinyagents-harness/src/agent_loop/entry.rs
  • crates/tinyagents-harness/src/agent_loop/mod.rs
  • crates/tinyagents-harness/src/agent_loop/model_call.rs
  • crates/tinyagents-harness/src/agent_loop/run_loop.rs
  • crates/tinyagents-harness/src/agent_loop/stream.rs
  • crates/tinyagents-harness/src/agent_loop/test.rs
  • crates/tinyagents-harness/src/cache/key.rs
  • crates/tinyagents-harness/src/cache/layout.rs
  • crates/tinyagents-harness/src/cache/memory.rs
  • crates/tinyagents-harness/src/cache/singleflight.rs
  • crates/tinyagents-harness/src/cache/sqlite.rs
  • crates/tinyagents-harness/src/cache/test.rs
  • crates/tinyagents-harness/src/cache/types.rs
  • crates/tinyagents-harness/src/context/types.rs
  • crates/tinyagents-harness/src/cost/mod.rs
  • crates/tinyagents-harness/src/cost/test.rs
  • crates/tinyagents-harness/src/error.rs
  • crates/tinyagents-harness/src/events/mod.rs
  • crates/tinyagents-harness/src/events/types.rs
  • crates/tinyagents-harness/src/host/budget_gate.rs
  • crates/tinyagents-harness/src/host/context_composer.rs
  • crates/tinyagents-harness/src/host/learning_sink.rs
  • crates/tinyagents-harness/src/host/mod.rs
  • crates/tinyagents-harness/src/host/model_resolver.rs
  • crates/tinyagents-harness/src/host/progress_sink.rs
  • crates/tinyagents-harness/src/lib.rs
  • crates/tinyagents-harness/src/memory/mod.rs
  • crates/tinyagents-harness/src/memory/test.rs
  • crates/tinyagents-harness/src/memory/types.rs
  • crates/tinyagents-harness/src/middleware/library/budget.rs
  • crates/tinyagents-harness/src/middleware/library/context.rs
  • crates/tinyagents-harness/src/middleware/library/mod.rs
  • crates/tinyagents-harness/src/middleware/library/observe.rs
  • crates/tinyagents-harness/src/middleware/library/test.rs
  • crates/tinyagents-harness/src/middleware/library/types.rs
  • crates/tinyagents-harness/src/middleware/mod.rs
  • crates/tinyagents-harness/src/middleware/test.rs
  • crates/tinyagents-harness/src/middleware/types.rs
  • crates/tinyagents-harness/src/model_registry/mod.rs
  • crates/tinyagents-harness/src/model_registry/test.rs
  • crates/tinyagents-harness/src/model_registry/types.rs
  • crates/tinyagents-harness/src/observability/langfuse/mod.rs
  • crates/tinyagents-harness/src/prompt/mod.rs
  • crates/tinyagents-harness/src/prompt/test.rs
  • crates/tinyagents-harness/src/prompt/types.rs
  • crates/tinyagents-harness/src/providers/claude_agent_sdk/mod.rs
  • crates/tinyagents-harness/src/providers/claude_agent_sdk/protocol.rs
  • crates/tinyagents-harness/src/providers/claude_agent_sdk/test.rs
  • crates/tinyagents-harness/src/providers/claude_code/README.md
  • crates/tinyagents-harness/src/providers/claude_code/auth.rs
  • crates/tinyagents-harness/src/providers/claude_code/auth_status.rs
  • crates/tinyagents-harness/src/providers/claude_code/auth_status_tests.rs
  • crates/tinyagents-harness/src/providers/claude_code/auth_tests.rs
  • crates/tinyagents-harness/src/providers/claude_code/bridge.rs
  • crates/tinyagents-harness/src/providers/claude_code/driver.rs
  • crates/tinyagents-harness/src/providers/claude_code/driver_tests.rs
  • crates/tinyagents-harness/src/providers/claude_code/event_mapper.rs
  • crates/tinyagents-harness/src/providers/claude_code/event_mapper_tests.rs
  • crates/tinyagents-harness/src/providers/claude_code/input_builder.rs
  • crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs
  • crates/tinyagents-harness/src/providers/claude_code/mod.rs
  • crates/tinyagents-harness/src/providers/claude_code/mod_tests.rs
  • crates/tinyagents-harness/src/providers/claude_code/pipeline_test.rs
  • crates/tinyagents-harness/src/providers/claude_code/session_store.rs
  • crates/tinyagents-harness/src/providers/claude_code/session_store_tests.rs
  • crates/tinyagents-harness/src/providers/claude_code/settings.rs
  • crates/tinyagents-harness/src/providers/claude_code/settings_tests.rs
  • crates/tinyagents-harness/src/providers/claude_code/stream_parser.rs
  • crates/tinyagents-harness/src/providers/claude_code/stream_parser_tests.rs
  • crates/tinyagents-harness/src/providers/claude_code/types.rs
  • crates/tinyagents-harness/src/providers/claude_code/version_check.rs
  • crates/tinyagents-harness/src/providers/claude_code/version_check_tests.rs
  • crates/tinyagents-harness/src/providers/mod.rs
  • crates/tinyagents-harness/src/relaxed_json.rs
  • crates/tinyagents-harness/src/retry/mod.rs
  • crates/tinyagents-harness/src/retry/test.rs
  • crates/tinyagents-harness/src/retry/types.rs
  • crates/tinyagents-harness/src/runtime/mod.rs
  • crates/tinyagents-harness/src/runtime/test.rs
  • crates/tinyagents-harness/src/runtime/types.rs
  • crates/tinyagents-harness/src/steering/mod.rs
  • crates/tinyagents-harness/src/steering/test.rs
  • crates/tinyagents-harness/src/steering/types.rs
  • crates/tinyagents-harness/src/stream/mod.rs
  • crates/tinyagents-harness/src/stream/project.rs
  • crates/tinyagents-harness/src/stream/test.rs
  • crates/tinyagents-harness/src/stream/types.rs
  • crates/tinyagents-harness/src/structured/mod.rs
  • crates/tinyagents-harness/src/structured/repair.rs
  • crates/tinyagents-harness/src/structured/test.rs
  • crates/tinyagents-harness/src/structured/types.rs
  • crates/tinyagents-harness/src/subagent/mod.rs
  • crates/tinyagents-harness/src/subagent/test.rs
  • crates/tinyagents-harness/src/subagent/types.rs
  • crates/tinyagents-harness/src/summarization/mod.rs
  • crates/tinyagents-harness/src/summarization/pairing.rs
  • crates/tinyagents-harness/src/summarization/render.rs
  • crates/tinyagents-harness/src/summarization/test.rs
  • crates/tinyagents-harness/src/summarization/trim.rs
  • crates/tinyagents-harness/src/summarization/types.rs
  • crates/tinyagents-harness/src/testkit/mod.rs
  • crates/tinyagents-harness/src/testkit/test.rs
  • crates/tinyagents-harness/src/testkit/types.rs
  • crates/tinyagents-harness/src/token_estimation.rs
  • crates/tinyagents-harness/src/tool/mod.rs
  • crates/tinyagents-harness/src/tool/prompt.rs
  • crates/tinyagents-harness/src/tool/prompt_test.rs
  • crates/tinyagents-harness/src/tool/schema_prepare.rs
  • crates/tinyagents-harness/src/tool/types.rs
  • crates/tinyagents-integration-tests/Cargo.toml
  • crates/tinyagents-integration-tests/examples/agent_loop_tools.rs
  • crates/tinyagents-integration-tests/examples/basic_graph.rs
  • crates/tinyagents-integration-tests/examples/local_model_probe.rs
  • crates/tinyagents-integration-tests/examples/openai_chat.rs
  • crates/tinyagents-integration-tests/examples/openai_graph_agent.rs
  • crates/tinyagents-integration-tests/examples/openai_self_blueprint.rs
  • crates/tinyagents-integration-tests/examples/openai_structured.rs
  • crates/tinyagents-integration-tests/examples/openai_tools.rs
  • crates/tinyagents-integration-tests/examples/orchestrator_subagents.rs
  • crates/tinyagents-integration-tests/tests/context_and_schema_compaction.rs
  • crates/tinyagents-integration-tests/tests/context_and_schema_tool_surface.rs
  • crates/tinyagents-integration-tests/tests/e2e_agent_graph.rs
  • crates/tinyagents-integration-tests/tests/e2e_budget.rs
  • crates/tinyagents-integration-tests/tests/e2e_control_and_steer.rs
  • crates/tinyagents-integration-tests/tests/e2e_embeddings.rs
  • crates/tinyagents-integration-tests/tests/e2e_fuzz_graph_agents.rs
  • crates/tinyagents-integration-tests/tests/e2e_graph_resolver_contracts.rs
  • crates/tinyagents-integration-tests/tests/e2e_graph_subagent_node.rs
  • crates/tinyagents-integration-tests/tests/e2e_graph_support_contracts.rs
  • crates/tinyagents-integration-tests/tests/e2e_graph_task_dispatch.rs
  • crates/tinyagents-integration-tests/tests/e2e_graph_todos.rs
  • crates/tinyagents-integration-tests/tests/e2e_harness_provider_contracts.rs
  • crates/tinyagents-integration-tests/tests/e2e_language_contracts.rs
  • crates/tinyagents-integration-tests/tests/e2e_middleware.rs
  • crates/tinyagents-integration-tests/tests/e2e_middleware_parser_contracts.rs
  • crates/tinyagents-integration-tests/tests/e2e_misc_public_helpers.rs
  • crates/tinyagents-integration-tests/tests/e2e_observability.rs
  • crates/tinyagents-integration-tests/tests/e2e_orchestrator_subagents.rs
  • crates/tinyagents-integration-tests/tests/e2e_parallel_and_journals.rs
  • crates/tinyagents-integration-tests/tests/e2e_public_api_contracts.rs
  • crates/tinyagents-integration-tests/tests/e2e_reasoning_and_selection.rs
  • crates/tinyagents-integration-tests/tests/e2e_registry_observability_contracts.rs
  • crates/tinyagents-integration-tests/tests/e2e_steering.rs
  • crates/tinyagents-integration-tests/tests/e2e_streaming_cancel.rs
  • crates/tinyagents-integration-tests/tests/e2e_subagent_error.rs
  • crates/tinyagents-integration-tests/tests/e2e_subagent_reuse.rs
  • crates/tinyagents-integration-tests/tests/e2e_subagent_timeout.rs
  • crates/tinyagents-integration-tests/tests/e2e_subagents.rs
  • crates/tinyagents-integration-tests/tests/e2e_tool_policy.rs
  • crates/tinyagents-integration-tests/tests/e2e_unknown_tool_policy.rs
  • crates/tinyagents-integration-tests/tests/e2e_workspace_and_registry.rs
  • crates/tinyagents-integration-tests/tests/feature_harness_agent_loop.rs
  • crates/tinyagents-integration-tests/tests/feature_harness_prompt.rs
  • crates/tinyagents-integration-tests/tests/feature_harness_structured.rs
  • crates/tinyagents-integration-tests/tests/feature_infra_accounting.rs
  • crates/tinyagents-integration-tests/tests/feature_infra_context.rs
  • crates/tinyagents-integration-tests/tests/feature_infra_embeddings.rs
  • crates/tinyagents-integration-tests/tests/feature_infra_persistence.rs
  • crates/tinyagents-integration-tests/tests/feature_infra_resilience.rs
  • crates/tinyagents-integration-tests/tests/feature_registry_diagnostics.rs
  • crates/tinyagents-integration-tests/tests/harness_agent_loop.rs
  • crates/tinyagents-integration-tests/tests/live_cache.rs
  • crates/tinyagents-integration-tests/tests/live_checkpoint_resume.rs
  • crates/tinyagents-integration-tests/tests/live_local_embeddings.rs
  • crates/tinyagents-integration-tests/tests/live_local_models.rs
  • crates/tinyagents-integration-tests/tests/live_orchestrator_subagents.rs
  • crates/tinyagents-integration-tests/tests/live_prompt_cache.rs
  • crates/tinyagents-integration-tests/tests/live_provider_matrix.rs
  • crates/tinyagents-integration-tests/tests/live_sdk_gaps.rs
  • crates/tinyagents-integration-tests/tests/live_steering.rs
  • crates/tinyagents-integration-tests/tests/live_streaming.rs
  • crates/tinyagents-integration-tests/tests/live_subagent_error.rs
  • crates/tinyagents-integration-tests/tests/live_subagent_reuse.rs
  • crates/tinyagents-integration-tests/tests/live_subagent_timeout.rs
  • crates/tinyagents-integration-tests/tests/live_subagents.rs
  • crates/tinyagents-integration-tests/tests/persistence_store.rs
  • crates/tinyagents-integration-tests/tests/provider_local_wire.rs
  • crates/tinyagents-integration-tests/tests/runtime_primitives_resilience.rs
  • crates/tinyagents-integration-tests/tests/serialization.rs
  • crates/tinyagents-integration-tests/tests/wave2_cache_key_scope.rs
  • crates/tinyagents-integration-tests/tests/wave2_cache_layout.rs
  • crates/tinyagents-integration-tests/tests/wave2_cache_loop.rs
  • crates/tinyagents-integration-tests/tests/wave2_cache_retry_after.rs
  • crates/tinyagents-integration-tests/tests/wave2_cache_store.rs
  • crates/tinyagents-integration-tests/tests/wave2_loop_cache_accounting.rs
  • crates/tinyagents-integration-tests/tests/wave2_loop_control.rs
  • crates/tinyagents-integration-tests/tests/wave2_loop_estimators.rs
  • crates/tinyagents-integration-tests/tests/wave2_loop_limits.rs
  • crates/tinyagents-integration-tests/tests/wave2_loop_recovery.rs
  • crates/tinyagents-integration-tests/tests/wave2_loop_structured.rs
  • crates/tinyagents-integration-tests/tests/wave2_tools_execution.rs
  • crates/tinyagents-integration-tests/tests/wave2_tools_structured.rs
  • crates/tinyagents-registry/Cargo.toml
  • crates/tinyagents-registry/src/capability/mod.rs
  • crates/tinyagents-registry/src/capability/test.rs
  • crates/tinyagents-registry/src/capability/types.rs
  • crates/tinyagents-registry/src/catalog.rs
  • crates/tinyagents-registry/src/router/mod.rs
  • crates/tinyagents-registry/src/router/test.rs
  • crates/tinyagents-registry/src/router/types.rs
  • vendor/tinyinference

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

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel senamakel changed the title Consume inference failure policy from tinyinference Consume TinyInference and own prompt-guided providers Sep 18, 2026
senamakel and others added 15 commits September 18, 2026 12:58
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…tinyinference

# Conflicts:
#	crates/tinyagents-harness/Cargo.toml
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel senamakel changed the title Consume TinyInference and own prompt-guided providers Consume focused TinyInference crates and own prompt-guided providers Sep 18, 2026
senamakel and others added 9 commits September 18, 2026 18:18
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel marked this pull request as ready for review September 18, 2026 18:01
@tinysweeper

tinysweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown

Tiny Sweeper review

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

State: Changes requested
Priority: critical
Reviewed head: 86a67c93eebc
Updated: 1789757515 (Unix time)

Review snapshot

Change surface Files Review signal Count
Production 88 Active findings 28
Tests 122 Noted findings 0
Documentation 2 Resolved findings 51
Configuration 3 Pending checks/questions 0

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

What changed

The review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below.

Features

None identified with supported citations.

Tests

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

Findings

  • critical · critique · Declare the tinyinference_llm dependency — The reviewed repository has no Cargo manifest declaring `tinyinference_llm`, so this new provider cannot compile. Add the package dependency under the declared crate name, or impor (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:8)
  • critical · critique · Declare the tinyinference_llm dependency — This file imports `tinyinference_llm`, but the reviewed repository does not declare that dependency name in its Cargo manifests. The provider therefore cannot compile until the pac (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:41)
  • critical · critique · Clone usage before reusing the response field — `Option::map` takes ownership of `response.usage`. `model_response` then reads `response.usage` again when constructing `raw`, so this new module does not compile unless the usage (crates/tinyagents\-harness/src/providers/claude\_code/mod\.rs:340)
  • critical · critique · Preserve the retry classification API — Every subprocess failure is flattened into the generic `Model` error. This loses the structured provider/transport classification and retryability information expected by the harne (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:346)
  • critical · critique · Preserve the provider retry classification — This converts every failure that is not classified as a non-retryable error into the generic `Error::Model`, and converts the remaining cases into `Error::Validation`. That discard (crates/tinyagents\-harness/src/providers/claude\_code/mod\.rs:383)
  • high · critique · Start the timeout before writing child stdin — The timeout begins only after `write_all` and stdin shutdown complete. A blocked write can therefore wait indefinitely and bypass the provider's timeout. Put subprocess startup, in (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:214)
  • high · critique · Honor the requested model override — This provider does pass `request.model` to the CLI, so the override itself is honored; however, the cache identity is derived only from the provider's profile model. A request over (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:338)
  • high · critique · Drain child output while writing the request — Stdout and stderr are not read until the entire request has been written and stdin is closed. For a large request or a CLI that emits output before consuming all input, the child c (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:177)
  • high · critique · Start the timeout before writing child stdin — The 120-second timeout is created only after `write_all` and `shutdown` complete. A blocked pipe write can therefore wait indefinitely and bypass the provider timeout, even though (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:181)
  • high · critique · Pass system instructions through the CLI system-prompt option — The CLI supports a dedicated system-prompt option, but this implementation puts system instructions into the ordinary stdin transcript instead. That changes their precedence and ma (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:59)
  • high · critique · Exclude claude-agent-sdk responses from caching — This provider executes a Claude CLI turn that can perform file and shell side effects, but it still exposes a cache identity. A cache hit can replay the response without rerunning (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:318)
  • high · critique · Use the Claude CLI budget option — Claude Code's budget flag is `--max-budget-usd`, not `--budget`. When `max_budget_usd` is configured, the subprocess will reject the unknown option or fail to enforce the requested (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:74)
  • high · critique · Exclude claude-agent-sdk responses from caching — This provider executes a Claude CLI turn that can perform file and shell side effects, but the provider identity is still exposed to the normal response-cache path. A cache hit can (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:126)
  • medium · critique · Reject oversized base64 before decoding — The size check runs only after decoding `data`, so an attacker or large attachment can supply an arbitrarily long base64 string and force allocation and CPU use before the 5 MiB li (crates/tinyagents\-harness/src/providers/claude\_code/input\_builder\.rs:232)
  • high · security · Drain child output while writing a large request — The parent writes the entire request before reading either stdout or stderr. A Claude process can fill its stdout pipe while consuming stdin, causing both processes to block indefi (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:177)
  • high · security · Handle empty non-system histories before subtracting — When `messages` contains only system messages, `non_system.len()` is zero and evaluating `non_system.len() - 1` underflows. The existing empty-history test reaches this expression (crates/tinyagents\-harness/src/providers/claude\_code/input\_builder\.rs:38)
  • high · security · Start the timeout before writing child stdin — The 120-second timeout begins only after the complete request has been written and stdout/stderr have been taken. A blocked or slow stdin write can therefore run without the invoca (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:214)
  • high · security · Pass the Claude CLI budget option — The Claude CLI option is `--max-budget-usd`, not `--budget`. When `max_budget_usd` is configured, this invocation will be rejected by the CLI instead of enforcing the requested bud (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:71)
  • high · security · Pass system instructions through the CLI system-prompt option — System instructions are embedded in ordinary stdin text using delimiters instead of being passed through Claude's dedicated system-prompt option. This makes the system content part (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:58)
  • medium · security · Bound encoded image data before decoding — The image marker contains user-controlled base64, and `decode(data)` allocates the decoded buffer before `bytes.len()` is checked. An oversized marker can therefore cause excessive (crates/tinyagents\-harness/src/providers/claude\_code/input\_builder\.rs:232)
  • medium · security · Check the literal image prefix before the native prefix — `LITERAL_NATIVE_IMAGE_PREFIX` (`[OH_IMAGE_LITERAL:`) starts with `NATIVE_IMAGE_PREFIX` (`[OH_IMAGE:`). When a literal marker is encountered, both prefixes match at the same offset (crates/tinyagents\-harness/src/providers/claude\_code/input\_builder\.rs:171)
  • high · tests · Exclude claude-agent-sdk provider from response caching — The response cache decision block only disables caching for `claude-code`. The `claude-agent-sdk` provider (`ClaudeAgentSdkProvider`) also executes file and shell tools inside the (crates/tinyagents\-harness/src/agent\_loop/model\_call\.rs:87)
  • high · tests · Classify subprocess errors before converting to Error::Model — Every failure from `invoke_cli` — spawn error, non-zero exit, timeout, CLI error message — is unconditionally mapped to `Error::Model`, which the harness treats as potentially retr (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs:343)
  • high · tests · Reject symlinked settings before loading permissions — `std::fs::read` follows symlinks transparently. If an attacker can write a symlink at `claude_code_settings.json` pointing to a sensitive file, `load` will read it. Resolve the pat (crates/tinyagents\-harness/src/providers/claude\_code/settings\.rs:39)
  • high · tests · Prevent settings writes from following symlinks — `std::fs::write` follows symlinks. If an attacker placed a symlink at `claude_code_settings.json` pointing outside the workspace, the write would escape. Canonicalize the path and (crates/tinyagents\-harness/src/providers/claude\_code/settings\.rs:66)
  • critical · description · Use the resolved failure-module path for provider classification — `classify_provider_failure` and `ProviderFailureClass` were moved into `tinyinference_llm::failure` in a previous commit. This code invokes `tinyinference_llm::classify_provider_fa (\(pull request description\))

Previously reported and still active

  • Fail closed when the session store cannot be read
  • Prefer the longest matching prefix at the same offset

Resolved this pass

  • Add the declared provider modules before exporting them
  • Handle empty non-system histories before subtracting
  • Honor the requested model override
  • Do not advertise unsupported harness tool calls
  • Process assembled assistant text when no stream deltas arrived
  • Add the declared provider modules before exporting them
  • Declare the tinyinference_llm dependency
  • Declare the renamed inference crate dependency
  • Use a declared dependency name
  • Handle empty non-system histories before subtracting
  • Pass system instructions through the CLI system-prompt option
  • Pass the Claude CLI budget option
  • Honor the requested model override
  • Do not advertise unsupported harness tool calls
  • Process assembled assistant text when no stream deltas arrived
  • Import the declared tinyinference crate
  • Use a declared inference crate
  • Add the declared provider modules before exporting them
  • Preserve the retry classification API
  • Do not advertise unsupported harness tool calls
  • Pass the system instructions through the CLI system-prompt option
  • Honor the requested model override
  • Process assembled assistant text when no stream deltas arrived
  • Do not advertise unsupported harness tool calls
  • Honor the requested model override
  • Handle empty non-system histories before subtracting
  • Honor the requested model override
  • Do not advertise unsupported harness tool calls
  • Process assembled assistant text when no stream deltas arrived
  • Handle empty non-system histories before subtracting
  • Add the declared provider modules before exporting them
  • Preserve the retry classification API
  • Declare the tinyinference_llm dependency
  • Declare the renamed inference crate dependency
  • Use a declared dependency name
  • Handle empty non-system histories before subtracting
  • Pass system instructions through the CLI system-prompt option
  • Drain child output while writing a large request
  • Pass the Claude CLI budget option
  • Start the timeout before writing child stdin
  • Honor the requested model override
  • Do not advertise unsupported harness tool calls
  • Process assembled assistant text when no stream deltas arrived
  • Import the declared tinyinference crate
  • Use a declared inference crate
  • Honor the requested model override
  • Do not advertise unsupported harness tool calls
  • Pass system instructions through the CLI system-prompt option
  • Drain child output while writing a large request
  • Collect stderr before returning the timeout error
  • Bound the base64 input before decoding

Before merge

  • Address carried finding Fail closed when the session store cannot be read.
  • Address carried finding Prefer the longest matching prefix at the same offset.
  • Address Declare the tinyinference_llm dependency (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Declare the tinyinference_llm dependency (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Clone usage before reusing the response field (crates/tinyagents\-harness/src/providers/claude\_code/mod\.rs).
  • Address Preserve the retry classification API (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Preserve the provider retry classification (crates/tinyagents\-harness/src/providers/claude\_code/mod\.rs).
  • Address Start the timeout before writing child stdin (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Honor the requested model override (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Drain child output while writing the request (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Start the timeout before writing child stdin (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Pass system instructions through the CLI system-prompt option (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Exclude claude-agent-sdk responses from caching (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Use the Claude CLI budget option (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Exclude claude-agent-sdk responses from caching (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Drain child output while writing a large request (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Handle empty non-system histories before subtracting (crates/tinyagents\-harness/src/providers/claude\_code/input\_builder\.rs).
  • Address Start the timeout before writing child stdin (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Pass the Claude CLI budget option (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Pass system instructions through the CLI system-prompt option (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Exclude claude-agent-sdk provider from response caching (crates/tinyagents\-harness/src/agent\_loop/model\_call\.rs).
  • Address Classify subprocess errors before converting to Error::Model (crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs).
  • Address Reject symlinked settings before loading permissions (crates/tinyagents\-harness/src/providers/claude\_code/settings\.rs).
  • Address Prevent settings writes from following symlinks (crates/tinyagents\-harness/src/providers/claude\_code/settings\.rs).
  • Address Use the resolved failure-module path for provider classification (\(pull request description\)).
Agent review details

critique

  • Conclusion: Failure
  • Scope reviewed: all assigned evidence
  • Lane summary: Reviewed 5 files; 18 findings. (7 earlier finding(s) still open) (3 observation(s) grouped into shared inline comments) (+4 more not shown) _The code index is behind this pull request (indexed at `063ec0ebdae7`), so retrieved context may be out of date._ _3 memory call(s) failed (model: cortex: v1/answer answered 502 Bad Gateway), so this review saw part of what the engine holds._
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Declare the tinyinference_llm dependency
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Declare the tinyinference_llm dependency
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_code/mod\.rs — Clone usage before reusing the response field
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Preserve the retry classification API
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_code/mod\.rs — Preserve the provider retry classification
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Start the timeout before writing child stdin
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Honor the requested model override
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Drain child output while writing the request
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Start the timeout before writing child stdin
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Pass system instructions through the CLI system-prompt option
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Exclude claude-agent-sdk responses from caching
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Use the Claude CLI budget option
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Exclude claude-agent-sdk responses from caching
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_code/input\_builder\.rs — Reject oversized base64 before decoding

security

  • Conclusion: Failure
  • Scope reviewed: all assigned evidence
  • Lane summary: Reviewed 5 files; 8 findings. (11 earlier finding(s) still open) (3 observation(s) grouped into shared inline comments) (+1 more not shown) _The code index is behind this pull request (indexed at `063ec0ebdae7`), so retrieved context may be out of date._ _3 memory call(s) failed (model: cortex: v1/answer answered 502 Bad Gateway), so this review saw part of what the engine holds._
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Drain child output while writing a large request
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_code/input\_builder\.rs — Handle empty non-system histories before subtracting
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Start the timeout before writing child stdin
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Pass the Claude CLI budget option
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Pass system instructions through the CLI system-prompt option
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_code/input\_builder\.rs — Bound encoded image data before decoding
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_code/input\_builder\.rs — Check the literal image prefix before the native prefix

tests

  • Conclusion: Failure
  • Scope reviewed: all assigned evidence
  • Lane summary: The pull request adds the Claude Code CLI and Claude Agent SDK subprocess providers, renames the inference crate to `tinyinference-llm`, and wires response caching with a side-effect exclusion for the Claude Code provider. Several earlier high-severity findings are resolved, but seven issues remain unfixed: the timeout path in the Claude Code driver loses stderr, base64 image data is decoded without a length pre-check, settings load/save follow symlinks, the session store fails open on read errors, the claude-agent-sdk provider is excluded from response caching, the image-marker prefix matcher prefers the shorter match, and the agent-sdk provider classifies all subprocess errors as retryable. (1 finding discarded for not matching a changed line) (2 earlier finding(s) still open) (+3 more not shown) _The code index is behind this pull request (indexed at `063ec0ebdae7`), so retrieved context may be out of date._ _3 memory call(s) failed (model: cortex: v1/answer answered 502 Bad Gateway), so this review saw part of what the engine holds._
  • Evidence: crates/tinyagents\-harness/src/agent\_loop/model\_call\.rs — Exclude claude-agent-sdk provider from response caching
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_agent\_sdk/mod\.rs — Classify subprocess errors before converting to Error::Model
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_code/settings\.rs — Reject symlinked settings before loading permissions
  • Evidence: crates/tinyagents\-harness/src/providers/claude\_code/settings\.rs — Prevent settings writes from following symlinks

commits

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

description

  • Conclusion: Failure
  • Scope reviewed: all assigned evidence
  • Lane summary: This revision adds the Claude Agent SDK subprocess provider and completes the Claude Code provider's stdin builder. Several earlier issues are resolved, including model override, tool-calling advertisement, system prompt piping, and stderr collection. One critical compilation issue remains: the provider-classification imports in `claude_code/mod.rs` may not resolve because `classify_provider_failure` and `ProviderFailureClass` were moved into `tinyinference_llm::failure`. (16 earlier finding(s) still open) (+1 more not shown) _The code index is behind this pull request (indexed at `063ec0ebdae7`), so retrieved context may be out of date._ _3 memory call(s) failed (model: cortex: v1/answer answered 502 Bad Gateway), so this review saw part of what the engine holds._
  • Evidence: \(pull request description\) — Use the resolved failure-module path for provider classification

e2e

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: No end-to-end harness in this repository: no e2e test files and no e2e workflow.
Evidence and run details
  • Models: ladder/vectors, gpt-5.6-luna, deepseek-v4-flash
  • Spend: $0.050663
  • Tokens: 1243905 input · 63876 output · 206212 cached · 1198 embedding
  • Continuity: summary cache chain restarted at the storage ceiling.
Head State Pass summary
204495e38438 changes requested 22 active finding(s), 0 resolved finding(s) (at 1789756497)
86a67c93eebc changes requested 26 active finding(s), 51 resolved finding(s) (at 1789757515)

tinysweeper 0.1.0

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 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-09-18T18:41:04.981867Z 86a67c9 New commits
ℹ️ 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.

@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

Here are some automated review suggestions for this pull request.

Reviewed commit: 22230c5dbf

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

Comment thread crates/tinyagents-harness/src/providers/claude_agent_sdk/mod.rs Outdated
Comment thread crates/tinyagents-harness/src/providers/claude_code/mod.rs Outdated
Comment thread crates/tinyagents-harness/src/providers/claude_code/mod.rs Outdated
Comment thread crates/tinyagents-harness/src/providers/claude_code/driver.rs Outdated
Comment thread crates/tinyagents-harness/src/providers/claude_code/mod.rs
Co-authored-by: Medulla <medulla@tinyhumans.ai>

@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

Here are some automated review suggestions for this pull request.

Reviewed commit: 805d64fa25

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

Comment thread crates/tinyagents-harness/src/providers/claude_code/mod.rs Outdated
Comment thread crates/tinyagents-harness/src/providers/claude_code/driver.rs
Comment thread crates/tinyagents-harness/src/providers/claude_code/mod.rs Outdated
Comment thread crates/tinyagents-harness/src/providers/claude_agent_sdk/mod.rs Outdated
senamakel and others added 2 commits September 18, 2026 21:20
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>

@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

Here are some automated review suggestions for this pull request.

Reviewed commit: 063ec0ebda

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

Comment thread crates/tinyagents-harness/src/providers/claude_code/mod.rs Outdated
Comment thread crates/tinyagents-harness/src/providers/claude_code/mod.rs
Comment thread crates/tinyagents-harness/src/providers/claude_code/mod.rs
Co-authored-by: Medulla <medulla@tinyhumans.ai>

@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

Here are some automated review suggestions for this pull request.

Reviewed commit: 86a67c93ee

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

Comment on lines +74 to +75
args.push("--budget".to_string());
args.push(format!("{budget:.4}"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pass the supported budget flag to Claude

When max_budget_usd is configured, every invocation adds --budget, but the Claude Code CLI reference documents the non-interactive spending limit as --max-budget-usd <amount>. The subprocess therefore rejects the optional budget configuration instead of enforcing it; pass the documented flag and cover the configured invocation with a process-level test.

Useful? React with 👍 / 👎.

Comment on lines +334 to +336
let messages = coalesce_prompt_tool_results(&request.messages);
let messages = with_prompt_tool_instructions(&messages, &request.tools);
let system = coalesce_system_prompt(&messages);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Forward structured formats through the Agent SDK adapter

When a caller supplies ResponseFormat::JsonSchema or ResponseFormat::JsonObject, this adapter preprocesses messages and tools but never includes request.response_format in the CLI prompt. Explicit schema requests use the harness's provider-schema strategy, so an ordinary prose response then fails extraction even though the request asked for structured output. Add the corresponding JSON instruction before invoking the CLI and exercise both request shapes in a focused provider test.

AGENTS.md reference: AGENTS.md:L64-L68

Useful? React with 👍 / 👎.

Comment on lines +310 to +315
let schema = match format? {
ResponseFormat::JsonSchema { name, schema } | ResponseFormat::Auto { name, schema } => {
Some((name, schema))
}
ResponseFormat::Text | ResponseFormat::JsonObject => None,
}?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Instruct Claude Code to honor JSON-object requests

Fresh evidence after the earlier JSON-schema fix is that ResponseFormat::JsonObject is still explicitly mapped to no instruction. For direct callers and validation middleware requesting this format, Claude therefore receives no JSON-only constraint and can return prose that fails JSON parsing; emit a JSON-only instruction for this variant and add a focused request-shape test.

AGENTS.md reference: AGENTS.md:L64-L68

Useful? React with 👍 / 👎.

Comment on lines +106 to +108
if subtype.as_deref() == Some("error") && self.error.is_none() {
self.error = Some("claude reported `result.subtype=error`".into());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject every error result subtype

When the CLI terminates a turn with an error result such as error_max_turns, error_during_execution, or another non-success subtype, this exact equality does not set mapper.error; the driver can consequently return an empty or partial successful response and persist the session. Parse the result's is_error field (already modeled by the sibling Agent SDK protocol), or treat every recognized non-success subtype as failure, and add an error-transcript test.

AGENTS.md reference: AGENTS.md:L64-L68

Useful? React with 👍 / 👎.

Comment on lines +598 to +602
anyhow::bail!(
"[claude-code][driver] exit {:?} stderr={}",
status.code(),
stderr_text.trim()
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Recover from stale persisted Claude sessions

When a previously persisted Claude session no longer exists—for example after the CLI's local session data is cleaned or moved—the resumed process exits nonzero here, but its thread mapping remains unchanged. Every retry for that thread consequently launches the same invalid --resume UUID and can never reach the new-session path; remove the stale mapping and retry once with a fresh --session-id when resume reports a missing session.

Useful? React with 👍 / 👎.

Comment on lines +54 to +58
let serialized = serde_json::to_string_pretty(&*guard).map_err(std::io::Error::other)?;
if let Some(parent) = self.path.parent() {
std::fs::create_dir_all(parent)?;
}
std::fs::write(&self.path, serialized)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Serialize session-store updates across provider instances

When two ClaudeCodeProvider instances use the same workspace—a normal setup when registering multiple Claude models—each opens an independent in-memory SessionStore. This write serializes only that instance's stale map and replaces the whole shared file, so provider B can erase mappings provider A just persisted; after restart those conversations lose resumability. Coordinate stores by path or reload and atomically merge under a shared/file lock before replacing the file.

Useful? React with 👍 / 👎.

Comment on lines +25 to +28
`--session-id` is used on a new CC session and `--resume` afterwards; the UUID
comes from `session_store.rs`, keyed by a SHA-256 hash of the conversation's
first user message (`thread_key_from_messages`) because the real OpenHuman
thread id is not yet plumbed through `ChatRequest`. `cwd` is

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Document the actual caller-provided session key

This module README still tells integrators that sessions are keyed by a hash of the first user message and that thread IDs are unavailable, while thread_key_from_request now requires caller-provided metadata and deliberately creates a fresh ephemeral key otherwise. A host following this documentation will omit metadata.thread_id and silently lose session continuity on every turn; update this section and the stale file-map references to match the public adapter behavior.

AGENTS.md reference: AGENTS.md:L76-L80

Useful? React with 👍 / 👎.

@senamakel
senamakel merged commit 124dc35 into main Sep 18, 2026
4 checks passed

@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.

Requesting changes: 4 lane(s) blocking, worst finding is critical.

Fix or reply to the findings below and push. The next review clears this automatically once they are gone — you should not need to dismiss anything by hand.

             $0.0507 · 1,243,905 in / 63,876 out · 206,212 cached (17%) · ladder/vectors, gpt-5.6-luna, deepseek-v4-flash · 1,198 embedded
critique:    $0.0236 · 448,556 in   / 33,737 out · 52,079 cached (12%)  · gpt-5.6-luna, deepseek-v4-flash
security:    $0.0212 · 392,251 in   / 13,573 out · 14,869 cached (4%)   · gpt-5.6-luna
tests:       $0.0035 · 278,899 in   / 10,713 out · 138,240 cached (50%) · deepseek-v4-flash
description: $0.0025 · 124,199 in   / 5,853 out  · 1,024 cached (1%)    · deepseek-v4-flash

use crate::tool::{coalesce_prompt_tool_results, with_prompt_tool_instructions};
use anyhow::Context;
use async_trait::async_trait;
use tinyinference_llm::message::Message;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority critical critique confident

Declare the tinyinference_llm dependency

The reviewed repository has no Cargo manifest declaring tinyinference_llm, so this new provider cannot compile. Add the package dependency under the declared crate name, or import the inference crate that the workspace actually declares.

[RULE] undeclared-dependency ·

}

/// Prompt-guided chat model backed by `claude -p`.
pub struct ClaudeAgentSdkProvider {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority critical critique confident

Declare the tinyinference_llm dependency

This file imports tinyinference_llm, but the reviewed repository does not declare that dependency name in its Cargo manifests. The provider therefore cannot compile until the package dependency is declared under that name or the import is changed to the crate name the workspace actually provides.

[RULE] declared-dependency ·

}

fn model_response(response: ChatResponse) -> ModelResponse {
let usage = response.usage.map(|value| Usage {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority critical critique confident

Clone usage before reusing the response field

Option::map takes ownership of response.usage. model_response then reads response.usage again when constructing raw, so this new module does not compile unless the usage field is unexpectedly Copy (the contained usage value is not shown as such here). Clone the option or compute the raw value before moving the field.

Suggested change
let usage = response.usage.map(|value| Usage {
let usage = response.usage.clone().map(|value| Usage {

[RULE] use-after-move ·

let output = self
.invoke_cli(system.as_deref(), &transcript, model)
.await
.map_err(|error| tinyinference_llm::Error::Model(error.to_string()))?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority critical critique confident

Preserve the retry classification API

Every subprocess failure is flattened into the generic Model error. This loses the structured provider/transport classification and retryability information expected by the harness retry policy, so transient CLI or transport failures will not be retried according to policy. Convert the error into the inference crate's structured provider error while preserving retryability and any stable error code.

[RULE] error-classification-loss ·

tinyinference_llm::ProviderFailureClass::NonRetryable
| tinyinference_llm::ProviderFailureClass::NonRetryableRateLimit
) {
tinyinference_llm::Error::Model(message)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority critical critique confident

Preserve the provider retry classification

This converts every failure that is not classified as a non-retryable error into the generic Error::Model, and converts the remaining cases into Error::Validation. That discards the structured provider classification, including rate-limit and transient categories, so the harness retry policy cannot reliably distinguish retryable failures from validation failures. Return an error variant carrying the classification (or the retryable flag/code) instead of collapsing it to these two generic variants.

[RULE] preserve-retry-classification ·

max_budget_usd: Option<f64>,
) -> ClaudeInvocation {
let stdin = match system_prompt {
Some(system) if !system.trim().is_empty() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority high security confident

Pass system instructions through the CLI system-prompt option

System instructions are embedded in ordinary stdin text using delimiters instead of being passed through Claude's dedicated system-prompt option. This makes the system content part of the user-visible transcript and allows surrounding prompt content to affect how those delimiters are interpreted, weakening the system-instruction boundary. Add --system-prompt and its value to the CLI arguments and keep the request body as the non-system transcript.

[RULE] ignored-provider-option ·

// Replaying a cached first turn would skip those side effects entirely,
// so this provider is never response-cacheable. Other providers retain
// the normal request-policy behavior.
let side_effecting_provider = binding

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority high tests confident

Exclude claude-agent-sdk provider from response caching

The response cache decision block only disables caching for claude-code. The claude-agent-sdk provider (ClaudeAgentSdkProvider) also executes file and shell tools inside the subprocess turn; replaying its cached response would skip those side effects entirely. Add "claude-agent-sdk" to the condition so caching is also disabled for that provider.

[RULE] missing-cache-exclusion ·

.as_deref()
.or(self.profile.model.as_deref())
.unwrap_or(&self.config.default_model);
let output = self

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority high tests confident

Classify subprocess errors before converting to Error::Model

Every failure from invoke_cli — spawn error, non-zero exit, timeout, CLI error message — is unconditionally mapped to Error::Model, which the harness treats as potentially retryable. Spawn failures (e.g., binary not found, permission denied) and non-zero exits are permanent and will cause infinite retries. Use the same map_error pattern as claude_code/mod.rs (call classify_provider_failure and return Error::Validation for non-retryable cases).

[RULE] unclassified-error ·


/// Loads settings from the host-selected settings directory. A missing,
/// unreadable, or corrupt file yields safe defaults with full access disabled.
pub fn load(workspace_dir: &Path) -> ClaudeCodeSettings {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority high tests confident

Reject symlinked settings before loading permissions

std::fs::read follows symlinks transparently. If an attacker can write a symlink at claude_code_settings.json pointing to a sensitive file, load will read it. Resolve the path to its real (canonical) path first and verify it is under an allowed directory. Use std::fs::canonicalize and check it's within the expected workspace. Same issue applies to save at the std::fs::write call.

[RULE] symlink-following ·

std::fs::create_dir_all(parent)?;
}
let json = serde_json::to_vec_pretty(settings).map_err(std::io::Error::other)?;
std::fs::write(&path, json)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority high tests confident

Prevent settings writes from following symlinks

std::fs::write follows symlinks. If an attacker placed a symlink at claude_code_settings.json pointing outside the workspace, the write would escape. Canonicalize the path and verify it is under the intended workspace before writing.

[RULE] symlink-following ·

@tinysweeper tinysweeper Bot added the priority: p0 Drop what you are doing. Data loss, a live break, or an exploitable hole. label Sep 18, 2026
@senamakel
senamakel deleted the migrate-inference-to-tinyinference branch September 19, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p0 Drop what you are doing. Data loss, a live break, or an exploitable hole.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant