Simplify harness trigger and async run::start#174
Conversation
Console calls harness::trigger with a flat payload; harness always starts run::start. Remove run::start_and_wait, cwd state keys, and initial agent::events replay at kickoff so the FSM owns turn lifecycle.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
skill-check — worker0 verified, 12 skipped (no docs/).
Three for three. Nicely done. |
Replace manual typeof/Record parsing with shared TurnStateWriteEventSchema and parseTurnStateWrite, matching the run-start/trigger refactor style.
Each state-trigger adapter now exports register() with inline function ids, matching run-start.ts. register.ts only composes modules; exported ID constants removed.
… the register condition.
…ng is type-enforced. Share Zod turn_state write parsing between adapters; add handler tests for direct invokes that bypass the engine condition gate.
…ype safety - Simplified `parseStepableWrite` to only return `session_id`, removing the state from its output. - Inlined the handling of stepable writes directly in `handleStepableRecordWrite`, eliminating the fallback to durable publish. - Updated tests to reflect changes in the `parseStepableWrite` output and removed obsolete tests related to fallback logic. - Introduced `StepPayloadSchema` for consistent payload validation in the `turn::step` function, ensuring only valid session IDs are processed. - Added new tests for `StepPayloadSchema` to validate input shapes and error handling. These changes enhance clarity and maintainability of the turn orchestrator's state management logic.
Replace turn::step_requested publishes with queue enqueues in approval resume and abort handling, add turn::should_step filtering for unknown or terminal sessions, and tighten get_state with Zod payload parsing.
Replace the monolithic turn::step subscriber with turn::{state} functions
enqueued on turn-step, consolidate UI turn_state_changed emits into
persistence saves, and merge assistant/function states for a simpler FSM.
Reconcile the turn-orchestrator per-state queue refactor with main's harness-node/ -> harness/ rename and parallel changes: - Map the refactor (per-state handlers, turn-step FIFO queue, Zod boundary parsing, simplified harness::trigger) onto the harness/ tree. - Adopt main's idempotency guards: function_result dedup lands in function-execute.ts via the rename merge; the assistant-message guard is ported into the split assistant-finished.ts handler. - Take main's new providers (kimi/lmstudio/llamacpp), functionNotFoundHint hint, and system-prompt guidance (auto-merged, untouched by the refactor). - Drop on-record-written/on-terminal/on-turn-state-changed/subscriber/ transitions removed by the refactor; keep main's provider tests. - Update functions error-result test for the new executedCalls clear, and re-add idempotency regression tests adapted to the split handlers. typecheck clean; 826 tests pass.
Summary
harness::triggerwith a flat payload only; harness-node always invokesrun::start(no client-suppliedfunction_id).run::startuses Zod defaults, drops unusedcwd/cwd_hashfrom the run payload and iii state, and no longer replays syntheticagent::eventsat kickoff.run::start_and_waitpath (on-terminalwaiter, policy entry,sync_default_timeout_msconfig).Test plan
pnpm run typecheckinharness-nodepnpm testinharness-node(494 tests)Notes
docs/flow HTML was left out of this PR; say if you want it included.run::start_and_waitonmain; out of scope here.