Skip to content

self-development: prevent kelos-bot from triggering self-development spawners - #1100

Merged
gjkim42 merged 1 commit into
mainfrom
kelos-task-1098
May 4, 2026
Merged

gjkim42 merged 1 commit into
mainfrom
kelos-task-1098

Conversation

@kelos-bot

@kelos-bot kelos-bot Bot commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Prevents the kelos bot from recursively triggering self-development TaskSpawners.

Several self-development TaskSpawners listed kelos-bot[bot] as a positive author allowlist entry alongside gjkim42. Combined with bodyContains: /kelos <command> filters, this allowed agent-authored comments that mention /kelos api-review, /kelos review, /kelos pick-up, or /kelos plan (e.g. recommendations in planner/reviewer outputs) to trigger another spawner — the recursion vector described in the issue.

The GitHubWebhook.ExcludeAuthors field already exists in the API and is evaluated before filters, taking precedence over filter-level Author matches. This PR applies it at the top level of the affected spawners and drops the now-redundant author: kelos-bot[bot] filter entries:

  • kelos-workers
  • kelos-planner
  • kelos-pr-responder
  • kelos-reviewer
  • kelos-api-reviewer

kelos-triage is intentionally left unchanged — it triages bot-created issues opened by kelos-self-update, which is the desired workflow. kelos-squash-commits already restricts to gjkim42 only.

Which issue(s) this PR is related to:

Fixes #1098

Special notes for your reviewer:

This is in tension with #979's finding that kelos-squash-commits is the only command handler missing kelos-bot[bot] from its author allowlist. Issue #1098 takes the opposite direction (no bot-on-bot triggers via these command filters), so #979's symmetry argument no longer applies for these filter blocks.

make verify and make test pass locally.

Does this PR introduce a user-facing change?

NONE

…spawners

Add `excludeAuthors: [kelos-bot[bot]]` at the top level of webhook-driven
self-development TaskSpawners and remove the now-redundant `kelos-bot[bot]`
positive author allowlist entries. Top-level ExcludeAuthors is evaluated
before filters and takes precedence over filter-level Author matches, so
agent-authored comments containing strings like `/kelos api-review` no
longer recursively trigger another spawner.

