Skip to content

refactor(core): ♻️ Flatten update_plan input and require core fields#228

Merged
jorben merged 1 commit into
masterfrom
refact/flatten-update-plan
Jun 12, 2026
Merged

refactor(core): ♻️ Flatten update_plan input and require core fields#228
jorben merged 1 commit into
masterfrom
refact/flatten-update-plan

Conversation

@HayWolf

@HayWolf HayWolf commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Flatten the update_plan tool schema by removing the redundant nested plan object so the model only sees top-level fields.
  • Add a required array (title, summary, context, design, keyImplementation, steps, verification, risks) so empty-argument calls are rejected at generation time instead of after execution.
  • Make the runtime validation errors self-correcting by listing the expected fields and a minimal valid JSON example, and drop the .get("plan") fallback in build_plan_artifact_from_tool_input.

Motivation

Models (e.g. Claude) repeatedly called update_plan with empty {} arguments and looped on the error update_plan requires a non-empty title .... The schema had no required constraint and exposed an ambiguous nested plan object mirroring the top-level fields, so the machine-readable contract said everything was optional and the model could not self-correct from the opaque error.

Test Plan

  • cargo fmt --check --manifest-path src-tauri/Cargo.toml
  • cargo test --locked --manifest-path src-tauri/Cargo.toml --lib plan (37 passed)
  • Run full cargo test in CI

🤖 Generated with TiyCode

Remove the nested `plan` object from update_plan tool parameters.
All planning fields are now top-level required arguments. This
simplifies the tool interface and prevents ambiguous calls.

Updated validation error messages to clearly indicate missing
required fields. Adjusted plan_checkpoint to read directly from
the root object. Updated tests to verify the new structure.

BREAKING CHANGE: update_plan no longer accepts a nested `plan`
object. Clients must pass all fields as top-level arguments.
@github-actions

Copy link
Copy Markdown

AI Code Review Summary

PR: #228 (refactor(core): ♻️ Flatten update_plan input and require core fields)
Preferred language: English

Overall Assessment

No blocking issue was detected in the reviewed diff; keep focused regression testing before merge.

Major Findings by Severity

No major issues identified from the reviewed diff.

Actionable Suggestions

  • Address the highest severity findings first and add targeted tests for changed logic.

Potential Risks

  • Potential hidden risks remain in edge cases not covered by the current diff context.

Test Suggestions

  • Add happy-path + boundary + failure-path tests for touched modules.

File-Level Coverage Notes

  • src-tauri/src/core/agent_session_execution.rs: ok (Error messages are clearer and use consistent phrasing. Validation logic remains correct.)
  • src-tauri/src/core/agent_session_tests.rs: ok (Test expectations correctly updated to match the flattened schema and required fields.)
  • src-tauri/src/core/agent_session_tools.rs: ok (Schema flattened, redundant nested plan object removed, required fields added. Description updated to forbid nested wrappers.)
  • src-tauri/src/core/plan_checkpoint.rs: ok (Plan artifact builder simplified to read directly from tool_input without checking for nested 'plan' key.)

Inline Downgraded Items (processed but not inline)

  • None

Coverage Status

  • Target files: 4
  • Covered files: 4
  • Uncovered files: 0
  • No-patch/binary covered as file-level: 0
  • Findings with unknown confidence (N/A): 0

Uncovered list:

  • None

No-patch covered list:

  • None

Runtime/Budget

  • Rounds used: 1/4
  • Planned batches: 1
  • Executed batches: 1
  • Sub-agent runs: 1
  • Planner calls: 1
  • Reviewer calls: 1
  • Model calls: 2/64
  • Structured-output summary-only degradation: NO

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated PR review completed.

  • Findings kept: 0
  • Findings with unknown confidence: 0
  • Inline comments attempted: 1
  • Target files: 4
  • Covered files: 4
  • Uncovered files: 0
    See the summary comment for detailed analysis and coverage details.

@@ -1021,17 +1021,17 @@ impl AgentSession {
// meets the quality contract enforced by the system prompt.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review completed for this PR diff. No concrete inline issue was selected after aggregation.

@jorben jorben merged commit f05858c into master Jun 12, 2026
4 checks passed
@jorben jorben deleted the refact/flatten-update-plan branch June 12, 2026 04:50
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