self-development: distill recurring conventions from PR review feedback#786
self-development: distill recurring conventions from PR review feedback#786kelos-bot[bot] wants to merge 1 commit intomainfrom
Conversation
Add three new agent conventions from recent PR review feedback: 1. Per-TaskSpawner configuration should be CRD fields, not controller flags (PR #838 - gjkim42 review) 2. CRD API backward compatibility - never rename JSON field tags (PR #838 - P1 review finding) 3. Gate optional CRDs behind Helm values flags (PR #821 - PodMonitoring broke installs on clusters without monitoring.googleapis.com) Also includes previously proposed conventions from PR #786: - Consistent guidance across surfaces - Provider-agnostic API design - Idiomatic Helm values - Deploy-dev workflow sync - Controller-driven migration - Release note user action requirements Co-Authored-By: Claude Opus 4.6 <[email protected]>
bcdeef3 to
7ade17e
Compare
|
/kelos pick-up |
|
🤖 Kelos Task Status Task |
|
🤖 Kelos Agent @gjkim42 /kelos needs-input Rebased on origin/main (was already up to date). Added The only failing CI check is Ready for re-review. |
7ade17e to
782ce1c
Compare
0871329 to
6379545
Compare
6f6241c to
41ed5c4
Compare
41ed5c4 to
5f6baa8
Compare
5f6baa8 to
675ac75
Compare
eb7fce3 to
f472430
Compare
…eedback Adds conventions learned from recent PR reviews: 1. Fail fast on invalid configuration (PR #971): three P1 and four P2 issues flagged silent degradation when credentials or config were invalid, falling back to unauthenticated requests instead of erroring. 2. No manual PR branch checkout in TaskSpawner prompts (PR #974): Kelos already checks out the PR branch automatically; manual checkout instructions are redundant and confusing. Also carries forward the previously proposed changes from PR #786: - os.Getenv() secret-in-flag-defaults convention (PR #971) - TaskSpawner creation conventions (PR #965) - Branch template variable documentation fix (PR #965) Co-Authored-By: Claude Opus 4.6 <[email protected]>
1d88c65 to
0d360ce
Compare
Greptile SummaryThis PR codifies six conventions learned from recent PR review findings into Confidence Score: 5/5Safe to merge; all findings are P2 style suggestions that do not affect runtime behavior All changes are documentation and agent-configuration text. The one live template fix (kelos-reviewer.yaml branch field) is correct. The only issues found are a minor inconsistency between the convention example syntax and the adopted implementation syntax, which does not affect correctness. self-development/agentconfig.yaml and self-development/kelos-workers.yaml — convention example for {{.Branch}} uses a different template syntax than the live fix
|
| Filename | Overview |
|---|---|
| AGENTS.md | Adds four new conventions (secrets-as-flag-defaults, fail-fast, minimal API, docs-accuracy); clean and well-worded additions |
| self-development/README.md | Corrects {{.Branch}} description from "usually PR head branch" to "empty for issue events"; accurate and minimal change |
| self-development/agentconfig.yaml | Propagates all new conventions to the worker agent config; convention example for {{.Branch}} uses a different syntax than the live fix in kelos-reviewer.yaml |
| self-development/kelos-reviewer.yaml | Fixes branch template to handle empty {{.Branch}} for issue events and adds correctness, security, and docs-accuracy checklist items |
| self-development/kelos-workers.yaml | Propagates all new conventions; same minor convention/example inconsistency as agentconfig.yaml |
| self-development/kelos-api-reviewer.yaml | Adds minimal-API checklist item to the API compatibility section; well-placed and concise |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[GitHub Webhook Event] --> B{Event type?}
B -->|pull_request / pull_request_review| C["{{.Branch}} = PR head branch"]
B -->|issue_comment on issue| D["{{.Branch}} = empty"]
B -->|issue_comment on PR| C
C --> E["branch: 'main' fallback not needed"]
D --> F["branch: '{{with index . Branch}}{{.}}{{else}}main{{end}}'"]
F --> G["Falls back to 'main'"]
E --> H[Task spawned with correct branch]
G --> H
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
self-development/agentconfig.yaml:40
**Convention example inconsistent with actual implementation**
The convention documents `{{if .Branch}}{{.Branch}}{{else}}main{{end}}`, but the actual fix applied in `kelos-reviewer.yaml` (line 88) uses `{{with index . "Branch"}}{{.}}{{else}}main{{end}}`. Both handle the empty-branch case, but a future author following the convention example would produce a different (though likely equivalent) template than what is already in use. Aligning the example to the adopted pattern avoids the inconsistency:
```suggestion
- The `{{.Branch}}` template variable is empty for issue-only events; use `{{with index . "Branch"}}{{.}}{{else}}main{{end}}` when it may be empty
```
### Issue 2 of 2
self-development/kelos-workers.yaml:39
**Same convention/implementation mismatch as in agentconfig.yaml**
Same inconsistency as `agentconfig.yaml` line 40 — the example shows `{{if .Branch}}...` but the live fix in `kelos-reviewer.yaml` uses `{{with index . "Branch"}}...`. Consider using the same pattern here for consistency.
Reviews (2): Last reviewed commit: "self-development: distill recurring conv..." | Re-trigger Greptile
Adds five conventions distilled from recent PR reviews and applies them across AGENTS.md, the shared and worker AgentConfigs, and the reviewer prompts. 1. Never use os.Getenv() for secrets as Go flag defaults (PR #971) — flag prints defaults in --help output, leaking secret values. 2. Fail fast on invalid configuration (PR #971) — do not silently fall back to unauthenticated/degraded behavior when credentials or config are missing. 3. Keep API surfaces minimal (PR #902) — only fields immediately needed, no speculative additions; API is hard to change once shipped. 4. Docs must match implementation, not aspiration (PRs #1035, #1056) — describe only what the code actually does; verify enforcement before documenting a contract. 5. TaskSpawner conventions (PRs #965, #974): - Prefer webhook-based triggers over poll-based. - {{.Branch}} is empty for issue-only events; use the {{if .Branch}}{{.Branch}}{{else}}main{{end}} fallback form. - issue_comment fires for both issues and PRs; design prompts to detect and handle both contexts. - Do not include manual PR branch checkout instructions — Kelos checks out the PR branch automatically. Also fixes the kelos-reviewer TaskSpawner branch field to use the safe fallback form (was using bare {{.Branch}}, which is empty for issue events; flagged P2 in PR #786 review). Co-Authored-By: Claude Opus 4.7 <[email protected]>
7aff731 to
6a74ec3
Compare
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Distills five recurring conventions from recent PR review feedback and propagates them across
AGENTS.md, the shared and workerAgentConfigs, and the reviewer prompts. All changes are backed by specific PR review findings — no speculative rules.1. Never use
os.Getenv()for secrets as Goflagdefaultscmd/kelos-webhook-server/main.goandcmd/ghproxy/main.gowhereos.Getenv("GITHUB_TOKEN")was used asflag.StringVardefault, leaking the secret in--helpoutput.AGENTS.md,agentconfig.yaml,kelos-workers.yaml,kelos-reviewer.yaml(new security checklist item).2. Fail fast on invalid configuration
AGENTS.md,agentconfig.yaml,kelos-workers.yaml,kelos-reviewer.yaml(new correctness checklist item).3. Keep API surfaces minimal
AGENTS.md,agentconfig.yaml,kelos-workers.yaml,kelos-api-reviewer.yaml(new compatibility checklist item).4. Docs must match implementation, not aspiration
GenericSourcebranch ininternal/webhook/handler.gonever reads<SOURCE>_WEBHOOK_SECRET, inspectsX-Hub-Signature-256, or callsvalidateHMACSignature— giving users a false sense of security.PodOverrides.Enventries reusing reserved names are dropped so the built-in always wins, but the actual filter only drops collisions against names already populated onmainContainer.Env.AGENTS.md,agentconfig.yaml,kelos-workers.yaml,kelos-reviewer.yaml(new "Documentation accuracy" checklist subsection).5. TaskSpawner conventions
{{.Branch}}for issue events; designissue_commentprompts for both issue and PR contexts. PR Add API contract validation example (example 12) #974 — P2: "Remove the manual PR branch checkout instruction; Kelos already handles PR branch checkout automatically."agentconfig.yaml,kelos-workers.yaml. README template-variable table corrected from "Usually PR head branch" to "PR head branch; empty for issue events".Also fixes the
kelos-reviewerTaskSpawner branch field to use the safe{{with index . "Branch"}}{{.}}{{else}}main{{end}}fallback form instead of bare{{.Branch}}. Flagged P2 by Greptile in this PR's prior review (#786): the spawner listens onissue_comment, so a/kelos reviewtriggered on a plain issue would land on whatever default state Kelos falls back to rather thanmain.Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
This PR was rebased onto current main (was 109 commits behind). All changes are documentation/configuration; no runtime code changes.
Does this PR introduce a user-facing change?