Skip to content

test(serve): a fired agent run sees the rendered template and no Write tools (#582) - #649

Merged
ajianaz merged 1 commit into
developfrom
test/hook-fire-e2e
Nov 12, 2026
Merged

ajianaz merged 1 commit into
developfrom
test/hook-fire-e2e

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What

An end-to-end test for #582: tole serve fires an agent job from a signed webhook delivery, and the test checks the model request that run sends.

Why

The part 2b tests stopped at the claim, so nothing proved that the fenced template rendering reaches the fired run's prompt, or that the run is ReadOnly at the model boundary. This was the gap noted in part 2b (decision 3). The test is split from the tole hook CLI PR (#648) to keep both PRs under ~900 lines.

Changes

  • crates/tole-cli/tests/serve_hook_fire.rs:
    • A new route [hooks.agentic] (cron_job = "writer", template = "commit: {head_commit.message}") and an agent job writer with allow = ["write_file"].

    • mock_provider(): a small OpenAI-compatible server on loopback. It records request bodies and answers done, as SSE when the request asks for a stream and as JSON otherwise.

    • spawn_with(base, mock) points serve at the mock through TOLE_BASE_URL / TOLE_MODEL / TOLE_API_KEY.

    • New test a_fired_agent_run_sees_the_rendered_template_and_no_write_tools. The recorded request must contain:

      • the job's prompt;
      • the UNTRUSTED WEBHOOK DATA fence with commit: bump version;
      • read_file, and no write_file, although the job allows it.

      The run must then settle ok.

  • No production code changes.

Testing

  • cargo fmt --all -- --check
  • cargo clippy -p tole-cli --all-targets --all-features -- -D warnings
  • cargo test -p tole-cli --test serve_hook_fire: 3 passed.
  • The full workspace gates also ran with this test included, on the combined branch before the split.
  • cora review --no-llm --staged: no issues.
  • Mutation breaks in cron/agent.rs, each restored afterwards; the test caught both:
    • the trigger context is not appended to the prompt;
    • roster.plan_mode is forced to false (Write tools offered).

…e tools (#582)

tole serve runs against a mock OpenAI-compatible provider; a signed
delivery fires an agent job, and the recorded model request must carry
the job's prompt, the fenced UNTRUSTED WEBHOOK DATA with the rendered
template, read_file and no write_file. Closes the gap left in part 2b,
whose tests stopped at the claim.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 29b4ccf into develop Nov 12, 2026
25 of 26 checks passed
@ajianaz
ajianaz deleted the test/hook-fire-e2e branch November 20, 2026 08:40
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.

2 participants