Subagent/coding tools agent integration c77be280 - #1
Open
fffonion wants to merge 94 commits into
Open
Conversation
Replace the blocked provider.call/tool.dispatch skeleton with a real serial loop in rss/agent/main.rss. The loop builds canonical LlmRequest maps and invokes the selected provider adapter through a bounded native RSS host bridge in rss_runner; tool calls dispatch serially via the Task5 DispatchContext without resetting its cumulative budget. Follow-up assistant tool_call parts use lossless arguments_json strings, and tool results stay user-role tool_result parts so OpenAI Chat and other adapters consume one contract. Provider/network errors consume the existing retry/backoff budget; completed tool effects are never retried. Parallel and task dispatch stay typed unsupported. Tests drive a scripted provider plus the native dispatch bridge covering text-only, serial tools, retry, budgets, cancel/deadline, and malformed responses, and convert a real loop follow-up through the OpenAI Chat request builder.
Release-parallel dispatch tests raced reopen against a previous exclusive holder whose Drop still ran on another thread. Retry the non-blocking flock briefly so a dead store can release before the open fails closed; a live second writer still gets artifact_store_busy.
Share ToolResult serialized caps, ToolOwner validation, workspace/output ceilings, and caller cancellation/deadline across file, terminal, and process tools. ArtifactStore implements ProcessArtifactSink with owner-scoped cleanup.
Pin pd-vm to f9ca414 and replace terminal path check-use cwd with a retained ConfinedFsRoot, open_directory, and with_confined_cwd.
Serial native dispatch validates names and JSON Schema against the admitted registry snapshot before any effect. Lifecycle events are committed in requested/started/output/completed-or-failed order, with no publication after terminal ownership or a failed durable append. Terminal and process calls use a linked per-call cancellation token so core process Drop cannot cancel the run; a bounded RAII watcher relays run/stop cancellation and joins before returning. File calls use the run token directly.
Pool owner-scoped ArtifactStore by identity-safe root so concurrent runs in one workspace share one store while different roots stay isolated. Close and quiesce the run serial gate before owner cleanup so in-flight puts cannot commit after drop. Derive executor and envelope caps from admitted RunLimits.max_tool_output_bytes, keep stdout+stderr in overflow artifacts, and initialize native dispatch in two phases without holding the handle lock across filesystem IO.
Commit canonical durable tool-call/result schema, step transactions before live publish, idempotent replay, interrupted-effect recovery, and atomic final assistant + run.completed.
Reserve seq/ordinal without partial-moving RSS maps, attach tool results only after a live handle and assistant parent exist, and refuse pending-provider retry on worker terminals while still recovering gateway_restart runs.
Include optional RunContext.coding_system_prompt in the VM map and prepend it once onto local loop LlmRequest messages without mutating durable rows or leaking into loop events.
Wire run_worker to AgentRunner with production/scripted provider hosts and the run-scoped native dispatcher. Keep RunHandle.cancellation as the sole root, pass remaining admission deadline without reset, restore expired wall-clock deadlines as typed cancel, and wait for process-owner cleanup before the terminal commit.
Wire replay-safe coding-activity counters at the provider-host call and durable dispatch seams. Model calls count each actual host attempt, including retryable failures; turns count only successfully normalized responses; tool counters follow the dispatcher's new-vs-replay decision.
Bound uncooperative host cleanup and fail closed when teardown does not quiesce. Restore Stopping runs by requesting cancel before the next provider call, reject huge persisted deadlines as typed errors, treat injected providers as one-shot, and interrupt retry backoff on stop. Runner prepare/drive faults disarm the epoch watcher; process teardown reports a cleanup outcome instead of waiting unbounded.
Port both coding E2E suites off lease temp paths, clear inherited git fixture env, and drive terminal argv through a located POSIX sh helper. Tighten durable chain, stop lifecycle, and overflow assertions to exact parent/name/ordinal/truncation contracts, and document both local E2E commands. Mark completed-run reopen as a no-op until pending-turn replay lands on final integration.
Drive coding E2E through production DurableProviderHost with plain ScriptedProvider injection. Replace helper masking with pending-request retry, completed-step replay, and unsafe pending fail-closed coverage, and document the exact durable replay contract including the external exactly-once receiver limitation.
Pass attempt into Task10 unsafe-pending E2E and re-inject the one-shot provider before crash-after-request redrive so Phase B recovery tests match integration worker semantics.
Give RSS tools::dispatch production ownership of the six public tools, remove the native dispatcher, and restore deadline cleanup, public error codes, and canonical tool lifecycle events on the service path.
Compile from_source as supplied bytes, cache programs by module-tree digest, keep a single production worker path through tools::dispatch, and fail closed on process shutdown races and malformed JSON payloads.
Compile from_file against owned snapshot bytes materialized into a private 0700 sandbox, cache and expose that digest on AgentRunner, and publish the service cache only when the postcheck digest still matches.
Document host-owned policy admission, opaque handle lifecycle, canonical bridge envelopes, Stage B snapshot evidence, split Stage C gates, and the Task 8 Codex metadata decision gate.
Workflow-level env cannot use the runner context, so GitHub rejected ci.yml before any job started. Set RUSTSCRIPT_AGENT_TEST_TMP from the runner default RUNNER_TEMP through GITHUB_ENV instead.
Replace constant chunks_exact SHA-256 block walks with as_chunks so Rust 1.98 clippy::chunks_exact_to_as_chunks stays clean. as_chunks has been stable since 1.88 and already yields &[u8; 64], so digest padding and remainder handling stay the same without extra conversion.
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.
No description provided.