Affects: kelos-workers, kelos-planner, kelos-pr-responder, kelos-reviewer,
kelos-api-reviewer. kelos-triage is left unchanged so bot-created issues
(e.g. from kelos-self-update) continue to be triaged. kelos-squash-commits
already restricts to gjkim42 only.
@github-actions github-actions Bot added needs-triage needs-kind Indicates an issue or PR lacks a kind/* label kind/bug Categorizes issue or PR as related to a bug needs-priority needs-actor release-note-none and removed needs-kind Indicates an issue or PR lacks a kind/* label labels May 4, 2026

@cubic-dev-ai cubic-dev-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.

No issues found across 5 files

@greptile-apps

greptile-apps Bot commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR closes the bot-on-bot recursion vector (issue #1098) by adding excludeAuthors: kelos-bot[bot] at the top-level githubWebhook spec of five TaskSpawners (kelos-workers, kelos-planner, kelos-pr-responder, kelos-reviewer, kelos-api-reviewer) and removing the now-redundant per-filter author: kelos-bot[bot] entries. The approach is correct — excludeAuthors is evaluated before filter-level author matches — and the intentional carve-outs (kelos-triage, kelos-squash-commits) are left unchanged as documented.

  • The PR uses /kind bug, but CLAUDE.md specifies that PRs modifying only self-development/ files should use /kind cleanup.

Confidence Score: 4/5

Safe to merge — the recursion fix is correct and complete; only a minor /kind label convention violation remains.

All changed files are simple YAML config edits that are logically correct. The only finding is a P2 style violation (/kind bug instead of /kind cleanup per CLAUDE.md), which does not affect runtime behavior.

No files require special attention.

Important Files Changed

Filename Overview
self-development/kelos-api-reviewer.yaml Adds top-level excludeAuthors: kelos-bot[bot] and removes both redundant author: kelos-bot[bot] entries (issue_comment and pull_request_review) from the api-review command filters.
self-development/kelos-reviewer.yaml Adds top-level excludeAuthors: kelos-bot[bot] and removes both redundant author: kelos-bot[bot] entries (issue_comment and pull_request_review) from the review command filters.
self-development/kelos-pr-responder.yaml Adds top-level excludeAuthors: kelos-bot[bot] and removes the redundant issue_comment pick-up filter scoped to kelos-bot[bot]; the pull_request_review filter (which already had no author restriction) is now correctly guarded by the top-level exclusion.
self-development/kelos-planner.yaml Adds top-level excludeAuthors: kelos-bot[bot] and removes the redundant per-filter author: kelos-bot[bot] entry from the plan command filter.
self-development/kelos-workers.yaml Adds top-level excludeAuthors: kelos-bot[bot] and removes the now-redundant per-filter author: kelos-bot[bot] entry for the issue_comment pick-up filter.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    GH[GitHub Webhook Event] --> EA{excludeAuthors check}
    EA -- "author == kelos-bot[bot]" --> DROP[🚫 Event dropped — no spawner triggered]
    EA -- "author != kelos-bot[bot]" --> FL{Filter evaluation}
    FL -- "filter matches e.g. gjkim42 + bodyContains" --> SPAWN[✅ TaskSpawner fires]
    FL -- no match --> NOOP[Event ignored]

    subgraph Before this PR
        OLD_FL{Filter evaluation OLD} -- "author: gjkim42 match" --> OLD_SPAWN1[TaskSpawner fires]
        OLD_FL -- "author: kelos-bot[bot] match + bodyContains /kelos cmd" --> OLD_RECURSE[⚠️ Recursive spawn!]
    end
Loading

Comments Outside Diff (1)

  1. self-development/kelos-workers.yaml, line 1 (link)

    P2 Wrong /kind label for self-development/-only PR

    CLAUDE.md (and AGENTS.md) states: "PRs that only modify files under self-development/ are internal agent improvements — use /kind cleanup and write NONE in the release-note block." All five changed files are under self-development/, so this PR should use /kind cleanup rather than /kind bug.

    Context Used: CLAUDE.md (source)

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: self-development/kelos-workers.yaml
    Line: 1
    
    Comment:
    **Wrong `/kind` label for `self-development/`-only PR**
    
    CLAUDE.md (and AGENTS.md) states: "PRs that only modify files under `self-development/` are internal agent improvements — use `/kind cleanup` and write `NONE` in the `release-note` block." All five changed files are under `self-development/`, so this PR should use `/kind cleanup` rather than `/kind bug`.
    
    **Context Used:** CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=c0a0674a-9e65-4e96-88fa-4a29086750fb))
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
self-development/kelos-workers.yaml:1
**Wrong `/kind` label for `self-development/`-only PR**

CLAUDE.md (and AGENTS.md) states: "PRs that only modify files under `self-development/` are internal agent improvements — use `/kind cleanup` and write `NONE` in the `release-note` block." All five changed files are under `self-development/`, so this PR should use `/kind cleanup` rather than `/kind bug`.

Reviews (1): Last reviewed commit: "self-development: prevent kelos-bot from..." | Re-trigger Greptile

@kelos-bot kelos-bot Bot added kind/cleanup and removed kind/bug Categorizes issue or PR as related to a bug labels May 4, 2026
@gjkim42
gjkim42 added this pull request to the merge queue May 4, 2026
Merged via the queue into main with commit 41b8297 May 4, 2026
44 checks passed
@gjkim42
gjkim42 deleted the kelos-task-1098 branch May 4, 2026 11:48
kelos-bot Bot pushed a commit that referenced this pull request May 4, 2026
…y PRs

PR #1100 was an agent-generated PR that modified only self-development/
files but used /kind bug. Greptile flagged it P2 against the existing
CLAUDE.md/AGENTS.md rule:

  PRs that only modify files under self-development/ are internal agent
  improvements — use /kind cleanup and write NONE in the release-note
  block.

The rule lives in the project's AGENTS.md but was not echoed into the
agent's own agentsMD (where most other PR conventions are duplicated)
nor surfaced in the reviewer's project-conventions checklist. So the
worker missed it at PR-creation time, and the kelos-reviewer pass did
not catch it before merge.

Echo the rule into the shared and worker AgentConfigs, and add an
explicit reviewer checklist item with a P2 severity hint so a /review
pass on a self-development/-only PR will flag a wrong /kind label.

The framing emphasizes "classify by file location, not by problem
nature" — the failure mode in PR #1100 was the agent picking the label
from the change's semantic intent (recursion-prevention bug fix) rather
than from the directory scope.
kelos-bot Bot pushed a commit that referenced this pull request May 8, 2026
Distills thirteen recurring conventions from recent PR review feedback and
propagates them across AGENTS.md, the shared and worker AgentConfigs, and
the reviewer prompts. All changes are backed by specific PR review findings.

1. Never use os.Getenv() for secrets as Go flag defaults — PR #971 P1
   (cmd/kelos-webhook-server, cmd/ghproxy leaked GITHUB_TOKEN via --help).
2. Fail fast on invalid configuration — PR #971 multiple P1/P2 (silent
   degradation when GitHub App credentials or token resolvers failed).
3. Keep API surfaces minimal — PR #902 (maintainer asked repeatedly to
   defer speculative fields and ship the minimum viable API).
4. API changes must preserve backward compatibility — PR #1058 (BodyContains
   scalar->array would break in-cluster manifests; resolved by deprecating
   the old field rather than tightening validation).
5. Docs must match implementation, not aspiration — PRs #1035, #1056, #1082
   (docs claimed enforcement that the code never performed).
6. TaskSpawner conventions — PRs #965, #974 (webhook over poll, empty
   .Branch for issue events, dual issue/PR context, no manual checkout).
7. Don't use Gomega's global Expect() inside Eventually polling blocks —
   PR #1084 (transient API errors short-circuited the poller).
8. /kind cleanup for self-development/-only PRs — PR #1100 P2 (agent
   classified by problem nature; rule is to classify by file location).
9. CLI error messages must name the resource — PR #1101 P2 (errors.New
   ("task failed") loses the name when batched).
10. Test the happy path, not only early-return guards — PR #1096 (both
    new tests covered only the no-op branches because production code
    lacked a posting seam; rule now requires adding the seam).
11. Avoid vacuous substring assertions in printer tests — PR #1106 P2
    (a "sentry" check passed because the fixture's Name was "sentry-fixer").
12. Keep CRD enum docstrings consistent with the Enum marker — PR #1081 P2
    (commentOn godoc said "empty matches both" but the marker rejected "").
13. Qualify cross-CRD field references with the owning kind in docs —
    PR #1077 P2 (Workspace section cited bare podOverrides.env without
    noting the field lives on Task.spec).

Also: kelos-reviewer branch field uses the safe with-index fallback form,
kelos-squash-commits gates the issue_comment trigger to PullRequest comments
(preventing /kelos squash-commits typed on a plain issue from running
git push --force-with-lease against an empty branch fallback), and the
README's .Branch description matches runtime behavior.
kelos-bot Bot pushed a commit that referenced this pull request May 10, 2026
Distills thirteen recurring conventions from recent PR review feedback and
propagates them across AGENTS.md, the shared and worker AgentConfigs, and
the reviewer prompts. All changes are backed by specific PR review findings.

1. Never use os.Getenv() for secrets as Go flag defaults — PR #971 P1
   (cmd/kelos-webhook-server, cmd/ghproxy leaked GITHUB_TOKEN via --help).
2. Fail fast on invalid configuration — PR #971 multiple P1/P2 (silent
   degradation when GitHub App credentials or token resolvers failed).
3. Keep API surfaces minimal — PR #902 (maintainer asked repeatedly to
   defer speculative fields and ship the minimum viable API).
4. API changes must preserve backward compatibility — PR #1058 (BodyContains
   scalar->array would break in-cluster manifests; resolved by deprecating
   the old field rather than tightening validation).
5. Docs must match implementation, not aspiration — PRs #1035, #1056, #1082
   (docs claimed enforcement that the code never performed).
6. TaskSpawner conventions — PRs #965, #974 (webhook over poll, empty
   .Branch for issue events, dual issue/PR context, no manual checkout).
7. Don't use Gomega's global Expect() inside Eventually polling blocks —
   PR #1084 (transient API errors short-circuited the poller).
8. /kind cleanup for self-development/-only PRs — PR #1100 P2 (agent
   classified by problem nature; rule is to classify by file location).
9. CLI error messages must name the resource — PR #1101 P2 (errors.New
   ("task failed") loses the name when batched).
10. Test the happy path, not only early-return guards — PR #1096 (both
    new tests covered only the no-op branches because production code
    lacked a posting seam; rule now requires adding the seam).
11. Avoid vacuous substring assertions in printer tests — PR #1106 P2
    (a "sentry" check passed because the fixture's Name was "sentry-fixer").
12. Keep CRD enum docstrings consistent with the Enum marker — PR #1081 P2
    (commentOn godoc said "empty matches both" but the marker rejected "").
13. Qualify cross-CRD field references with the owning kind in docs —
    PR #1077 P2 (Workspace section cited bare podOverrides.env without
    noting the field lives on Task.spec).

Also: kelos-reviewer branch field uses the safe with-index fallback form,
kelos-squash-commits gates the issue_comment trigger to PullRequest comments
(preventing /kelos squash-commits typed on a plain issue from running
git push --force-with-lease against an empty branch fallback), the
kelos-squash-commits branch field uses the same with-index fallback form
for defensive consistency with the documented convention, and the README's
.Branch description matches runtime behavior (PR head branch or pushed
branch; empty for issue events).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

self-development: Bot should not trigger other bots

1 participant