Skip to content

Check literal engine cooldowns at compile time and allow zero days - #80476

Merged
pelikhan merged 9 commits into
mainfrom
copilot/create-cooldown-mechanism
Nov 23, 2026
Merged

pelikhan merged 9 commits into
mainfrom
copilot/create-cooldown-mechanism

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Copilot’s runtime cooldown lookup can reject Enterprise-issued tokens. Move literal-version checks to compilation and allow zero cooldown in strict mode.

  • Compile-time checks: Validate literal versions, including defaults, against public GitHub or npm publication timestamps. Reject releases younger than the configured cooldown.
  • Best-effort metadata: Cache publication times and lookup failures for five minutes. Warn once per release per compiler instance when manual validation is needed.
  • Installation policy: Skip runtime cooldown lookups for literal Copilot versions; retain dynamic-version enforcement and checksum protections. Apply checks to effective detector and prefix-resolved engine installations.
  • Zero cooldown: Disable lookups, cooldown warnings, and release-age enforcement entirely, including in strict mode.
engine:
  id: copilot
  version: "1.0.103"
  cooldown: 0

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@pelikhan pelikhan changed the title Validate literal engine cooldowns at compile time and allow zero days Check literal engine cooldowns at compile time and allow zero days Nov 23, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 23, 2026 17:31
Copilot AI adaptive review requested due to automatic review settings November 23, 2026 17:31
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #80476 · codex · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ⊞ 176 · history

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~12 AIC · ⌖ ~2 AIC · ⊞ 7.1K · history

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Specification review completed for PR #80476 at head d889804; no applicable normative contract regression or eligible specification update was identified.

Generated by PR Specification Reviewer for #80476 · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.8K · history

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 7.4K · history

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Completed PR #80476 review: submitted two inline findings and a REQUEST_CHANGES review; review outcome recorded in review-history.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.7K · history

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What this change does: It checks literal engine release ages during compilation and allows a zero-day cooldown. It keeps runtime checks for dynamic Copilot versions.

Should fix

  1. The imported engine JSON parser repeats validation already provided by json.Unmarshal. Restoring the original call removes the extra decoder and preserves rejection of trailing values. See the inline comment.

Verdict: Ship after simplifying the parser.
Not checked: The local Go documentation command could not download its toolchain because TLS verification failed.
Lean: -5 lines possible.

Generated by ✂️ Ponytail Reviewer for #80476 · codex · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ⊞ 176
Comment /ponytail to run again

