-
Notifications
You must be signed in to change notification settings - Fork 0
ci: insight-sync workflow (Sync-now target) — collector → reviewed ledger PR #37
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| name: insight-sync | ||
|
|
||
| # On-demand durable sync of the insight stream: pull the collector's decisions | ||
| # and operator labels into ledger/insights/ and open a REVIEWED PR. This is the | ||
| # target of the Observatory "Sync now" button (agentic-observatory) and a | ||
| # manual complement to the nightly on-box knowledge-loop sync | ||
| # (network-operations#428). | ||
| # | ||
| # Runs on the self-hosted hyrule-infra runner because the collector | ||
| # (http://[loop]:8770) is firewalled to loop/noc/mon; GitHub-hosted runners | ||
| # cannot reach it. REQUIRES a ci -> collector:8770 firewall rule in | ||
| # network-operations (loop.yml) — until that lands the sync step will fail to | ||
| # connect. Writes nothing directly: the ledger change lands as a reviewed PR. | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| group: insight-sync | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| insight-sync: | ||
| runs-on: [self-hosted, linux, x64, hyrule-infra] | ||
| env: | ||
| GH_TOKEN: ${{ secrets.KNOWLEDGE_GH_TOKEN }} | ||
| FALLBACK_GH_TOKEN: ${{ github.token }} | ||
| # GET /v1/insights is unauthenticated (reads are open); no token needed. | ||
| HYRULE_KNOWLEDGE_LOOP_INSIGHT_COLLECTOR_URL: http://[2a0c:b641:b50:2::f0]:8770 | ||
| steps: | ||
| - name: Select GitHub token | ||
| run: | | ||
| if [ -z "${GH_TOKEN:-}" ]; then | ||
| echo "GH_TOKEN=${FALLBACK_GH_TOKEN}" >> "$GITHUB_ENV" | ||
| fi | ||
| - uses: actions/checkout@v6 | ||
| - uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| enable-cache: true | ||
| - name: Install dependencies | ||
| run: uv sync --group dev --frozen | ||
| - name: Sync collector insights into the ledger | ||
| run: | | ||
| uv run hyrule-knowledge insights sync \ | ||
| --collector-url "$HYRULE_KNOWLEDGE_LOOP_INSIGHT_COLLECTOR_URL" | ||
| - name: Validate the refreshed ledger + exports | ||
| run: | | ||
| uv run hyrule-knowledge validate okf | ||
| uv run hyrule-knowledge quality --check | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will fail the workflow on the first real sync, before any PR is opened. Right now the repo has no committed The nightly loop avoids this by running
Either way |
||
| uv run hyrule-knowledge export --check | ||
| uv run hyrule-knowledge scan-secrets okf exports reports | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This workflow commits collector-sourced records under Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor / defense-in-depth: this scans
|
||
| - name: Open reviewed insight-sync pull request | ||
| uses: peter-evans/create-pull-request@v7 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This job sets Useful? React with 👍 / 👎. |
||
| with: | ||
| branch: bot/knowledge-refresh/insight-sync-${{ github.run_id }} | ||
| title: "knowledge: insight-sync ${{ github.run_id }}" | ||
| commit-message: "knowledge: sync collector insights into ledger" | ||
| body: | | ||
| On-demand durable sync of the insight decision/label stream from the | ||
| collector into `ledger/insights/`. Deterministic; review the ledger | ||
| diff (decisions + operator labels) before merge. | ||
| labels: knowledge, automated | ||
| delete-branch: true | ||
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.
When this dispatch imports ledger insights with OKF evidence refs,
insights syncrewrites exports/grounding but does not updatereports/coverage.json;quality --checkthen recomputes the production-stream grounding warnings and can fail withstale_reportsbefore the create-pull-request step ever runs. This especially affects the first realledger/insightsimport, because quality only enables never-cited grounding warnings once a production ledger file exists, so runquality --writebefore checking/committing the refreshed reports.Useful? React with 👍 / 👎.