Skip to content

Guard make targets with repo-root cd and existence check#135

Merged
sebastientaggart merged 1 commit into
devfrom
feature/submit-review-repo-root
Apr 12, 2026
Merged

Guard make targets with repo-root cd and existence check#135
sebastientaggart merged 1 commit into
devfrom
feature/submit-review-repo-root

Conversation

@sebastientaggart

Copy link
Copy Markdown
Member

The submit-for-review skill runs make targets (CHECK_CMD, MERGE_CMD) in whatever directory the agent happens to be in. If the agent drifted into a subdirectory, the command fails and the agent improvises a partial fallback — silently skipping checks or inventing nonexistent targets like make merge.

Two fixes:

  1. cd "$(git rev-parse --show-toplevel)" before running any make command, so it always resolves against the root Makefile.
  2. make -n <target> existence guard before execution — if the target doesn't exist, the skill halts with a clear error message instead of letting the agent improvise.

Issue #129

@sebastientaggart

Copy link
Copy Markdown
Member Author

Review Summary

Verdict: APPROVE

Findings

  • [NOTE] The instruction "Extract the target name from make check (e.g. make checkcheck)" relies on the AI agent to parse the target from a hardcoded string at runtime. This works for the current make check / make merge commands but would break if CHECK_CMD or MERGE_CMD were ever set to something other than a simple make <target> invocation (e.g. make -C subdir check). Acceptable for now since .codecannon.yaml only supports simple make targets, but worth noting for future extensibility.

  • [NOTE] The 2>/dev/null on make -n silences stderr, which means if make itself is not installed or the Makefile has a syntax error, the agent will report "target does not exist" rather than the actual underlying problem. The error message could be slightly misleading in that edge case, but the fail-closed behavior is correct.

No blocking issues found. The changes are consistent across all five adapter files, the source template uses {{CHECK_CMD}} / {{MERGE_CMD}} placeholders correctly, and the rendered adapters all resolve to make check / make merge as expected. The cd to repo root and make -n existence guard both address the problem described in the PR body (issue #129) and follow the project's fail-closed philosophy.

@sebastientaggart
sebastientaggart merged commit 215c0a9 into dev Apr 12, 2026
6 checks passed
@sebastientaggart
sebastientaggart deleted the feature/submit-review-repo-root branch April 12, 2026 18:44
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