Comment thread pkg/workflow/engine.go Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-eb77b596-0128-4c03-999a-e269bf65e451","parents":[],"payload":{"id":"ldg-1b8a613e-0acc-4787-af5a-fc7d3740eb04","operation":"append","value":{"finding_count":0,"head_sha":"d8898042622f4c658da4087e339602a0c2b9a3f7","outcome":"aligned"}},"sha":"sha256:e1d667495c45b3da04e7ba25e542bc423a05748f2bf7c7965684af3d9ddb7689","timestamp":"2026-11-23T17:38:46.643Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/80476-check-literal-engine-cooldowns-at-compile-time.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch. It was generated from the PR diff.

  2. Complete the missing sections: add context the draft could not infer, refine the rationale, and confirm the alternatives. Two alternatives are marked as inferred because the PR does not discuss them.

  3. Commit the finalized ADR to docs/adr/ on your branch.

  4. Reference the ADR in this PR body, for example:

    ADR: ADR-80476: Check Literal Engine Cooldowns at Compile Time and Allow Zero Days (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate will re-run and verify that the implementation matches the decision.

🔁 Related ADR: divergence to resolve

The draft revises ADR-73829 (link unavailable: invalid HTTPS URL) in two places: runtime metadata verification for literal Copilot versions, and the rule that engine.cooldown: 0 is allowed only outside strict mode. Decide whether ADR-73829 should be updated or marked superseded.

References: §45228691513

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.6K · history
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-23T17:35:04Z
review_event: REQUEST_CHANGES
top_themes:
  - oversized npm packument causes warning-only cooldown validation
  - shared cache lock held during network metadata lookup
files_reviewed:
  - pkg/workflow/engine_release_cooldown.go
  - pkg/workflow/copilot_installer.go
  - pkg/workflow/engine_cooldown.go
  - pkg/workflow/threat_detection_external.go
  - pkg/workflow/threat_detection_helpers.go
comment_count: 2
History

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.7K · history
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Found two blocking correctness/performance concerns in the release metadata path:

  • npm packuments are fully buffered behind an 8 MiB cap, so larger supported packages fall back to warning-only validation and never enforce cooldown.
  • The shared cache lock is held during the network request, serializing concurrent compiler lookups behind the 5-second timeout.

Inline comments identify the affected lines and remediation direction.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.7K
Comment /review to run again

Comment thread pkg/workflow/engine_release_cooldown.go Resolved
Comment thread pkg/workflow/engine_release_cooldown.go Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-e05fe7b9-a1de-43e1-88f9-73096f472299","parents":[],"payload":{"id":"ldg-6f7e804d-b095-4f99-a55a-ec2cb2ba4144","operation":"append","value":{"finding_count":2,"head_sha":"d8898042622f4c658da4087e339602a0c2b9a3f7","outcome":"findings"}},"sha":"sha256:8e23889b6640f9162c00679bc8f951490c5d385511176bc0b5a89ee3811ebc49","timestamp":"2026-11-23T17:40:47.680Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

✅ Test Quality Score: 90/100 — Excellent

Analyzed 11 new Go tests (design: 11, implementation: 0, violations: 0). 8 modified tests also reviewed.

📊 Metrics (11 new tests)
Metric Value
Analyzed 11 new (Go: 11, JS: 0), plus 8 modified reviewed
✅ Design 11 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 11 (100%)
Duplicate clusters 0
Inflation YES (1 file, see flags)
🚨 Violations 0
Test File Classification Issues
TestEngineReleaseCooldownMetadata engine_release_cooldown_test.go design / high 13-case table covering boundary, malformed, unreachable, oversize; asserts caching and warnings
TestEngineReleaseCooldownCachePolicyAndExpiry engine_release_cooldown_test.go design / high Cache must not keep policy decisions; overflow guard; expiry refresh
TestEngineReleaseCooldownSkippedLookups engine_release_cooldown_test.go design / high Fails on any unexpected lookup; inspects internal cache field (minor coupling)
TestEngineReleaseCooldownNPMAndDefaults engine_release_cooldown_test.go design / high Malformed registry bodies; uses literalEngineReleaseVersion inside the stub (minor coupling)
TestEngineReleaseCooldownDetection engine_release_cooldown_test.go design / medium Young release requires threat-detection; zero and expression pass
TestEngineReleaseCooldownNetworkSafety engine_release_cooldown_test.go design / high No Authorization header; redirect to foreign host blocked; context cancel propagates
TestCopilotLiteralCooldownRuntimePolicy engine_release_cooldown_test.go design / medium String match on generated installer flag; boundary inputs only, no explicit error case
TestEngineReleaseCooldownResolvedTargets engine_release_cooldown_test.go design / high Crush regression guard; first loop compares to internal getInstallationVersion (minor coupling)
TestEngineReleaseCooldownExternalCommand engine_release_cooldown_test.go design / high External vs inline detection; asserts main config not mutated
TestCompileEngineReleaseCooldownLiteral engine_release_cooldown_test.go design / high End to end: young literal release errors and emits no lock file
TestEngineReleaseCooldownChecksumWithoutVersion engine_release_cooldown_test.go design / medium Pin without version rejected; unresolved selection keeps 7-day runtime policy
⚠️ Flagged Tests (3 non-blocking)

TestEngineCooldownSecondaryJobInheritance and TestEngineCooldownInheritedByCrossEngineDetection (engine_cooldown_test.go:174, :189): expectations changed from --cooldown-days 7 to 0 for the literal-pinned fixture. This is intended, but no job-level test now shows a non-zero cooldown propagating for a non-literal version. Only installer-level tests cover that. Suggested fix: add a non-literal case at job level.

TestCompileEngineCooldownDetection (engine_cooldown_test.go:245): the --cooldown-days 3 default-age assertion was removed and every value now asserts 0. Default-age emission is no longer checked on this compile path.

Inflation flag (engine_cooldown_test.go): 15 lines added against 4 added in engine_cooldown.go (3.75:1). This is driven by modified assertions. The real logic lives in engine_release_cooldown.go, where the test ratio is 370:281 (1.3:1). The formula inflation term is applied as scored.

Verdict

✅ passed. 0% implementation tests (threshold: 30%). No guideline violations: no mock libraries, and all new test files carry build tags.

References: §45228691744

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 7.4K · history
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs, /tdd, and /codebase-design (skill selection from the pr-triage output). No blocking defects found; the compile-time cooldown design is sound. Six focused inline comments follow.

📋 Key Themes & Highlights

Key Themes

  • Fail-open runtime gap: literal Copilot versions skip the runtime cooldown, so a failed compile-time lookup leaves them unchecked (warning only).
  • Concurrency: the cache lock is held across a 5 s network fetch, serializing concurrent compiles.
  • Vestigial API and duplication: the strict parameter is unused, and npm package names are duplicated across engines.
  • Test hygiene: require runs inside an HTTP callback off the test goroutine.

Positive Highlights

  • ✅ Compile-time and installer version resolution share helpers, so the validated version matches the installed one.
  • ✅ Network safety is well covered: redirects rejected, no auth header, bounded body, and timeouts.
  • ✅ Dynamic versions keep runtime enforcement, and docs and schema were updated consistently.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~12 AIC · ⌖ ~2 AIC · ⊞ 7.1K
Comment /matt to run again

Comment thread pkg/workflow/engine_cooldown.go Resolved
Comment thread pkg/workflow/engine.go Resolved
Comment thread pkg/workflow/copilot_installer.go Resolved
Comment thread pkg/workflow/engine_release_cooldown.go Resolved
Comment thread pkg/workflow/engine_release_cooldown.go Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 87/100. 0% implementation tests (threshold: 30%). No guideline violations. Correction to the posted report: edge/error coverage is 10/11 (TestCopilotLiteralCooldownRuntimePolicy has no error case), so the score is 87, not 90.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 7.4K
Comment /review to run again

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Outdated Copilot golden expectations break existing tests, while cooldown resolution gaps can leave the releases actually installed unchecked.

7 open issues
What changed in this PR

This PR adds literal engine release-age checks to gh-aw’s compiler, avoiding Copilot runtime metadata lookups that can reject Enterprise-issued tokens.

Changes:

  • Validate literal and default releases using cached public publication metadata, with manual-validation warnings when lookup fails.
  • Disable runtime cooldown lookups for literal Copilot versions while retaining dynamic-version enforcement and checksum protections.
  • Allow engine.cooldown: 0 in strict mode and update tests, schema descriptions, and documentation.
File Description
pkg/​workflow/​test_main_test.go Stubs release metadata for unrelated workflow tests.
pkg/​workflow/​engine.go Adds an explicit single-value JSON check and updates the cooldown comment.
pkg/​workflow/​engine_release_cooldown.go Implements release targeting, metadata lookup, caching, and age validation.
pkg/​workflow/​engine_release_cooldown_test.go Tests metadata handling, caching, detector targets, and installer policy.
pkg/​workflow/​engine_cooldown.go Allows zero cooldown regardless of strict mode.
pkg/​workflow/​engine_cooldown_test.go Updates validation, inheritance, and import tests.
pkg/​workflow/​copilot_installer.go Disables runtime cooldown checks for literal versions.
pkg/​workflow/​compiler_validators.go Integrates release-age validation and updates migration guidance.
pkg/​workflow/​compiler_types.go Adds metadata cache, client, clock, and warning state.
pkg/​parser/​schemas/​main_workflow_schema.json Clarifies zero-cooldown behavior in schema descriptions.
docs/​src/​content/​docs/​reference/​frontmatter-full.md Updates cooldown comments in generated examples.
docs/​src/​content/​docs/​reference/​engines.md Documents compile-time checks, fallback warnings, and runtime policy.
.changeset/​patch-compile-engine-release-cooldown.md Records the user-facing changes for release notes.

Review effort: Max (adaptive)

Comment thread pkg/workflow/copilot_installer.go Resolved
Comment thread pkg/workflow/engine_release_cooldown.go Resolved
Comment thread pkg/workflow/engine_release_cooldown.go Resolved
Comment thread pkg/workflow/engine_release_cooldown.go Resolved
Comment thread pkg/workflow/engine_release_cooldown.go Resolved
Comment thread pkg/workflow/engine_release_cooldown.go Resolved
Comment thread pkg/workflow/test_main_test.go Resolved
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/engine.go:917): address unresolved feedback - Review comment
  3. Review (pkg/workflow/engine_release_cooldown.go:243): address unresolved feedback - Review comment
  4. Review (pkg/workflow/engine_release_cooldown.go:173): address unresolved feedback - Review comment
  5. Review (pkg/workflow/engine_cooldown.go:54): address unresolved feedback - Review comment
  6. Review (pkg/workflow/engine.go:913): address unresolved feedback - Review comment
  7. Review (pkg/workflow/copilot_installer.go:78): address unresolved feedback - Review comment
  8. Review (pkg/workflow/engine_release_cooldown_test.go:195): address unresolved feedback - Review comment
  9. Review (pkg/workflow/engine_release_cooldown.go:176): address unresolved feedback - Review comment
  10. Review (pkg/workflow/engine_release_cooldown.go:24): address unresolved feedback - Review comment
  11. Review (pkg/workflow/copilot_installer.go:35): address unresolved feedback - Review comment
  12. Review (pkg/workflow/engine_release_cooldown.go:66): address unresolved feedback - Review comment
  13. Review (pkg/workflow/engine_release_cooldown.go:95): address unresolved feedback - Review comment
  14. Review (pkg/workflow/engine_release_cooldown.go:98): address unresolved feedback - Review comment
  15. Review (pkg/workflow/engine_release_cooldown.go:203): address unresolved feedback - Review comment
  16. Review (pkg/workflow/engine_release_cooldown.go:205): address unresolved feedback - Review comment
  17. Review (pkg/workflow/test_main_test.go:21): address unresolved feedback - Review comment
  18. Fix failing check build-wasm (FAILURE): Check run.
  19. Fix failing check Fast unit tests (W-Z and other) (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "97ba3453c5fdd9222d66d78878d4f2ec2b374676",
  "kind": "requested",
  "schema_version": "1",
  "state": "23c8781d7a2f9f3437722e1cbdfadebf92476b9309893e69880153de5666f337",
  "work": [
    "02defc190f21b65ebd2083f5a242d6e80805ea3e2c67e7c4f793e10c92fa80e5",
    "156e88f62431362c30f5c8d502db644a05bb591153a4407b9cbf0e9dd2a7b00b",
    "18a42ed42f117d8391f43386d127ee497e2a654b6f648c3846a0745b0bf3e109",
    "24d30678a642b1ebdcf39c7189fed08b2a745c6cbd2c09fd2e2ff8e51b96867d",
    "2fa3af697b7b9124ccfe29824b5a4bbbbc67ff128b442d86ea8d29a89a08bd62",
    "3906eebb6daffe07b3d89605477e0da42af0346336c85435345ac96821d1767b",
    "398a4f782431a786e28f98811452836781cd6d974b0cc23030d6ceda96bf059a",
    "40ebe5816c55e69a4a31426bc6a77c7ad86b32a6c84cd9973610c72661b43658",
    "7032ddd8a7afcbc95f10e20c4c3da31212b2dcd06303e5039c1c9f7e1f319f40",
    "7ab0402530fd03d1a54d7b8eead5f7e3b2a4dbdf5f84a7fd27a54427bf9cbd89",
    "7dba78855428ac3f53f6f853bfe4a590da0ca3bedbf22c85686f91919c081b5a",
    "8724480f4d227138d156f842492fce8375560194e6d2622219de75288f282f4a",
    "8acb61a077717e3a460018aacdfde96fd489f77606cd36169e2328d9079b75bb",
    "b43fb8ec68d1f38baa4a23192ad912b6090b6504fdbc4d0ec18dc9da1533c1a7",
    "b9520d5035377fd09d4abbc4db9c42af626483bf57bed9a487f2a18d646273ec",
    "c4c2ca5ba9c8dbfb8dae63c3ab631fbb1cc43c8b38fa12bee55e19db7261eba7",
    "c74b5e239e6f4fe8b4605806ded4f0504ff59d412ad453e03d99a34e92b226a5",
    "ebba1adc9d750f02fd3bfd40e5d151a3e9ab5d9602c358eb595a8223d5ebc0f6"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 7K · history
Comment /souschef to run again

gh-aw-bot and others added 5 commits November 23, 2026 18:31
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…wn-mechanism

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
- Stream npm packuments to extract only time[version]
- Release cache lock during metadata lookups
- Share engine npm package name constants
- Resolve alias, prefix-alias, and inline-detector targets like the installer
- Clarify failed-lookup warning to cover every applicable cooldown
- Drop unused strict parameter and json.Decoder in engine.go
- Deterministic release lookups in pkg/cli tests
- Document compile-time-only tradeoff for literal Copilot versions
- Regenerate golden fixtures and lock files

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ment Copilot cooldown tradeoff

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… spec (1.0.108)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan merged commit 8fb2f13 into main Nov 23, 2026
94 checks passed
@pelikhan
pelikhan deleted the copilot/create-cooldown-mechanism branch November 23, 2026 19:31
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.

4 participants