-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add cws-btfhub-sync skill #54297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
danielmercier
wants to merge
1
commit into
main
Choose a base branch
from
daniel.mercier/skill-cws-btfhub-sync
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+57
−0
Open
Add cws-btfhub-sync skill #54297
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| --- | ||
| name: cws-btfhub-sync | ||
| description: Sync CWS BTFHub constants after adding a new constantfetch offset, so pre-BTF kernels can resolve it. Use when KMT secagent jobs log "failed to fetch constant for <name>". | ||
| allowed-tools: Read, Grep, Bash, AskUserQuestion | ||
| model: sonnet | ||
| --- | ||
|
|
||
| # Syncing CWS BTFHub constants | ||
|
|
||
| A new `appendOffsetofRequest` in `probe_ebpf.go` resolves via BTF on modern kernels, but | ||
| pre-BTF kernels read the offset from the checked-in, arch-split constants: | ||
|
|
||
| - `pkg/security/probe/constantfetch/constants_amd64.json` | ||
| - `pkg/security/probe/constantfetch/constants_arm64.json` | ||
|
|
||
| These predate your change and so lack the new entry. Regenerating them is the fix. | ||
|
|
||
| ## Run it | ||
|
|
||
| ```bash | ||
| gh workflow run cws-btfhub-sync.yml --ref main -f base_branch=<your-feature-branch> | ||
| ``` | ||
|
|
||
| **The trap:** `--ref` selects the workflow *definition* — keep it `main`. `base_branch` is the | ||
| ref the generate and combine jobs check out, **and** the base of the PR it opens. Leave | ||
| `base_branch` at its `main` default and the generator never sees your new offset requests: the | ||
| sync yields an empty diff and it looks like btfhub simply lacks the offsets. | ||
|
|
||
| Before running, confirm the failing distros are covered by the `cone` matrix in | ||
| `.github/workflows/cws-btfhub-sync.yml`. | ||
|
|
||
| ## Wait for it | ||
|
|
||
| It is a ~15-job matrix and takes tens of minutes. Poll it from a **background** shell so the | ||
| wait costs nothing and you get re-invoked on exit: | ||
|
|
||
| ```bash | ||
| until [ "$(gh run view <run-id> --json status -q .status)" = completed ]; do sleep 60; done | ||
| gh run view <run-id> --json conclusion -q .conclusion | ||
| ``` | ||
|
|
||
| Do not run `gh run watch` in the foreground (it outlives the tool timeout) and do not chain | ||
| short `sleep`s in the main loop. When the notification arrives, carry straight on to *Land it* | ||
| in the same turn — this is one task, not a hand-off. | ||
|
|
||
| ## Land it | ||
|
|
||
| On success the workflow opens a PR titled `CWS: sync BTFHub constants` from a | ||
| `cws/constants-sync-*` branch, targeting your branch: | ||
|
|
||
| ```bash | ||
| gh pr list --search "CWS: sync BTFHub constants" --state open --json number,headRefName,url | ||
| ``` | ||
|
|
||
| Cherry-pick its commit onto your branch, push, then **close** the PR. Confirm the picked | ||
| commit touches `btfhub/constants.json` and that your new offset names appear in the diff. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scores: Description 20/25, Writing philosophy 18/25, Structure/progressive disclosure 23/25, Output/examples 12/25, total 73/100; overall recommendation: Approve with suggestions. Top improvements: declare an owning team in the skill metadata/body, since every AI artifact needs an owner; add prerequisites and an explicit success checklist/output shape, such as authenticated
gh, current branch pushed, generated PR found, constants file changed, and source PR closed; make the wait example actually background-safe or include how to capture the run id, because the current copied command still runs a foreground polling loop despite warning against foreground waits.Useful? React with 👍 / 👎.