Skip to content

Add pre-push verification, diff checks, and commit squashing conventions#619

Open
kelos-bot[bot] wants to merge 1 commit intomainfrom
kelos-config-update-20260309-1800
Open

Add pre-push verification, diff checks, and commit squashing conventions#619
kelos-bot[bot] wants to merge 1 commit intomainfrom
kelos-config-update-20260309-1800

Conversation

@kelos-bot
Copy link

@kelos-bot kelos-bot bot commented Mar 9, 2026

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Adds three new agent conventions based on recurring reviewer feedback across recent PRs:

  1. Run make verify before pushing — Agents frequently push changes that fail CI checks. Reviewer on PR Fix missing source column for GitHubPullRequests and Jira taskspawners #609 explicitly asked the agent to "check the CI and fix it."

  2. Verify diff only contains relevant changes — Agents often include unrelated files in their diffs. In PR Fix stale and disappeared task pod handling for kelos logs #587, reviewer asked to "rebase on origin/main to remove unnecessary patches" (the PR had 22 files changed when only 4 were relevant). In PR Switch kelos-workers from claude-code to codex with gpt-5.4 #573, reviewer limited scope: "let's update only kelos-workers for now."

  3. Squash commits before final push — Reviewer repeatedly used /squash-commits across many PRs: Co-locate AgentConfigs with TaskSpawners and use distinct agent names #555, Add comment-based labeling to label workflow #560, Switch kelos-workers from claude-code to codex with gpt-5.4 #573, Handle label commands across issue, PR, and review surfaces #586, Inject git identity env vars in all commit-producing tasks #591, self-development: Use GPT-5.4 for triage #605. This is the most common reviewer action across the last week.

Changes are applied consistently to:

  • AGENTS.md / CLAUDE.md — project-level conventions for all agents
  • self-development/agentconfig.yaml — shared AgentConfig for self-development agents
  • self-development/kelos-workers.yaml — explicit verification steps in the worker prompt
  • self-development/kelos-pr-responder.yaml — explicit verification steps in the PR responder prompt

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

PR #582 (also from kelos-config-update) is still open and covers different conventions (stay within scope, typed constants, keep docs in sync). This PR does not overlap with #582.

Does this PR introduce a user-facing change?

NONE

Summary by cubic

Adds pre-push verification, diff scope checks, and commit squashing conventions to reduce CI failures, unrelated changes, and noisy histories. Updates AGENTS.md, self-development/agentconfig.yaml, self-development/kelos-workers.yaml, and self-development/kelos-pr-responder.yaml with explicit steps.

  • Migration
    • Run make verify before pushing.
    • Check scope with git diff origin/main --stat (or upstream/main) and revert unrelated files.
    • Squash to a single commit before the final push.

Written for commit c10d13f. Summary will update on new commits.

Agents frequently push changes with CI failures, include unrelated files
in their diffs, and create multi-commit branches that reviewers must
squash. Add explicit conventions for running make verify before pushing,
verifying diff scope, and squashing commits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="self-development/kelos-workers.yaml">

<violation number="1" location="self-development/kelos-workers.yaml:105">
P2: The self-review loop in step 7a adds commits (`make them, commit and push`) without re-squashing or re-running verification. After a couple of review iterations, the branch will have multiple commits again — the same problem this PR aims to fix. Consider changing the loop to squash before each push, e.g., "make them, squash into a single commit, run `make verify`, and push."</violation>
</file>

<file name="self-development/kelos-pr-responder.yaml">

