Skip to content

fix(cli): show source for generic webhook taskspawners - #1106

Merged
gjkim42 merged 1 commit into
mainfrom
kelos-task-1103
May 7, 2026
Merged

gjkim42 merged 1 commit into
mainfrom
kelos-task-1103

Conversation

@kelos-bot

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

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

kelos get taskspawners previously displayed an empty SOURCE column for TaskSpawners configured with spec.when.webhook (generic webhook), and kelos get taskspawners <name> -d did not print any source information at all. Every other source type (GitHub Issues, GitHub PRs, Jira, Cron, GitHub Webhook, Linear Webhook) had a branch in internal/cli/printer.go, but the generic webhook case was missed.

This PR adds the missing branches in both printTaskSpawnerTable and printTaskSpawnerDetail:

  • Table: Generic Webhook (<source>) (e.g. Generic Webhook (sentry)).
  • Detail: Source: Generic Webhook plus a Webhook Source: <source> line.

Unit tests cover both new branches.

Which issue(s) this PR is related to:

Fixes #1103

Special notes for your reviewer:

N/A

Does this PR introduce a user-facing change?

Fix `kelos get taskspawners` to display a non-empty SOURCE column for TaskSpawners using the generic webhook source, and include the webhook source identifier in the detail view.

Summary by cubic

Fixes CLI output so generic webhook TaskSpawners show their source in table and detail views. Addresses Linear task 1103.

  • Bug Fixes
    • Table shows "Generic Webhook ()".
    • Detail view prints "Source: Generic Webhook" and "Webhook Source: ".
    • Tests cover both views and assert these exact strings.

Written for commit 8a1ff95. Summary will update on new commits.

@greptile-apps

greptile-apps Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds the missing GenericWebhook branches in printTaskSpawnerTable and printTaskSpawnerDetail, completing coverage for all TaskSpawner source types in the CLI printer. The fix is minimal and consistent with how every other source type is already handled.

  • Table view: GenericWebhook now renders as Generic Webhook (<source>), matching the pattern used for GitHubWebhook.
  • Detail view: Prints Source: Generic Webhook followed by a Webhook Source: <source> line, consistent with the LinearWebhook and Jira detail blocks.
  • Tests: Two new test functions cover both views; the detail assertions use the combined \"Webhook Source: sentry\" string to avoid vacuous substring matches.

Confidence Score: 5/5

Safe to merge — the change is a straightforward two-branch addition with no risk of affecting existing source-type handling.

The implementation slots cleanly into the existing if-else chain, the new branches are inert to all other source types, and the tests cover both the table and detail output paths.

No files require special attention.

Important Files Changed

Filename Overview
internal/cli/printer.go Adds GenericWebhook branches to both printTaskSpawnerTable and printTaskSpawnerDetail, consistent with all other source types.
internal/cli/printer_test.go Adds two new test functions covering the table and detail views for GenericWebhook; the detail test uses the combined "Webhook Source: sentry" string to avoid vacuous matches.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[TaskSpawner.Spec.When] --> B{Source type?}
    B --> C[GitHubIssues]
    B --> D[GitHubPullRequests]
    B --> E[Jira]
    B --> F[Cron]
    B --> G[GitHubWebhook]
    B --> H[LinearWebhook]
    B --> I[GenericWebhook NEW]

    C --> T[Table: workspace/GitHub Issues]
    D --> T2[Table: workspace/GitHub Pull Requests]
    E --> T3[Table: Jira project]
    F --> T4[Table: cron: schedule]
    G --> T5[Table: GitHub Webhook repo]
    H --> T6[Table: Linear Webhook]
    I --> T7[Table: Generic Webhook source]

    T7 --> DV[Detail: Source: Generic Webhook + Webhook Source: source]
Loading

Reviews (3): Last reviewed commit: "fix(cli): show source for generic webhoo..." | Re-trigger Greptile

@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 2 files

Comment thread internal/cli/printer_test.go Resolved
@gjkim42

gjkim42 commented May 6, 2026

Copy link
Copy Markdown
Collaborator

/kelos pick-up

