Skip to content

Name the absent Infisical service token in the ASC key staging fallback - #367

Merged
jaywedgeworth22 merged 39 commits into
mainfrom
wise/cc361-stage-asc-token-signal
Nov 8, 2026
Merged

jaywedgeworth22 merged 39 commits into
mainfrom
wise/cc361-stage-asc-token-signal

Conversation

@jaywedgeworth22

@jaywedgeworth22 jaywedgeworth22 commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #361 (merged as e442df4): the open Kody finding on scripts/stage-asc-key.mjs:182.
Refs #361

Summary

This PR names the absent Infisical read service token in the ASC key staging fallback instead of reporting it as a missing credential or a vault-permissions fault. The staging script now distinguishes “no explicit service token configured” from an empty value and from an unresolved Infisical reference, so the failure points operators at the missing INFISICAL_TOKEN configuration. The CI Infisical path moves from universal-auth client credentials to a scoped service token passed directly to the fleet reader, and the release workflows, composite action, docs, and contract tests are updated to match.

Key Changes

  • ASC staging failure clarity: scripts/stage-asc-key.mjs returns a distinct missing-service-token signal when no explicit service token is available. checkCredential reports that the token is not set, explicitly avoiding a misleading “missing credential” or “read permissions” message.
  • Service-token-only Infisical automation: fleetSecretsGet requires an st.-shaped service token and passes a minimal environment to fleet-secrets, preventing implicit machine-identity fallback. scripts/install-release-secrets-tooling.sh now configures the supplied token, proves the reader’s /asc read scope, scrubs the token from diagnostics, and no longer mints a universal-auth access token.
  • Workflow and action inputs: .github/actions/infisical-secrets/action.yml, ios-ship.yml, and mac-release.yml replace client ID/secret inputs with service-token and INFISICAL_CODECAPS_CI_READ_SERVICE_TOKEN. Error messages now refer to the scoped /asc read service token.
  • CI documentation and tests: Added docs/CI-INFISICAL-SERVICE-TOKENS.md and updated docs/AUTO-UPDATE.md, INFISICAL.md, and related tests. The tests cover absent-token naming, service-token passthrough, token redaction, and rejection of machine-identity fallback.

Broader Changes In The Branch

  • Infisical app setup: Replaces the single machine identity with versioned, build-scoped Keychain bindings supporting service tokens or machine identities, explicit read/write purposes, matching-scope write enforcement, and in-memory migration of version-1 identities to read-only bindings.
  • Provider and quota readers: Adds optional Kimi and Z.ai/ZCode quota readers, reader enable/disable preferences, Kimi credential scoping, Z.ai region-paired API-key storage, and shared quota-card projection logic.
  • Muse plugin and alerts: Adds a Plugins section, Muse session-store monitoring, burn and standard-session alert kinds, persisted detector state, and an optional Usage Monitor bridge with pending-event replay and deduplication.
  • SMS alerts: Adds an opt-in Twilio SMS channel for selected alert kinds, Keychain-backed Twilio credentials, pre-send reservations for duplicate protection, redirect refusal, and sanitized failures.
  • Quit and update behavior: Adds a quit confirmation with “close windows and keep running,” preserves menu-bar access in Dock-only mode, and skips the prompt during system shutdown/restart/logout or an active automatic Sparkle install.
  • Release/versioning: Replaces commit-count build numbers with a shared 12-digit Chicago merge-timestamp planner, fixed marketing version fallback, App Store Connect version preservation, paired Sparkle feed floor checks, and an iOS cleanup script for obsolete TestFlight builds and App Store versions.
  • Companion/widgets: Shares allowance selection and projection logic across Mac and companion surfaces, handles Fable/Argon model details, filters supplementary MiniMax video quota from plan pairs, and updates Kimi/Z.ai logo mapping.
  • Documentation and fixtures: Adds docs/rollouts/2026-11-03-cc205-monitoring-alert-controls.md, updates provider-mark documentation, and expands tests for the new behavior.

Verification And Risks

The added rollout note records that swift build passed and swift test executed 1,563 tests with 10 skipped and zero failures; it also records 79 automation contract tests passing. These results are reported in the added document, not re-run for this description. The same note says no live SMS was sent during development or automated testing and that no iOS simulator was used. It also states that replacement token binding and workflow publication must be verified before release.

Automated Review Findings To Resolve