<violation number="1" location="self-development/kelos-pr-responder.yaml:87">
P2: After squashing, a regular `git push` will be rejected because the rewritten history diverges from the remote. Specify `--force-with-lease` to make this step actionable (it's also safer than `--force` since it aborts if someone else pushed in the meantime).</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

- Run `make verify` to catch lint, fmt, and vet issues locally.
- Run `git diff origin/main --stat` to confirm only files relevant to the task are modified. Revert any unrelated changes.
- 6a. Squash your commits into a single clean commit, then push to origin kelos-task-{{.Number}}.
- 7a. /review the PR to verify your changes address the feedback. If changes are needed, make them, commit and push, then /review again. Repeat until the review passes.
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 9, 2026

Choose a reason for hiding this comment

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

P2: The self-review loop in step 7a adds commits (make them, commit and push) without re-squashing or re-running verification. After a couple of review iterations, the branch will have multiple commits again — the same problem this PR aims to fix. Consider changing the loop to squash before each push, e.g., "make them, squash into a single commit, run make verify, and push."

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At self-development/kelos-workers.yaml, line 105:

<comment>The self-review loop in step 7a adds commits (`make them, commit and push`) without re-squashing or re-running verification. After a couple of review iterations, the branch will have multiple commits again — the same problem this PR aims to fix. Consider changing the loop to squash before each push, e.g., "make them, squash into a single commit, run `make verify`, and push."</comment>

<file context>
@@ -98,10 +98,13 @@ spec:
+        - Run `make verify` to catch lint, fmt, and vet issues locally.
+        - Run `git diff origin/main --stat` to confirm only files relevant to the task are modified. Revert any unrelated changes.
+      - 6a. Squash your commits into a single clean commit, then push to origin kelos-task-{{.Number}}.
+      - 7a. /review the PR to verify your changes address the feedback. If changes are needed, make them, commit and push, then /review again. Repeat until the review passes.
+      - 8a. Update the PR title and description to reflect the final diff. The PR body MUST contain a standard closing keyword reference on its own line (e.g., `Fixes #{{.Number}}` or `Closes #{{.Number}}`). Do not embed the issue number in natural language. Ensure the PR has labels "generated-by-kelos" and "ok-to-test" (use `gh pr edit {{.Number}} --add-label generated-by-kelos --add-label ok-to-test` if missing).
+      - 9a. Make sure the PR passes all CI tests.
</file context>
Suggested change
- 7a. /review the PR to verify your changes address the feedback. If changes are needed, make them, commit and push, then /review again. Repeat until the review passes.
- 7a. /review the PR to verify your changes address the feedback. If changes are needed, make them, run `make verify`, squash into a single commit, and push, then /review again. Repeat until the review passes.
Fix with Cubic

- 5. Before pushing, verify your changes are clean:
- Run `make verify` to catch lint, fmt, and vet issues locally.
- Run `git diff origin/main --stat` (or `git diff upstream/main --stat` if upstream is set) to confirm only files relevant to the task are modified. Revert any unrelated changes.
- 6. Squash your commits into a single clean commit, then push to origin {{.Branch}}.
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 9, 2026

Choose a reason for hiding this comment

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

P2: After squashing, a regular git push will be rejected because the rewritten history diverges from the remote. Specify --force-with-lease to make this step actionable (it's also safer than --force since it aborts if someone else pushed in the meantime).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At self-development/kelos-pr-responder.yaml, line 87:

<comment>After squashing, a regular `git push` will be rejected because the rewritten history diverges from the remote. Specify `--force-with-lease` to make this step actionable (it's also safer than `--force` since it aborts if someone else pushed in the meantime).</comment>

<file context>
@@ -81,10 +81,13 @@ spec:
+      - 5. Before pushing, verify your changes are clean:
+        - Run `make verify` to catch lint, fmt, and vet issues locally.
+        - Run `git diff origin/main --stat` (or `git diff upstream/main --stat` if upstream is set) to confirm only files relevant to the task are modified. Revert any unrelated changes.
+      - 6. Squash your commits into a single clean commit, then push to origin {{.Branch}}.
+      - 7. /review the PR to verify your changes address the feedback. If changes are needed, make them, commit and push, then /review again. Repeat until the review passes.
+      - 8. Update the PR title and description to reflect the final diff. The PR body MUST contain a standard closing keyword reference on its own line (e.g., `Fixes #123` or `Closes #123`). Do not embed the issue number in natural language. Ensure the PR has labels "generated-by-kelos" and "ok-to-test" (use `gh pr edit {{.Number}} --add-label generated-by-kelos --add-label ok-to-test` if missing). If `KELOS_UPSTREAM_REPO` is set, include `--repo "$KELOS_UPSTREAM_REPO"`.
</file context>
Suggested change
- 6. Squash your commits into a single clean commit, then push to origin {{.Branch}}.
- 6. Squash your commits into a single clean commit, then force-push (`git push --force-with-lease`) to origin {{.Branch}}.
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant