Repository navigation
feat(harness-ops): add a cost section to the morning brief - #8790
Conversation
The brief now shows, every morning, whether anything on GitHub or Azure is charging or could start charging: GitHub billing usage and budgets, Azure budgets, Defender charges month to date, Defender plan and access writes in the last 24 hours, secure score and Advisor counts. Reads only; local only. A read that fails or returns an unexpected shape prints UNREADABLE, never OK. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017SXDGDqYiL6gjmxogVtt1b
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: no findings. I reviewed the incremental diff since f2868cf (
The instruction-surface lens did not apply, because the diff deletes or softens no standing instruction. |
|
claude-review reviewed No findings. I reviewed the incremental change since
The closing issue #8343 states two acceptance criteria. Neither is affected by this delta, and the earlier tests already cover the az-logged-out case. |
The cost section now covers every line the issue asks for: - private-repo Actions minutes and artifact storage this month against the plan's included amounts (from flags), flagged at a configurable share; public repos, known from the org's repo list, are left out - an org scan: direct collaborators besides org admins, and workflows on pull_request_target or workflow_run that reference a _CLAUDE_ secret - each Log Analytics workspace's peak billable day over 31 days against its daily cap; no cap is an ALERT - Azure budgets read with their forecast; a forecast above --forecast-alert (else the budget amount) is an ALERT - required budgets and the anomaly alert: missing, disabled or ending within --expiry-days is an ALERT - a logged-out az makes every Azure line UNREADABLE naming az login; SKIPPED stays for az absent with no --subscription Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017SXDGDqYiL6gjmxogVtt1b
SKILL.md lists the new reads, flags and ALERT rules, the logged-out behaviour, and anchored pointers with recheck triggers for each new upstream page; the changelog fragment covers the full section. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017SXDGDqYiL6gjmxogVtt1b
az reads its stdin, so inside the per-workspace loop the first query consumed the remaining workspace ids and only one workspace printed. Every az read now gets no stdin, and the test double drains its stdin as az does, so the live-path test catches the regression. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017SXDGDqYiL6gjmxogVtt1b
The shell-portability gate flags \s; [[:space:]] matches the same in jq's regex engine. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017SXDGDqYiL6gjmxogVtt1b
…on home Every cost setting resolves through the config cascade: a flag, then morning_brief in docs/conventions/harness-ops.local.yaml (gitignored), then docs/conventions/harness-ops.yaml, then the default. An invalid value is named and its key takes the default; an unparsable file is named and skipped; the section's settings line names each value's layer. This repository's team file sets the org, the plan's included minutes and storage, the thresholds, the two required budgets and the anomaly alert; the subscription stays out of it. The schema validates the file, and morning-brief carries its own generated copy of the YAML-subset reader. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017SXDGDqYiL6gjmxogVtt1b
- The fork-trigger scan finds quoted and flow-style `on:` events, and counts `secrets: inherit`, `toJSON(secrets)` and a computed `secrets[...]` index as passing every secret; the `_CLAUDE_` name filter is unchanged. - No line is SKIPPED: a read that failed or was not made prints each line it feeds UNREADABLE with its fix, and the brief exits non-zero. - An org scan that listed no repo or hit its file cap is UNREADABLE with counts. - Budget lines carry the cost query's latest usage date; the query now runs daily and follows nextLink pages on management.azure.com only. - The org must be a GitHub owner name, alert percents are 0-100, the settings line shows values, a settings file never turns a fixture run live, and a parse error escapes control characters. - SKILL.md drops two unpointed upstream claims and anchors the pricing pointers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017SXDGDqYiL6gjmxogVtt1b
Rows with no numeric UsageDate print the data date as unread; only a query with no rows says there were none. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017SXDGDqYiL6gjmxogVtt1b
- A nextLink is followed only when it is the first page's query endpoint up to `?` (case-insensitive: the Query - Usage reference's examples spell the nextLink path `Query`), with no `..`, `//`, backslash, encoded dot or slash, or control character; any other ARM action is never run. - The fork-trigger scan accepts a quoted `secrets: "inherit"` or `'inherit'`, and an event name followed by a trailing comment. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017SXDGDqYiL6gjmxogVtt1b
…s a slash - The `..`, `//`, `%2e` and `%2f` checks run only on the nextLink's path; the prefix match, backslash and control-character checks still cover the whole link. A $skiptoken holding `%2F`, `%2B` or `%3D` is now followed. - Any non-ASCII byte in the nextLink rejects it, so the case fold behaves the same in every locale. - The rejection tests put the traversal, doubled slash and encoded dot in the path, where they still reject. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- morning-brief.sh falls back to `.` when BASH_SOURCE holds no directory, so `bash morning-brief.sh` from its own directory still parses the settings files instead of skipping every layer. - The no-az tests build a PATH directory linking every executable except az, so bash and jq stay reachable when az shares their directory, as /usr/bin does on the CI runner. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #8343
Summary
The morning brief gains a Cost section that shows whether anything on GitHub or Azure is charging, or could start charging. Every line is
OK,ALERT,INFOorUNREADABLE, and anUNREADABLEline names its fix.usage_alert_percent(default 50).pull_request_targetorworkflow_runworkflow (bare, quoted, flow-style, or with a trailing comment) that references a_CLAUDE_secret or passes every secret (secrets: inherit,toJSON(secrets), a computed index).forecast_alert. Each line carries the cost query's latest usage date and the read time.expiry_days.log_cap_alert_percent, or when the workspace has no cap.harness-ops.local.yaml, thendocs/conventions/harness-ops.yaml, then the default. Thesettings:line shows each value and its layer.Follows the owner decisions Q42, Q45/Q52, Q48, Q54, Q60, Q61, Q3 and Q12.
Fix
One bash section in
scripts/morning-brief.sh, with fixture flags for tests.Read-only. The one Azure POST is the Cost Management query. Its next pages are POSTed only to the same query endpoint; a
nextLinknaming any other ARM path isUNREADABLE.Local only: no workflow, no new credential. A settings file never turns a fixture run live.
Fails closed. A read that failed or was not made prints each line it feeds
UNREADABLEand the brief exits 6:Nothing prints as skipped.
Validation: the org must be a GitHub owner name and the alert percents must be 0-100. Control characters are stripped from printed values and escaped in parse errors.
The az dynamic extension install is disabled. The setting reaches the Windows
azunder WSL throughWSLENV.Verification
ae34ca0b39154681e627c3451096bbf249ec58cd:morning-brief.test.sh: 410/410 pass;morning-brief-view.test.sh: 14/14 pass;23d58ed8. Their findings are fixed inae34ca0b, and each fix has a test that fails on23d58ed8. The findings were:nextLinkpath pin;secrets: inherit;pr-verify.ymldesigned-path handling;CLAUDE_names;Related
🤖 Generated with Claude Code