Skip to content

Report per-skill status and upstream ref/commit in baml agent install - #3789

Closed
ATX24 wants to merge 4 commits into
canaryfrom
cursor/baml-agent-install-details-0c0e
Closed

ATX24 wants to merge 4 commits into
canaryfrom
cursor/baml-agent-install-details-0c0e

Conversation

@ATX24

@ATX24 ATX24 commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Issue Reference

  • This PR fixes baml agent install --latest not reporting the installed ref/commit or per-skill status.

The error

baml agent install exited 0 and printed a static, uninformative summary. Two runs against the same source produced byte-for-byte identical output, with no indication of whether each skill was created, updated, or already up to date, and no indication of which upstream ref/commit was installed:

$ baml agent install --dir /tmp/staging --from /tmp/skillsrc   # first run
Installed BAML agent skills in /tmp/staging

Claude Code:
  .claude/skills/baml-*/SKILL.md

Codex / OpenCode:
  .agents/skills/baml-*/SKILL.md

Restart any already-running agent session to pick them up.

$ baml agent install --dir /tmp/staging --from /tmp/skillsrc   # second run — identical
Installed BAML agent skills in /tmp/staging
... (exact same text) ...

To verify --latest actually refreshed anything, a user had to capture MD5 checksums before/after and query the GitHub API by hand. There was also no --check dry-run.

Root cause

In baml_language/crates/baml_cli/src/agent_command.rs:

  • install_skills_to overwrote each baml-* skill directory atomically but never compared old vs. new content, so it had no created/updated/unchanged signal to surface.
  • load_skills returned a bare Vec<Skill> and discarded all provenance — the branch/tag/URL it fetched from and the resolved commit were never captured.
  • print_success emitted a fixed string built only from the install root, independent of what actually happened on disk.

The fix

All changes are confined to agent_command.rs:

  • Provenance. load_skills now returns a SkillSource { reference, commit, skills }. For --latest it best-effort resolves the main commit SHA via GET api.github.com/repos/BoundaryML/baml-skill/commits/main and downloads that exact commit so the reported SHA matches the installed bytes (falling back to main if the API is unavailable). --from and the versioned-release path populate a descriptive reference.
  • Per-skill, per-target status. target_statuses reads each existing SKILL.md and classifies it as created / updated / unchanged (already latest) immediately before writing. The summary now prints one status line per skill under each target (Claude Code (.claude/skills), Codex / OpenCode (.agents/skills)) plus the Source: line with the commit when known.
  • --check dry-run. A new --check flag computes and prints the same statuses (would create / would update / up to date) without writing anything, and never creates a missing --dir.

Example after the fix:

Installed BAML agent skills in /tmp/staging
Source: BoundaryML/baml-skill@main (commit 0baf1692be0ff85bbe3fc3ecabe84b00a010b020)

Claude Code (.claude/skills):
  baml-core: unchanged (already latest)
  baml-overview: updated

Codex / OpenCode (.agents/skills):
  baml-core: created
  baml-overview: created

Restart any already-running agent session to pick them up.

Testing

  • Unit tests added/updated — cargo test -p baml_cli agent_command (18 passed), covering status classification, disk-state-aware statuses, --check not writing, install-then-reinstall (created→unchanged), and the rendered report (with/without commit).
  • Manual testing performed — reproduced the original identical-output bug, then confirmed created → unchanged → --check/would-update → updated transitions, and that --check does not create a missing --dir.
  • CI gates: cargo fmt --all, cargo clippy --all-targets -- -D warnings (clean across the workspace), and cargo test -p baml_tests -p baml_lsp2_actions_tests -p baml_cli all pass. No snapshots changed. The only failing tests in a full cargo test --workspace are the sdk_test_python_pydantic2 integration tests, which require uv (not installed in this environment) and are unrelated to this change.

Additional Notes

  • --check intentionally exits 0 (it prints the verdict) to keep the change minimal and avoid repurposing existing error exit codes.
  • CodeRabbit: CODERABBIT_API_KEY was not present in this environment and the CLI could not authenticate non-interactively, so the automated self-review could not be run. The diff was self-reviewed manually instead.

PR Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code (docstrings on all new/changed items)
  • My changes generate no new warnings
Open in Web Open in Cursor 

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a --check flag to run a dry-run that reports what would be created or updated without writing changes.
    • Improved skill source resolution for “latest” and versioned releases, including provenance/status details and SHA256 verification.
  • Improvements

    • Installation output is now report-based: shows install root, source reference (and commit when known), per-skill states (created/updated/unchanged or would-create/would-update), and an “out-of-date” verdict in --check mode.
    • In --check, the install path is resolved without creating missing directories.
  • Tests

    • Added coverage for dry-run behavior, status classification, idempotent reporting, and report rendering.

@vercel

vercel Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
beps Ready Ready Preview, Comment Jun 18, 2026 12:55am
promptfiddle Ready Ready Preview, Comment Jun 18, 2026 12:55am
promptfiddle2 Ready Ready Preview, Comment Jun 18, 2026 12:55am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1d75199a-75f7-418f-aa99-9aad1bff76f9

📥 Commits

Reviewing files that changed from the base of the PR and between b922a89 and a508c5f.

