Skip to content

feat: add native mergiraf tool - #38

Merged
trotsky1997 merged 3 commits into
mainfrom
agent/codex-wsl-gpt5-5/145b5055
Jun 2, 2026
Merged

feat: add native mergiraf tool#38
trotsky1997 merged 3 commits into
mainfrom
agent/codex-wsl-gpt5-5/145b5055

Conversation

@trotsky1997

Copy link
Copy Markdown
Owner

Summary

  • add native mergiraf tool contract for merge, solve, and languages actions
  • execute mergiraf via argv-safe local process spawning with bounded JSON envelopes
  • register mergiraf in the built-in catalog and allow-list behavior
  • add fake-binary tests for catalog, argv construction, result envelopes, missing-binary guidance, and truncation

Validation

  • cargo fmt
  • cargo test mergiraf
  • cargo test --test mergiraf_tool
  • cargo test
  • openspec validate mergiraf-native-support --strict --json

Refs #36

Remaining OpenSpec tasks in this change: documentation tasks 3.1-3.3 (README, spec/tools.md, ra.toml/init template docs).

@sourcery-ai sourcery-ai 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.

Sorry @trotsky1997, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@trotsky1997

Copy link
Copy Markdown
Owner Author

Review request note: I attempted to add GitHub reviewer other-top-model, but GitHub returned Could not resolve user with login 'other-top-model'. No addressable GitHub reviewer/team by that name is available from this checkout; review handoff remains to the Multica/owner workflow.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c859af190

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/tools/mergiraf.rs
let ours = required_path(&params.ours, "ours", "merge")?;
let theirs = required_path(&params.theirs, "theirs", "merge")?;

let mut args = vec!["merge".to_string(), base, ours, theirs];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pass --git so merge updates the ours file

For real mergiraf merge calls this argv omits the merge-driver flag, so the command only prints the merge result to stdout and leaves the ours path unchanged. I checked the upstream CLI semantics: the documented Git driver form is mergiraf merge --git %O %A %B, and the implementation writes back to the left/ours file only in the git branch; otherwise it prints the result. In any workflow expecting this native tool to resolve the working-tree file in place, the tool can return ok: true while the conflicted file remains unmodified.

Useful? React with 👍 / 👎.

Comment thread src/tools/mergiraf.rs
Comment on lines +376 to +377
if rendered.len() <= max_output_bytes || best == 0 {
return Ok(rendered);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce max_output_bytes for oversized envelopes

When max_output_bytes is smaller than the fixed JSON envelope, or when stderr/command metadata alone exceed the budget, this branch returns the rendered JSON even though it is still over the requested limit. For example, max_output_bytes: 1 or a very long stderr/cwd still produces an over-budget response despite truncated: true, which violates the tool contract that callers can bound returned output size.

Useful? React with 👍 / 👎.

Comment thread src/tools/mergiraf.rs
Comment on lines +196 to +198
Ok(vec![
"solve".to_string(),
required_path(&params.file, "file", "solve")?,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pass the language override through solve

When solve is used on a conflict file whose extension does not identify the language, upstream mergiraf needs the same --language/-L override that it supports for merge; I checked the upstream CLI, where the shared MergeOrSolveArgs is flattened into both Merge and Solve, and upstream tests run mergiraf solve --language=json. This wrapper accepts language but ignores it for solve, so a caller-supplied override still results in a failed solve for otherwise resolvable files.

Useful? React with 👍 / 👎.

Comment thread src/tools/mergiraf.rs
Comment on lines +189 to +190
if params.allow_parse_errors {
args.push("--allow-parse-errors".to_string());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Don't emit unsupported --allow-parse-errors

When allow_parse_errors is true, the wrapper appends a flag that the current mergiraf CLI does not define; I checked the upstream merge/shared option definitions and they include --debug, --compact, marker length, --language, merge-specific flags like --git, but no --allow-parse-errors. With a real binary this makes the documented option fail argument parsing before any merge runs.

Useful? React with 👍 / 👎.

local and others added 3 commits June 2, 2026 16:18
Adds the full spec-driven planning artifacts for the mergiraf native
tool change: proposal, design, specs (mergiraf-tool + tools delta),
and tasks. Tracked in GitHub issue #36.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
@trotsky1997
trotsky1997 force-pushed the agent/codex-wsl-gpt5-5/145b5055 branch from 4c859af to a9ecc3f Compare June 2, 2026 08:26
@trotsky1997
trotsky1997 merged commit 2caaf09 into main Jun 2, 2026
6 checks passed
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