@kelos-bot

kelos-bot Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Kelos Task Status

Task kelos-pr-responder-issue-comment-a7ef417520c8 has succeeded. ✅

@gjkim42

gjkim42 commented May 6, 2026

Copy link
Copy Markdown
Collaborator

/kelos squash-commits

@kelos-bot

kelos-bot Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Kelos Task Status

Task kelos-squash-commits-issue-comment-85066a53c28f has succeeded. ✅

kelos-bot Bot pushed a commit that referenced this pull request May 6, 2026
Distills three additional conventions from review feedback on recent
PRs (#1101, #1106, #1096):

- CLI error messages must name the failing resource (PR #1101 P2)
- Tests must cover the happy path, not only early-return guards
  (PR #1096 P3, flagged by both kelos-bot and greptile-apps)
- Avoid vacuous substring assertions in printer/formatter tests
  (PR #1106 P2)

Applied to AGENTS.md (and via symlink CLAUDE.md), agentconfig.yaml,
kelos-workers.yaml, and the reviewer prompt's Tests / Code quality
checklists.
@kelos-bot

kelos-bot Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Kelos Agent @gjkim42

All review feedback was addressed in commit 084782d (combined Webhook Source: sentry label+value into a single substring assertion to avoid the vacuous match against the fixture name). CI is green. Ready for re-review.

@kelos-bot
kelos-bot Bot force-pushed the kelos-task-1103 branch from 084782d to 8a1ff95 Compare May 6, 2026 18:40
@kelos-bot

kelos-bot Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

Squash complete.

🤖 Kelos Agent @gjkim42

Rebased on origin/main and squashed 2 commits into 1:

  • fix(cli): show source for generic webhook taskspawners

@gjkim42
gjkim42 added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit b67e1c3 May 7, 2026
19 checks passed
@gjkim42
gjkim42 deleted the kelos-task-1103 branch May 7, 2026 15:39
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>
kelos-bot Bot pushed a commit that referenced this pull request May 17, 2026
Propagates eleven recurring conventions, distilled from prior PR review
feedback, across AGENTS.md, the shared and worker AgentConfigs, and the
reviewer prompts. Also fixes two existing self-development spawner
configurations that were flagged in adjacent reviews.

Conventions added to AGENTS.md, agentconfig.yaml, and kelos-workers.yaml:

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. Don't use Gomega's global Expect() inside Eventually polling blocks —
   PR #1084 (transient API errors short-circuited the poller).
7. CLI error messages must name the resource — PR #1101 P2
   (errors.New("task failed") loses the name when batched).
8. Test the happy path, not only early-return guards — PR #1096 (tests
   covered only the no-op branches because production code lacked a
   posting seam; rule now requires adding the seam).
9. Avoid vacuous substring assertions in printer tests — PR #1106 P2
   (a "sentry" check passed because the fixture's Name was "sentry-fixer").
10. Keep CRD enum docstrings consistent with the Enum marker — PR #1081
    P2 (commentOn godoc said "empty matches both" but the marker rejected "").
11. 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).

Reviewer/api-reviewer checklists gain matching items so kelos-reviewer
and kelos-api-reviewer flag these patterns on future PRs.

Other fixes in the same sweep:

- kelos-reviewer.spec.taskTemplate.branch uses the safe
  '{{with index . "Branch"}}{{.}}{{else}}main{{end}}' fallback form so
  a /kelos review typed on a plain issue lands on main rather than an
  empty branch.
- kelos-squash-commits gates the issue_comment trigger to
  commentOn: PullRequest and uses the same with-index fallback for the
  branch field — /kelos squash-commits typed on a plain issue would
  otherwise fire the spawner with empty {{.Branch}} and the prompt then
  runs git push --force-with-lease.
- self-development/README.md template-variable table corrected from
  "Usually PR head branch" to "PR head branch or pushed branch; empty
  for issue events" to match runtime behavior, and the bodyContains
  example was updated to bodyPattern to match the spawner configs.

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.

Bug: 'kelos get taskspawners' shows empty SOURCE for generic webhook TaskSpawners

1 participant