📒 Files selected for processing (1)
  • baml_language/crates/baml_cli/src/agent_command.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • baml_language/crates/baml_cli/src/agent_command.rs

📝 Walkthrough

Walkthrough

Refactors agent_command.rs to add a --check dry-run flag, provenance-aware skill loading (SkillSource with reference and optional commit), per-skill SkillStatus classification, and structured print_report/render_report output. Directory creation is gated on real vs check mode. Unit tests cover all new code paths.

Changes

Agent skill installer: --check mode and provenance reporting

Layer / File(s) Summary
Constants, CLI flag, and provenance/reporting data structures
baml_language/crates/baml_cli/src/agent_command.rs
Adds SKILL_REPO/SKILL_BRANCH constants, check: bool field on AgentInstallArgs, and new structs SkillSource, InstallTarget, SkillStatus, TargetReport plus install_targets() helper.
run() dispatch and provenance-aware skill loading
baml_language/crates/baml_cli/src/agent_command.rs
Refactors AgentInstallArgs::run to resolve install root conditionally, load skills into SkillSource via load_latest_skills/load_skills_from/load_release_skills with best-effort GitHub commit resolution, and branch into check_skills vs install_skills. Updates explicit_install_root to accept create: bool so missing dirs are not created in check mode.
install_skills, check_skills, and target_statuses helpers
baml_language/crates/baml_cli/src/agent_command.rs
Replaces prior orchestration with install_skills (iterates targets, computes target_statuses, writes skills classified as changes, returns TargetReports), check_skills (same without writing), and target_statuses (reads existing SKILL.md and classifies per SkillStatus::classify).
print_report and render_report output
baml_language/crates/baml_cli/src/agent_command.rs
Produces either an "Installed" or "Checked" summary with install root, source reference and optional commit suffix, per-target per-skill status labels, and a final out-of-date summary for --check.
Unit tests
baml_language/crates/baml_cli/src/agent_command.rs
Covers explicit_install_root in check mode (no dir creation), SkillStatus::classify, target_statuses disk-state reading, check_skills not writing to disk, install idempotency reporting, sidecar file preservation, and render_report with/without commit.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • BoundaryML/baml#3689: Introduces the initial baml agent install implementation in agent_command.rs that this PR directly refactors.
  • BoundaryML/baml#3753: Also significantly refactors the same agent_command.rs skill loading and installation flow, modifying --latest/--from dispatch and normalization logic.
  • BoundaryML/baml#3790: Modifies the same agent_command.rs user-facing output path to disclose the baml- name prefix in skill names, running in parallel with this PR's print_report/render_report output refactor.

Poem

🐇 Hippity-hop, the rabbit checks twice,
Before digging holes, it counts what is nice.
A --check flag it hops through the burrow with care,
Reports what would change without ruffling a hair!
Provenance and commits, a trail left behind —
The freshest of skills for the sharpest of mind. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main changes: adding per-skill status reporting and upstream reference/commit tracking to the agent install command.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/baml-agent-install-details-0c0e

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.

@vercel
vercel Bot temporarily deployed to Preview – beps June 17, 2026 19:24 Inactive
@github-actions

github-actions Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 17, 2026 19:30 Inactive
@github-actions

Copy link
Copy Markdown

No description provided.

@ATX24
ATX24 marked this pull request as ready for review June 17, 2026 19:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@baml_language/crates/baml_cli/src/agent_command.rs`:
- Around line 673-674: After the target_statuses call computes per-skill
statuses, filter the skills array to exclude any skills marked as Unchanged
before passing them to the install_skills_to function call. Update the
install_skills_to function signature to accept a reference to a slice of skill
references (&[&Skill]) instead of the current parameter type to accommodate the
filtered skills list. This ensures unchanged skills are not rewritten or have
their directories replaced.
- Around line 715-716: The code at the point where existing is assigned uses
fs::read_to_string(...).ok() which converts all IO errors to None, treating
permission errors and invalid UTF-8 the same as missing files. This prevents
reporting actual read failures to the user. Modify the code to explicitly handle
the Result from fs::read_to_string on the path variable, converting only
NotFound errors to None for the existing variable, while allowing other IO
errors to propagate so they can be properly reported instead of silently
treating them as a missing file scenario.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b8879079-3ee8-4d9f-ba90-304367b6ea7a

📥 Commits

Reviewing files that changed from the base of the PR and between 1581adc and 40a8f92.

📒 Files selected for processing (1)
  • baml_language/crates/baml_cli/src/agent_command.rs

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 17, 2026 20:05 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 17, 2026 20:06 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 17, 2026 20:12 Inactive
…agent install summary conflict

Co-authored-by: Dhilan Shah <[email protected]>
@vercel
vercel Bot temporarily deployed to Preview – beps June 18, 2026 00:35 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 18, 2026 00:41 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle June 18, 2026 00:48 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps June 18, 2026 00:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 June 18, 2026 00:55 Inactive
@ATX24 ATX24 closed this Jun 22, 2026

This branch was previously deployed

3 inactive deployments
Preview – promptfiddle2 — a508c5f9 Deployed Jun 18, 2026 by vercel[bot]
Preview – beps — a508c5f9 Deployed Jun 18, 2026 by vercel[bot]
Preview – promptfiddle — a508c5f9 Deployed Jun 18, 2026 by vercel[bot]
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