The automated review reported 6 findings: one critical, three high, and two medium. These are reported findings, not verified conclusions.

  • Critical: Sources/CodeCaps/SMSAlertController.swift:13 — Twilio API secret is read only from Keychain, not env-first then Infisical.
  • High: ios/CodeCapsCompanion/App/Models/CompanionQuotaModel.swift:2349 — Argon limit rows are selected by substring instead of exact match.
  • High: ios/CodeCapsCompanion/App/Views/CompanionContentView.swift:1132 — Z.ai mark is listed as monochrome without a shipped asset or CI test.
  • High: ios/CodeCapsCompanion/Widgets/WidgetPresentation.swift:1026 — Argon detail windows are appended without de-duping against existing child windows.
  • Medium: Tests/Fixtures/WidgetUIProbe.swift:38 — MiniMax probe expects 3 windows but the video row is filtered out.
  • Medium: ios/CodeCapsCompanion/Widgets/WidgetPresentation.swift:369 — dualWindows matches the rewritten display label, so the video guard never fires.

Summary

Adds and sharpens test coverage for ResetAlarmTracker around "wait-for-usage" providers — quota windows that only advance once usage resumes — and clarifies an existing missed-periods test. The visible diff touches only Tests/QuotaCoreTests/ResetAlarmTrackerTests.swift; no production source changes are included in the provided patch.

Changes

  • testAWakeAfterThreeMissedWeeksAlerts: the inputs are now built with an explicit reading("7d", period: 7 * day, resetAt:…, observedAt:…) value instead of courtesyWindow(…), so the scenario unambiguously states that the reported end advanced by exactly three whole periods while the Mac was asleep. The assertion is unchanged: one alert.
  • testAWaitForUsageProviderSilentThroughTheGapDoesNotAlert (new): a provider shape where the window waits for usage. The Mac sleeps through roughly two periods, but the vendor's end does not move and remaining quota stays at 40. The test asserts no events fire, encoding that elapsed cadence alone is not a reset.
  • testAWaitForUsageProviderRestoreAlertsOnceNotTwice (new): the same long sleep, but remaining quota returns to 100 while the end stays put. The test asserts exactly one event, i.e. the existing restore-shape rule reports it and the missed-periods rule does not double-report.

Test evidence

These are tests added or adjusted in this change; the patch contains no record of them being executed, and no runtime verification is reported.

Open review finding

  • Medium — ResetAlarmTrackerTests.swift:1111: the reviewer reports that the new wait-for-usage silent-gap test still feeds its input through courtesyWindow, which injects a rolling weekly window rather than an unmoved end. If so, the test may not exercise the "end has not moved" condition it names, and the intended no-alert guarantee remains unverified. This finding is unresolved in the provided material.

swu-codex Bot and others added 29 commits November 3, 2026 16:56
* Add release-readiness follow-up edits missing from PR 357

Refs CC-205, AFC-618.  Salvaged from the codex-cc-205-release-ready lane: periodStartAt with the explicitStartConfirmsPeriod guard, exact weekly and five-hour label sets, and explicit Infisical service token enforcement in the ship scripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* release readiness: 5 Kody fixes - calendar-month start advance uses the 28-31d band (ResetAlarmTracker); service-token shape matches the installer st.*.* contract incl legacy 4-segment (shell+mjs agree); INFISICAL_TOKEN no longer passed via env argv (inherited, machine-identity vars env -u stripped); SENTRY_AUTH_TOKEN fallback reachable again; apps.json fixedMarketingVersion read is shape-validated.

---------

Co-authored-by: Claude <claude-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: swu-wise[bot] <344778455+swu-wise[bot]@users.noreply.github.com>
@swu-wise

swu-wise Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

@kody start-review - follow-up fix for the open critical finding from #361: the no-service-token guard now returns a distinct SERVICE_TOKEN_MISSING sentinel and checkCredential names the absent INFISICAL_TOKEN instead of the secret read permissions. Head a67568a.

@kody-ai kody-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kody-ai

This comment has been minimized.

Comment thread Tests/Fixtures/WidgetUIProbe.swift Resolved
kody-ai[bot]
kody-ai Bot previously requested changes Nov 6, 2026

@kody-ai kody-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found critical issues please review the requested changes

@kody-ai

kody-ai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

