Skip to content

Simplify harness trigger and async run::start#174

Draft
ytallo wants to merge 10 commits into
mainfrom
feat/harness-trigger-run-start-simplify
Draft

Simplify harness trigger and async run::start#174
ytallo wants to merge 10 commits into
mainfrom
feat/harness-trigger-run-start-simplify

Conversation

@ytallo
Copy link
Copy Markdown
Contributor

@ytallo ytallo commented May 20, 2026

Summary

  • Console sends messages via harness::trigger with a flat payload only; harness-node always invokes run::start (no client-supplied function_id).
  • run::start uses Zod defaults, drops unused cwd / cwd_hash from the run payload and iii state, and no longer replays synthetic agent::events at kickoff.
  • Removes the sync run::start_and_wait path (on-terminal waiter, policy entry, sync_default_timeout_ms config).

Test plan

  • pnpm run typecheck in harness-node
  • pnpm test in harness-node (494 tests)

Notes

  • Untracked docs/ flow HTML was left out of this PR; say if you want it included.
  • ACP still references run::start_and_wait on main; out of scope here.

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.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment May 23, 2026 9:20pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aa582473-33ce-45e3-9c26-1245d1e310fd

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/harness-trigger-run-start-simplify

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.

❤️ Share

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

skill-check — worker

0 verified, 12 skipped (no docs/).

Layer Result
structure
vale
ai

Three for three. Nicely done.

ytallo added 4 commits May 20, 2026 20:08
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.
…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.
ytallo added 2 commits May 22, 2026 19:27
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.
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.

1 participant