Microsoft repository administrator runbook
Deploy workshop achievements, Discussions, and download metrics safely
A ten-step production checklist for granting the minimum repository access, publishing an authorized metrics snapshot, validating the public dashboard, and operating the credential without exposing it.
Prerequisites
- You can administer
microsoft/aibast-agents-library, organization SAML/SSO authorization, repository Actions secrets, and workflow permissions. - The dedicated account is a Microsoft organization member or approved service identity with write or admin access to this repository.
- You can sign in to GitHub in a browser and use an authenticated
ghCLI for non-secret workflow operations. - You have an approved credential owner, rotation contact, expiration date, and incident path recorded in the organization's secure system of record.
Expected outcomes
- The scheduled and manually dispatched metrics workflow can read authorized GitHub traffic and commit the refreshed snapshot with its own
GITHUB_TOKEN. state/metrics.jsonreports live traffic, per-agent rating Discussion upvotes, signed-in acquisition Discussion aggregates, verified achievement points, download totals, and exactly 72 in-scope workshop rows.- The public
metrics.htmlworks in light, dark, desktop, and mobile layouts with clear source and coverage explanations. - Rotation, exposure response, unavailable-source behavior, and rollback are documented and repeatable.
-
- Use a dedicated administrator or service account with write or admin access to
microsoft/aibast-agents-library. GitHub traffic endpoints require repository push access for the account even though the PAT permission itself is read-only. - Define the token owner, backup owner, creation date, expiration date, rotation lead time, and incident contact in the approved secure system of record.
- Prefer the shortest practical expiration that fits the operating cadence. Do not use a personal, unmanaged credential.
Expected: One named operational owner and one approved account have repository write/admin access and a documented expiration plan. - Use a dedicated administrator or service account with write or admin access to
-
Create a fine-grained personal access token with resource owner Microsoft and repository access limited to Only select repositories → aibast-agents-library.
Repository permission Access Reason Repository Administration Read-only Reads repository traffic endpoints. Metadata Read (automatic) GitHub automatically includes repository metadata access. Issues Read-only (required) Reads structured workshop-feedback and opt-in achievement progress issues without modifying them. Agent preference and acquisition use Discussions instead. Contents No access required No Contents write is needed for the PAT itself; the workflow GITHUB_TOKENhandles snapshot commits.Do not add organization-wide repository access, Contents write, workflows write, or unrelated permissions.
Expected: A fine-grained PAT exists for exactly one repository with Repository Administration: Read-only, automatic Metadata read, and required Issues: Read-only. -
- Open the token's GitHub settings and choose Configure SSO or the organization authorization control shown for Microsoft.
- Authorize the token for the Microsoft organization when SAML/SSO is required.
- If authorization is unavailable, confirm the account is an organization member, the token's resource owner is correct, and the organization permits the credential policy.
Expected: GitHub shows the token as authorized for Microsoft, with no pending SAML/SSO approval. -
In GitHub, open Settings → Secrets and variables → Actions → New repository secret. Name it
METRICS_TOKEN, paste the value into GitHub's masked secret field, save, and close the source from which it was copied.The safe CLI alternative below prompts securely for the value. Run it interactively. Do not append a value, use a body flag, echo or pipe a value, or paste a token into shell history.
Secure promptgh secret set METRICS_TOKEN --repo microsoft/aibast-agents-libraryExpected: Repository Actions secrets listsMETRICS_TOKENwith a recent update time, while its value remains unreadable. -
- Open Settings → Actions → General → Workflow permissions and select Read and write permissions for
GITHUB_TOKEN. - Confirm
.github/workflows/workshop-feedback.ymlexists on the repository default branch and receives issue events for opened, edited, closed, and reopened activity. - Keep its workflow-level permissions explicit:
issues: writeto reconcile managed signal labels andactions: writeto dispatchmetrics.ymlon the repository default branch. - Confirm
.github/workflows/metrics.ymlretainsissues: readfor workshop-feedback and opt-in achievement progress claims,discussions: writefor idempotent rating/acquisition mirror synchronization and aggregate reads, pluscontents: writefor the snapshot commit. - Confirm
scripts/sync_agent_discussions.pyruns beforescripts/build_metrics.py. It must preserve existing rating Discussion numbers, create one parallel acquisition Discussion per current AIBAST agent, update renamed agents by stable file identity, and writestate/agent_discussions.json. - Keep the population AIBAST-only. RAR is intentionally excluded from every dashboard, leaderboard, and report count in this release.
- Confirm the metrics workflow installs
scripts/impact-report-requirements.txt, runsscripts/build_impact_report.py, commits the stablereports/impact-report.*exports, and uploads the same PDF, HTML, email text, Markdown, and JSON as theaibast-impact-reportworkflow artifact. - Confirm branch protection permits the intended Actions identity and reviewed workflow to update the snapshot on
main. Do not solve a push failure by adding Contents write to the PAT.
Required autonomous compiler permissions# .github/workflows/workshop-feedback.yml permissions: actions: write issues: write # .github/workflows/metrics.yml permissions: contents: write discussions: write issues: readExpected: The default-branch issue workflow can manage feedback and achievement labels and dispatch the serialized metrics compiler; the metrics workflow can synchronize Discussions, read issue claims, and push the snapshot without expanding the collector PAT. - Open Settings → Actions → General → Workflow permissions and select Read and write permissions for
-
Open Actions → metrics, choose Run workflow, select branch
main, and run.github/workflows/metrics.yml.Equivalent non-secret dispatchgh workflow run metrics.yml --repo microsoft/aibast-agents-library --ref mainReview the completed run and generated snapshot. Verify the traffic and workshop-scope signals:
- The run reports traffic read live.
- The workshop scope is 72.
- Grid Outage excluded from the workshop scope.
- There is no unavailable_reason for the authorized traffic read.
- The aibast-impact-report artifact contains the PDF plus email-ready text, and the committed report shows 7-day and 30-day values for every defined metric without converting unavailable coverage to zero.
totals.agent_file_downloadscontains only observable AIBAST agent-file transfers. RAR does not contribute to any count.
Then verify Discussion synchronization and structured issue ingestion using existing production signals or repository test fixtures—never synthetic public signals that would pollute totals:
Verification scope: GitHub verification confirms authenticated issue authorship and canonical claim format only; achievement completion remains self-reported and is not independently proven.Check Required result Discussion mirror contract Every current AIBAST agent has one rating and one acquisition Discussion beginning with <!-- aibast-agent-discussion:v1 -->, schemaaibast-agent-discussion/1.0, one canonicalSignal,Agent, andFilefield.Rating signal The rating Discussion uses Signal: upvote. Its nativeupvoteCountis community preference, with one active upvote per signed-in GitHub account.Acquisition signal The parallel Discussion uses Signal: acquisition. Its nativeupvoteCountis one signed-in account's declared download, copy, or install and remains separate from CDN/release file transfers.Workshop-feedback signal The workflow continues to recognize <!-- aibast-workshop-feedback:v1 -->andaibast-workshop-feedback/1.0as a separate feedback source.Achievement progress signal The workflow recognizes <!-- aibast-achievement-progress:v1 -->and schemaaibast-achievement-progress/1.0, with exactly oneWorkshop,Agent, comma-separatedAchievements, and presentSourceorSource quest URLfield.Achievement canonical validation The workshop is one of the canonical 72 with Grid Outage excluded, and the agent equals that workshop's canonical primary agent. Achievementsis a nonempty subset in canonical order:started,local-proof,draft-builder,preview-proven,workshop-completed,hard-mode-completed, with no unknown, conflicting, or duplicate IDs.Achievement dependency validation Every dependent achievement requires explicitly claimed started.workshop-completedalso requires explicitly claimedlocal-proof,draft-builder, andpreview-proven.hard-mode-completedremains a separate achievement and requiresstarted. The collector never infers missing prerequisite IDs.Achievement union and scoring Across open, closed, and edited issues, claims union by case-insensitive GitHub login + workshop + achievement. Re-sync adds new badges without duplicating points. Server values are started 5, local-proof 15, draft-builder 20, preview-proven 25, workshop-completed 35, and hard-mode-completed 50: a maximum of 150 per workshop. Claims containing a Points,Point, orScorefield are rejected.Achievement public identity consent Submitting the public issue explicitly opts the GitHub login into a public profile, leaderboard, badges/achievement IDs, and completed-workshop list. Invalid, quoted, duplicate-field, conflicting, pull-request, unknown-user, unknown-workshop, and wrong-agent claims are excluded. Discussion deduplication GitHub enforces one active native upvote per account per Discussion. The collector publishes only the aggregate upvoteCountand never combines duplicate mirror threads.Discussion privacy The rating and acquisition outputs store counts and canonical Discussion URLs only—never GitHub logins, account identifiers, or voter lists. Achievement profiles separately publish only the login that explicitly opted in. Achievement labeling The issue workflow applies only the achievement-progresslabel to an achievement marker claim; workshop-feedback labeling remains separate.Weekly/monthly impact exports The workflow records a compact dated impact snapshot, calculates exact daily clone/view/CDN activity where available, calculates snapshot changes for every other metric, and publishes reports/impact-report.pdf,impact-report.html,impact-report-email.txt,impact-report-email.md, andimpact-report.json. A missing 7-day or 30-day baseline is labeled Baseline pending.AIBAST-only population The snapshot, dashboard, leaderboards, and reports include AIBAST agents only. The ecosystem compatibility block marks RAR excludedand no RAR value contributes to a total.Refresh cadence Issue changes dispatch metrics.ymlon the repository default branch. GitHub does not emit an Actions event for native Discussion upvotes, so rating and acquisition changes appear on the next scheduled or manually dispatched metrics run.Expected: The main-branch workflow succeeds, maintains two canonical Discussions per AIBAST agent, recognizes the feedback and achievement issue schemas, publishes aggregate Discussion counts and consented achievement profiles without voter lists or source issue body/free text/ID, produces the shareable weekly/monthly report artifact and committed exports, and exposes no secret or non-consenting identity values in logs. -
Run the block in a trusted interactive shell.
read -ssuppresses terminal echo; the token exists only in the temporary environment variable and is unset after the request.Secure traffic verificationread -s -p "Fine-grained PAT: " GH_TOKEN printf "\n" export GH_TOKEN gh api repos/microsoft/aibast-agents-library/traffic/clones unset GH_TOKENConfirm the response contains traffic data, not an authorization error. Close or clear any terminal capture used during incident diagnostics; do not copy the response into a public issue if it contains organization-sensitive context.
Expected:gh api repos/microsoft/aibast-agents-library/traffic/clonessucceeds, andGH_TOKENis unset immediately afterward. -
Readable local inspection
python3 -m json.tool state/metrics.jsontraffic.liveistrue,traffic.as_ofis current for the run, andtraffic.unavailable_reasonis empty or absent.totals.agent_upvotesequals the sum of available rating Discussionupvotesvalues inagent_metrics;totals.agent_acquisitionsindependently reconciles the acquisition Discussion values.- Every
agent_metricsrow exposes aggregateupvotes,acquisitions,upvote_discussion_url, andacquisition_discussion_url.leaderboards.most_upvotedandleaderboards.most_acquiredrank those same aggregates. - The workshops summary reports its totals and contains exactly 72 rows; Grid Outage is excluded from that set. Each workshop row exposes
agent_upvotesseparately fromusage_events, and both columns reconcile independently. achievements.status,achievements.as_of,achievements.coverage, andachievements.caveatform the internal achievement block and explain freshness and availability. Offline runs carry forward that prior block; without one all achievement totals are unavailable/null, never fabricated zero.achievements.totalsreconciles participants, points, achievement count, starts, workshop completions, hard completions, completion rate, hard-completion rate, and achievement-completion rate fromachievements.profiles. Profiles sort by points, badges, completions, then login.- Each achievement profile contains only the opted-in public GitHub
login,points,achievement_count,starts,workshop_completions,hard_completions, server-definedbadges/achievement_ids, andcompleted_workshops. The snapshot persists no issue body, free text, source issue ID, or body-supplied points. - The 72
achievements.workshopsrows match the canonical workshop slugs and primary agents. Their achievement counts, points, starts, workshop completions, hard completions, and rates reconcile independently fromusage_events, agent upvotes, signed-in acquisitions, downloads, and repository stars. - The six canonical
achievements.achievementsrows use fixed server points and reconcile claims, participants, workshops, and attainment rates to the profile and workshop rollups. No profile can exceed 150 points per started workshop. - Download totals reconcile to their documented components, including clones, CDN hits, and release downloads. Workshop rollups reconcile to the 65 rows.
repo.stars, if retained, is repository popularity only and is never counted as an agent upvote.agent_discussion_coverage,agent_upvote_coverage, andagent_acquisition_coverageexplain Discussion completeness and freshness. Missing mirror threads remain partial/unavailable rather than becoming zero.ecosystem.sources.rar.statusisexcluded; RAR contributes to no count, row, leaderboard, or report.- Source and coverage caveats explain GitHub's traffic window, CI clone effects, CDN coverage, Discussion signals, workshop scope, and any unavailable source.
Review the rendered repository file or a local checkout. Do not open or distribute a raw-document URL as an operational shortcut.
Expected: The snapshot is fresh, internally consistent, scoped to AIBAST and 72 workshops, contains aggregate per-agent rating and acquisition Discussion signals plus only explicitly consented public achievement profiles, keeps every signal separate from usage events and file transfers, and is safe to publish. -
Open metrics.html from the published site or repository preview and complete these checks:
- Light and dark themes remain readable with visible keyboard focus and no clipped content.
- Desktop and mobile layouts work at narrow widths without horizontal page overflow.
- Refresh updates live public sources and communicates status.
- Upvote opens the selected agent's canonical rating Discussion. Record acquisition opens its parallel acquisition Discussion; neither control asks the visitor to star the repository.
- The agent leaderboards include Most upvoted and Most acquired using the native per-Discussion aggregates.
- The Verified workshop achievements section shows verified points, badges, starts, workshop completions, hard completions, completion rates, the public leaderboard, per-workshop achievement completion, and the canonical achievement rollup from
achievements. - The page distinguishes local self-paced achievements on achievements.html from verified public achievements and links this administrator checklist. Repository stars are never described as achievement points.
- Downloads, signed-in acquisitions, the workshop leaderboard, and all 72 in-scope workshops render with totals that match the snapshot. Workshop Agent upvotes remain visibly separate from Usage events.
- No RAR count, card, table, leaderboard, or report section appears.
- Source explanations distinguish live, historical, estimated, excluded, and unavailable data.
Expected: Public controls, AIBAST downloads, per-agent rating and acquisition signals, workshop leaderboard, and source explanations work in light, dark, and mobile views without exposing voter identities. -
- Rotate before expiry: create the replacement with the same narrow scope, authorize SAML/SSO, update
METRICS_TOKEN, rerun the workflow onmain, verify live traffic, then revoke the old credential. - Exposure: revoke the credential immediately, remove it from every exposed location, create a replacement, update the secret, rerun, and follow Microsoft/GitHub incident procedures.
- Source interruption: snapshots reuse the last authorized traffic read instead of zeroing traffic. The page must label unavailable data and preserve
as_of; it must not present an authorization failure as a genuine zero. - Rollback: if a generated snapshot or display is invalid, restore the last reviewed snapshot through a normal commit, correct the workflow or permission, rerun, and revalidate before declaring recovery.
- Permanent rule: never commit a token, secret-bearing command, captured credential, or unredacted diagnostic.
Expected: Owners can rotate, revoke, recover, and explain stale or unavailable metrics without data loss or credential exposure. - Rotate before expiry: create the replacement with the same narrow scope, authorize SAML/SSO, update
Troubleshooting
| Symptom | Likely cause | Administrator action |
|---|---|---|
401 Unauthorized |
The credential is expired, revoked, malformed, or was not supplied to the workflow. | Rotate the credential, re-authorize it, update METRICS_TOKEN through the masked secret field or secure prompt, and rerun. Never print the value while diagnosing. |
| 403, SAML/SSO, or push-access error | The token is not authorized for Microsoft, the selected repository is wrong, or the account lacks repository write/push access required by the traffic API. | Authorize Microsoft SAML/SSO, confirm the single-repository selection, and grant the account write/admin access. Keep Repository Administration read-only on the PAT. |
Workflow cannot push state/metrics.json |
GITHUB_TOKEN is read-only, workflow contents: write is missing, or branch protection rejects the workflow identity. |
Enable Actions Read and write permissions, retain contents: write, and review branch rules. Do not add Contents write to METRICS_TOKEN. |
| Issue feedback metrics are missing | The required collector permission or workflow permission is absent, structured markers or schemas are malformed, or recognized issues are missing the configured labels. | Set PAT Issues to required read-only, keep workflow issues: read, verify both structured markers and schemas, confirm labeling, then rerun and reconcile aggregates. |
| Discussion counts are inflated, missing, or voter identities appear | A duplicate mirror exists, a canonical marker is malformed, the Discussion token lacks access, or source identities were published instead of native aggregates. | Stop publication, restore the last reviewed snapshot, run the idempotent synchronizer, require one rating and one acquisition Discussion per agent, remove identity fields from public output, and rerun the aggregate-only checks. |
| Achievement points are inflated, mismatched, or expose issue content | The collector accepted a noncanonical achievement list, duplicated an achievement during re-sync, inferred a prerequisite, exceeded 150 points per workshop, trusted body-supplied points, or persisted source issue content. | Stop publication, restore the reviewed snapshot, enforce the exact progress marker/schema/workshop-primary-agent/ordered-achievements/source checks, recompute fixed server scoring, remove issue body/free text/ID, and rerun profile, workshop, and achievement reconciliation. |
| Zeros appear where data should be unavailable | An authorization or source failure was converted to zero instead of retaining the last known authorized value. | Check traffic.live, traffic.as_of, and unavailable_reason. A live authorized zero is valid; an unavailable read must be labeled and reuse the last authorized traffic snapshot. |