swu-wise Bot added a commit that referenced this pull request Nov 6, 2026
…at construction from the wire model id, model type and wire label. The display label cannot answer it: the rewrite turns a Hailuo daily into "1d window", so a label-only guard can miss the row and let it take the weekly coding window's bar (Kody review, PR #367). dualWindows now filters on the flag; probe and WidgetTests pin the rewritten-label case.
swu-wise Bot added a commit that referenced this pull request Nov 7, 2026
…deo off bars (#369)

* widgets: supplementary video quota never takes a plan window's bar

dualWindows picked the first two visible windows in array order, so MiniMax's supplementary video daily - which the reader itself calls supplementary and discrete - displaced the weekly coding window and the widget showed 1d instead of 7d (owner, 2026-11-06). The pair now comes from the plan's own windows when two are available, via the shared QuotaCapRule.isSupplementaryVideoQuota. Probe and mirrored test pin MiniMax 5h + 7d.

* widget probe: keep MiniMax selection check out of the gallery

The appended MiniMax platform duplicated the placeholders' MiniMax row in the rendered gallery.  It is now a standalone fixture used only by the two dualWindows preconditions, so the gallery input is identical to main and old/new pixel comparisons stay controlled.

* Fix WidgetTests FixtureWindow label memberwise init

A let with a default value is excluded from Swift's memberwise initializer, so the MiniMax video fixture's label: argument did not compile (QA 2026-11-06). Make it a var with a default, which the memberwise init includes with its default.

* Carry the supplementary-video identity on WidgetWindowItem, captured at construction from the wire model id, model type and wire label. The display label cannot answer it: the rewrite turns a Hailuo daily into "1d window", so a label-only guard can miss the row and let it take the weekly coding window's bar (Kody review, PR #367). dualWindows now filters on the flag; probe and WidgetTests pin the rewritten-label case.

* Key the widget window dedupe on the allowance identity (cadence + normalized wire label), not cadence alone: Copilot's three monthly buckets collapsed into one 1m row, hiding an exhausted Premium behind a 100% Chat row (QA pixel review). Same-reader fleet/local copies still merge. The MiniMax gallery placeholder is now the decisive edge case (5h + rewritten-label video row + 7d); the probe pins the wire path: video identity captured at parse, Copilot buckets keep three rows.

* Reground the dedupe identity on the wire contract, replacing the label key: dedupe on the server's canonical windowKey, normalized across producers by Usage Monitor. QA's actual payload words one MiniMax allowance two ways across producers, so a label key kept duplicate copies; Copilot's buckets carry distinct keys and keep distinct rows. other:unknown falls back to the cadence key. Probe pins the cross-producer merge, fresher-copy win, and Copilot's three rows.

* Key the dedupe on the server's series identity from the wire id, not the canonical windowKey: the series (modelId ?? bucketId) is what cross-producer copies of one allowance share, while QA's real payload showed windowKey is not identity - Copilot Chat and Completions both read monthly, and MiniMax's video weekly shares 7d with the plan weekly, so the fresher video copy ate the plan window. dualWindows no longer falls back to a video row. Probe pins the actual collision.

* Key the dedupe on the real wire contract, verified against QA's captured payload (committed verbatim in Tests/Fixtures): identity = video class + aliased series + canonical cadence. Video partitions first; bounded MiniMax general/coding-plan aliasing joins cross-producer copies; Copilot buckets keep rows; cadence keeps 5h/daily/weekly separate. Probe drives parseSnapshot with the actual fixture at a fixed now.

* Merge the two producer copies of xAI's one subscription credit pool: alias series grok:subscription (codecaps local reader id local-mac:grok:subscription) to the collector's bucketId xai:subscription, bounded to that pool per the producer contract (UnifiedSubscriptionPool already unifies the pair; subscription-quota-parsers.mjs emits xai:subscription). Adds the verbatim qa4 wire fixture and a probe section asserting one 7d 79% row with the fresher phone copy winning.

* Exclude supplementary video quota from plan cap state and headline (Sentry review): an exhausted video pool sits beside the subscription and never caps it - atCapWindow and buildPlatformItem now skip video rows the way the phone's QuotaCapRule binding and dualWindows already do. The WidgetTests dualWindows helper now mirrors production exactly (nil when fewer than two plan windows, no pool fallback). Probe asserts the real fixture's plan is not capped.

* Ground the video-only fallback and add executable cap-state cases (QA request): atCapWindow keeps a video-only platform's own cap state via the all-window fallback instead of never reporting cap; the probe exercises three constructed platform-level cases - spent video + live plan (no cap), spent plan + live video (plan caps), video-only (fallback binds the video window).

* Fix the two focus-small defects QA's pixels showed: controllingWindow now picks from the plan's own windows on every pick (video-only platforms keep theirs), so a spent video pool no longer headlines the gauge beside a plan with headroom; PlanAtCapRow's 'At Cap' label can no longer wrap one letter per line - lineLimit(1).fixedSize, the truncating title yields. Probe gains the two pick assertions beside the cap-state cases.

* Adopt QA's qa6 wire regression harness: committed verbatim under qa6-harness/ (probe + three actual wire payloads). WidgetUIProbe now runs the same A/B/C discriminating cases through the real parseSnapshot path - spent video never caps, headlines, or wins the gauge pick over a live plan; a spent plan window caps itself; a video-only platform keeps its own cap and pick via the fallback. Behavior regression tests, not source pins.

* Fix the probe's qa6 A pick expectation (QA caught it: mostUrgent is the Mac weekly general at 5%, not the 78% phone 5h - assertion was wrong, product behavior correct) and complete the durable harness: QA6CapProbe gains the 4 pick assertions (A mostUrgent=weekly 5%, A mostHeadroom=5h 78%, B mostUrgent=spent 5h 0%, C mostUrgent=video-only video), run-qa6.sh committed so the wire harness is reproducible from the branch.

* fix: case-insensitive allowance aliases and a caption window set that matches the headline

* test: pin the case-insensitive xai alias

* widget: canonicalise cadence leg of allowance identity into the wire windowKey namespace, so pre-windowKey copies merge with keyed copies (kody CC-210; same fix as companion model in #370)

* widget tests: source assertions pinning the canonical wire-cadence helper and the 7d mapping (kody CC-210; mirrors companion model assertions in #370)

---------

Co-authored-by: swu-wise[bot] <344778455+swu-wise[bot]@users.noreply.github.com>
Main has landed the reviewed ports of this lineage (reset-alarm rules,
widget pairing and dedupe, Kimi and z.ai readers and marks, companion
honesty, scoped Infisical service tokens).  Conflicts resolve to main's
refined implementations; this branch's unique contributions that main
lacks are kept: the optional-quota-reader toggles in Settings (with
main's Theme.success), and the muse-extra primary computation in
WidgetPlatformDisplay.percent (now over main's scoped-allowance filter).
install-release-secrets-tooling.sh is dropped, following main's
deletion; the workflows use the composite infisical-secrets action.
- LocalQuotaReaderRegistry.read now drops a QuotaWindow a later reader
  already surfaced, so grok-bot and gbu cannot publish one row twice
  (regression: testIdenticalWindowsFromTwoReadersArePublishedOnce).
- Reading.allowanceKey prefixes the bare-cadence fallback with the
  provider key, so two providers' weekly windows never collapse into one
  grouping bucket (regression: testBareCadenceAllowanceKeyIsProviderPrefixed).
- Model-detail classification (Reading.detailName and
  QuotaCapRule.isSubModelLimit) matches exact tokens instead of
  substrings, so Fable-era, Fabled and Argonaut are not classified as
  the Fable or Argon limit (regression:
  testFableDetectionIsExactTokenNotSubstring).
- SMSCredentialAccess.live resolves the Twilio API key secret from the
  environment first, then the Infisical project, with the Keychain setup
  record last, so the Keychain is no longer the source of truth for an
  ordinary service credential (regression:
  testSecretResolutionOrderIsEnvironmentThenInfisicalThenKeychain).
- WidgetWindowItem carries its per-model-detail identity from the wire
  fields, WidgetPlatformItem exposes primaryWindows and detailWindows,
  and the Antigravity pool publishes Argon beside the pool rows; the
  native widget probe and the widget detail views compile against real
  members again.
- The explicit period-start guard now refuses a non-advancing period
  instead of confirming it (merged in cdcc3f7).
A wire row the pool consolidation already published must not be appended
a second time as a model detail (Kody review, PR #367).
@jaywedgeworth22
jaywedgeworth22 enabled auto-merge (squash) November 8, 2026 05:24
The service-token guard answers before the reader seam runs unless the probe sets a token, so the error named the absent token instead of the reference.
jaywedgeworth22 and others added 2 commits November 8, 2026 00:33
The main-merge kept a stale apps.json against main�s 1.0.N train and ship-workflow pins.
Main took the pre-squash release sources in #357, so ten files conflicted. Took main's version of each, then re-applied this branch's unique work on top: the reset-alarm whole-multiple rule, the Kody review fixes (SMS cancellation, exact window labels, model-detail windows, caption rows) and the Antigravity dedupe. The supplementary-video widget pairing already exists in main's dualWindows, so it was not re-applied.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant