AIBAST Metrics administration

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.

Repository-scoped Least privilege No token values stored here Main branch deployment

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 gh CLI 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

Deployment progress 0 tasks complete
    • 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.
  1. Create a fine-grained personal access token with resource owner Microsoft and repository access limited to Only select repositories → aibast-agents-library.

    Repository permissionAccessReason
    Repository AdministrationRead-onlyReads repository traffic endpoints.
    MetadataRead (automatic)GitHub automatically includes repository metadata access.
    IssuesRead-only (required)Reads structured workshop-feedback and opt-in achievement progress issues without modifying them. Agent preference and acquisition use Discussions instead.
    ContentsNo access requiredNo Contents write is needed for the PAT itself; the workflow GITHUB_TOKEN handles 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.
  2. 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 prompt
    gh secret set METRICS_TOKEN --repo microsoft/aibast-agents-library
    Expected: Repository Actions secrets lists METRICS_TOKEN with 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.yml exists on the repository default branch and receives issue events for opened, edited, closed, and reopened activity.
    • Keep its workflow-level permissions explicit: issues: write to reconcile managed signal labels and actions: write to dispatch metrics.yml on the repository default branch.
    • Confirm .github/workflows/metrics.yml retains issues: read for workshop-feedback and opt-in achievement progress claims, discussions: write for idempotent rating/acquisition mirror synchronization and aggregate reads, plus contents: write for the snapshot commit.
    • Confirm scripts/sync_agent_discussions.py runs before scripts/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 write state/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, runs scripts/build_impact_report.py, commits the stable reports/impact-report.* exports, and uploads the same PDF, HTML, email text, Markdown, and JSON as the aibast-impact-report workflow 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: read
    Expected: 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.
  3. Open Actions → metrics, choose Run workflow, select branch main, and run .github/workflows/metrics.yml.

    Equivalent non-secret dispatch
    gh workflow run metrics.yml --repo microsoft/aibast-agents-library --ref main

    Review 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_downloads contains 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.
    CheckRequired result
    Discussion mirror contractEvery current AIBAST agent has one rating and one acquisition Discussion beginning with <!-- aibast-agent-discussion:v1 -->, schema aibast-agent-discussion/1.0, one canonical Signal, Agent, and File field.
    Rating signalThe rating Discussion uses Signal: upvote. Its native upvoteCount is community preference, with one active upvote per signed-in GitHub account.
    Acquisition signalThe parallel Discussion uses Signal: acquisition. Its native upvoteCount is one signed-in account's declared download, copy, or install and remains separate from CDN/release file transfers.
    Workshop-feedback signalThe workflow continues to recognize <!-- aibast-workshop-feedback:v1 --> and aibast-workshop-feedback/1.0 as a separate feedback source.
    Achievement progress signalThe workflow recognizes <!-- aibast-achievement-progress:v1 --> and schema aibast-achievement-progress/1.0, with exactly one Workshop, Agent, comma-separated Achievements, and present Source or Source quest URL field.
    Achievement canonical validationThe workshop is one of the canonical 72 with Grid Outage excluded, and the agent equals that workshop's canonical primary agent. Achievements is 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 validationEvery dependent achievement requires explicitly claimed started. workshop-completed also requires explicitly claimed local-proof, draft-builder, and preview-proven. hard-mode-completed remains a separate achievement and requires started. The collector never infers missing prerequisite IDs.
    Achievement union and scoringAcross 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, or Score field are rejected.
    Achievement public identity consentSubmitting 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 deduplicationGitHub enforces one active native upvote per account per Discussion. The collector publishes only the aggregate upvoteCount and never combines duplicate mirror threads.
    Discussion privacyThe 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 labelingThe issue workflow applies only the achievement-progress label to an achievement marker claim; workshop-feedback labeling remains separate.
    Weekly/monthly impact exportsThe 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, and impact-report.json. A missing 7-day or 30-day baseline is labeled Baseline pending.
    AIBAST-only populationThe snapshot, dashboard, leaderboards, and reports include AIBAST agents only. The ecosystem compatibility block marks RAR excluded and no RAR value contributes to a total.
    Refresh cadenceIssue changes dispatch metrics.yml on 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.
  4. Run the block in a trusted interactive shell. read -s suppresses terminal echo; the token exists only in the temporary environment variable and is unset after the request.

    Secure traffic verification
    read -s -p "Fine-grained PAT: " GH_TOKEN
    printf "\n"
    export GH_TOKEN
    gh api repos/microsoft/aibast-agents-library/traffic/clones
    unset GH_TOKEN

    Confirm 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/clones succeeds, and GH_TOKEN is unset immediately afterward.
  5. Readable local inspection
    python3 -m json.tool state/metrics.json
    • traffic.live is true, traffic.as_of is current for the run, and traffic.unavailable_reason is empty or absent.
    • totals.agent_upvotes equals the sum of available rating Discussion upvotes values in agent_metrics; totals.agent_acquisitions independently reconciles the acquisition Discussion values.
    • Every agent_metrics row exposes aggregate upvotes, acquisitions, upvote_discussion_url, and acquisition_discussion_url. leaderboards.most_upvoted and leaderboards.most_acquired rank 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_upvotes separately from usage_events, and both columns reconcile independently.
    • achievements.status, achievements.as_of, achievements.coverage, and achievements.caveat form 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.totals reconciles participants, points, achievement count, starts, workshop completions, hard completions, completion rate, hard-completion rate, and achievement-completion rate from achievements.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-defined badges/achievement_ids, and completed_workshops. The snapshot persists no issue body, free text, source issue ID, or body-supplied points.
    • The 72 achievements.workshops rows match the canonical workshop slugs and primary agents. Their achievement counts, points, starts, workshop completions, hard completions, and rates reconcile independently from usage_events, agent upvotes, signed-in acquisitions, downloads, and repository stars.
    • The six canonical achievements.achievements rows 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, and agent_acquisition_coverage explain Discussion completeness and freshness. Missing mirror threads remain partial/unavailable rather than becoming zero.
    • ecosystem.sources.rar.status is excluded; 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.
  6. 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 on main, 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.

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.

Final go-live checklist