Skip to content

fix(mission): pin the cora review guidance in the mission prompt - #537

Merged
ajianaz merged 2 commits into
developfrom
feat/mission-review-guidance
Nov 10, 2026
Merged

ajianaz merged 2 commits into
developfrom
feat/mission-review-guidance

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

What

A fresh tole mission session now carries the cora agent-as-reviewer guidance in its pinned system prompt when the review tools are attached, like run, chat and the TUI already do.

Why

tole mission builds its registry through the same build_registry path as run, so with cora on PATH it gets the auto-attached mcp_cora_* tools. But review_section() was only called from run, chat and the TUI, so a mission had the tools and never learned the review flow existed: the unattended command was the one that did not know it. Closes #536.

The issue also asked to check serve, acp and mcp. They are different by design: those faces serve their own registry, --mcp-server is refused there (check_client_session_flags) and open_session builds its roster with no mcp_servers. So they have no review tools, and a review section there would instruct the model to call tools that do not exist. I left them unchanged and documented it.

Changes

  • mission.rs: fresh_mission_prompt() = default prompt + mission addendum + mission_review_section(). The section is review_section(&registry) (empty unless both mcp_cora_cora_review_prepare and mcp_cora_cora_review_finalize are registered) plus one sentence: review the change with this flow before ending the mission, address what it blocks, include the verdict in the final message. It comes after the mission contract, so the completion-marker rules are not displaced.
  • Guidance only. A gate before git commit is feat(git): review gate before git commit (cora agent-as-reviewer, on by default when attached) #534. Resumed missions keep their already pinned prompt (append-only).
  • README (ecosystem paragraph) says which faces get the guidance and why the server faces do not; CHANGELOG [Unreleased] entry.

Testing

  • cargo test --workspace passes
  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets -- -D warnings passes
  • Cora review run locally: not run (cora is not installed where this was written); the CI Cora Review job is the verdict.
  • Unit test: the prompt names the review flow only when both tools are registered (none, one, both), keeps the mission contract, and the review text sits after it.
  • End-to-end test (mission_e2e.rs): the real binary, a stand-in cora on PATH that speaks MCP over stdio and lists the two review tools; the pinned session header contains the review section and the mission contract. Control run with --no-auto-mcp: no review section. Mutation checked: making mission_review_section empty fails the e2e test.
  • Not tested: a real cora binary (the stand-in speaks only initialize and tools/list).

Related Issues

Closes #536. Related: #534 (review gate before commit), #535 (tole setup cora).

Checklist

  • Branch name follows convention (feat/)
  • Branch is from develop
  • Commit messages follow Conventional Commits
  • No secrets or credentials committed
  • One logical change per PR

Generated by Claude Code

`tole mission` builds its registry like `run`, including the
auto-attached `mcp_cora_*` tools, but its pinned system prompt never
named the review flow, so the unattended command did not know it existed.
When both review tools are registered, a fresh mission prompt now carries
the same review section as run/chat/tui plus one sentence asking for a
review (and its verdict in the final message) before the mission ends.

serve/acp/mcp sessions are unchanged on purpose: they attach no external
MCP servers, so they have no review tools. Documented in the README.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

The `cora mcp` auto-preset (and --no-auto-mcp) only exist with the `mcp`
feature, so the e2e test failed in the `no-mcp profile` CI job. Gate the
test and its fake-cora helper on `all(unix, feature = "mcp")`.

ajianaz commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

CI: no-mcp profile failed on mission_e2e::mission_prompt_names_the_cora_review_flow_when_cora_is_attached. This one is this PR's, my own test; fixed.

  • Cause: the new e2e test relies on the cora mcp auto-preset (and --no-auto-mcp), which only exist with the mcp feature. The no-mcp profile job builds tole-cli without it, so no review tools attach and the assertion that the pinned prompt names the review flow fails.
  • Reproduced locally with cargo test -p tole-cli --no-default-features --features shell-tools --test mission_e2e (the same failure at the same line).
  • Fix: the test and its fake-cora helper are now gated on all(unix, feature = "mcp").
  • Checked: that same command now passes (5 tests), the default-feature run passes (6 tests, including the new one), cargo check -p tole-cli for --no-default-features and --features shell-tools, clippy with -D warnings for the default and the shell-tools profiles, and --bin tole unit tests in the shell-tools profile (69 pass).

Generated by Claude Code

@ajianaz
ajianaz merged commit 6c71d71 into develop Nov 10, 2026
22 of 24 checks passed
@ajianaz
ajianaz deleted the feat/mission-review-guidance branch November 11, 2026 04:10
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.

feat(serve): give serve, ACP, MCP and mission sessions the cora review guidance

2 participants