Issue #2741: Add keepalive capability bundle contract - #2744
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughChangesCapability Bundle v1 adds deterministic bundle validation and selection, integrates matching fragments into keepalive prompts, records bundle evidence in metrics, defines JSON Schema and documentation contracts, synchronizes consumer templates, and adds contract tests. Capability Bundle v1
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant KeepalivePromptComposer
participant selectCapabilityBundles
participant renderCapabilityFragments
participant KeepaliveMetrics
KeepalivePromptComposer->>selectCapabilityBundles: select bundles for context
selectCapabilityBundles-->>KeepalivePromptComposer: applied and rejected bundles
KeepalivePromptComposer->>renderCapabilityFragments: render applied fragments
renderCapabilityFragments-->>KeepalivePromptComposer: capability prompt text
KeepalivePromptComposer->>KeepaliveMetrics: record bundle IDs, hashes, gates, and rejection reasons
Suggested labels: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🤖 Keepalive Loop StatusPR #2744 | Agent: Codex | Iteration 0/12 Current State
Last Codex Run
To retry immediately:
Or wait for the next successful Gate run to automatically retry. 🔍 Failure Classification| Error type | infrastructure |
|
Keepalive Work Log (click to expand)
|
|
Runner dispatch state for codex on PR #2744. Do not edit. |
There was a problem hiding this comment.
Pull request overview
Adds the new capability-bundle/v1 contract to Workflows (and consumer templates) and introduces initial JS helpers to validate/select bundles, inject their fragments into keepalive prompt composition, and surface bundle evidence in keepalive metrics.
Changes:
- Introduces
capability-bundle/v1schema + contract docs (root + consumer template). - Adds
capability_bundle.js(root + consumer template) and integrates bundle selection/rendering intokeepalive_prompt_composer.js. - Extends keepalive metrics shape to include applied bundle IDs/hashes and rejection reasons; adds contract tests and sync-manifest entries.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
docs/contracts/schemas/capability-bundle-v1.schema.json |
Adds the JSON Schema definition for capability-bundle/v1. |
docs/contracts/capability-bundle-v1.md |
Documents the contract fields and hashing rules for bundles. |
docs/keepalive/METRICS_SCHEMA.md |
Documents new keepalive metrics fields for capability bundle evidence. |
.github/scripts/capability_bundle.js |
Implements bundle hashing, validation, selector matching, and fragment rendering. |
.github/scripts/keepalive_prompt_composer.js |
Applies selected capability bundle fragments into composed keepalive prompts and returns selection results. |
.github/scripts/keepalive_loop.js |
Extends metrics record construction to emit capability-bundle-related fields. |
.github/scripts/__tests__/capability-bundle-contract.test.js |
Adds tests for bundle validation, hash mismatch rejection, prompt composition, and metrics emission behavior. |
.github/sync-manifest.yml |
Declares new scripts/docs as centrally managed consumer-facing assets. |
templates/consumer-repo/docs/contracts/schemas/capability-bundle-v1.schema.json |
Consumer-template copy of the schema. |
templates/consumer-repo/docs/contracts/capability-bundle-v1.md |
Consumer-template copy of the contract docs. |
templates/consumer-repo/.github/scripts/capability_bundle.js |
Consumer-template copy of bundle hashing/validation/selection helper. |
templates/consumer-repo/.github/scripts/keepalive_prompt_composer.js |
Consumer-template copy of prompt composer integration. |
templates/consumer-repo/.github/scripts/keepalive_loop.js |
Consumer-template copy of keepalive metrics field emission changes. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c098902e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/scripts/capability_bundle.js:
- Around line 71-126: Update validateCapabilityBundle to require non-empty owner
and rollback fields, alongside the existing fragments and gates checks,
rejecting bundles that omit either documented field. Add validation tests
covering bundles missing owner and rollback, and ensure valid bundles still
pass.
In @.github/scripts/keepalive_prompt_composer.js:
- Around line 34-47: Update the compose function to distinguish an omitted
params.capabilityBundles from an explicitly provided empty array. Use a presence
check (such as Array.isArray(params.capabilityBundles) or an own-property check)
so [] is passed to selectCapabilityBundles as the per-call override, while
absent or invalid values continue using the composer-level capabilityBundles
default.
In `@templates/consumer-repo/.github/scripts/capability_bundle.js`:
- Around line 128-134: loadCapabilityBundles currently drops plain object
documents when they lack a bundles property. Update its parsed-object handling
to either treat parsed itself as a single bundle or explicitly throw a
validation error, rather than passing parsed.bundles through asArray and
returning an empty list; preserve array and {bundles: [...]} support and use
validateCapabilityBundle for accepted single objects.
- Around line 71-126: Align validateCapabilityBundle with the companion schema
by validating capabilityId against ^[a-z0-9][a-z0-9._/-]*$, validating the
normalized version against ^v?[0-9]+(\.[0-9]+){0,2}$, and ensuring every item in
bundle.gates is a non-empty string after normalization. Preserve the existing
required-field and gate-array checks while rejecting values that violate these
constraints.
- Around line 30-41: Protect the capability bundle template and its rendered
fragment inputs from unauthorized edits: update the repository’s CODEOWNERS or
equivalent path-level access controls to require trusted owner review for this
bundle path and related fragments.task/fragments.acceptance files. Ensure
changes to these files cannot be merged without the designated owner approval,
rather than relying solely on computeCapabilityBundleHash and
validateCapabilityBundle.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4507bf44-69a7-4b1b-a556-44cced2f9809
📒 Files selected for processing (13)
.github/scripts/__tests__/capability-bundle-contract.test.js.github/scripts/capability_bundle.js.github/scripts/keepalive_loop.js.github/scripts/keepalive_prompt_composer.js.github/sync-manifest.ymldocs/contracts/capability-bundle-v1.mddocs/contracts/schemas/capability-bundle-v1.schema.jsondocs/keepalive/METRICS_SCHEMA.mdtemplates/consumer-repo/.github/scripts/capability_bundle.jstemplates/consumer-repo/.github/scripts/keepalive_loop.jstemplates/consumer-repo/.github/scripts/keepalive_prompt_composer.jstemplates/consumer-repo/docs/contracts/capability-bundle-v1.mdtemplates/consumer-repo/docs/contracts/schemas/capability-bundle-v1.schema.json
|
Closer review-fix pushed in Addressed the current unresolved review set:
Validation:
I also removed stale automation blocker labels ( |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/scripts/capability_bundle.js:
- Around line 77-134: Tighten validateCapabilityBundle to match the schema by
rejecting unknown top-level properties, enforcing the schema’s capability_id and
version patterns, and expanding FORBIDDEN_KEY_PATTERN to detect
command/control/exec-style inline fields. Use the existing bundle validation and
walkForbiddenKeys logic, preserving current error handling and hash validation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6816e1ad-91fa-4811-a08d-421fe62832d2
📒 Files selected for processing (15)
.github/scripts/__tests__/capability-bundle-contract.test.js.github/scripts/__tests__/keepalive-prompt-composer.test.js.github/scripts/capability_bundle.js.github/scripts/keepalive_loop.js.github/scripts/keepalive_prompt_composer.js.github/sync-manifest.ymldocs/contracts/capability-bundle-v1.mddocs/contracts/schemas/capability-bundle-v1.schema.jsondocs/keepalive/METRICS_SCHEMA.mdlangsmith-fleet-worker-attempt.jsontemplates/consumer-repo/.github/scripts/capability_bundle.jstemplates/consumer-repo/.github/scripts/keepalive_loop.jstemplates/consumer-repo/.github/scripts/keepalive_prompt_composer.jstemplates/consumer-repo/docs/contracts/capability-bundle-v1.mdtemplates/consumer-repo/docs/contracts/schemas/capability-bundle-v1.schema.json
|
Closer update for the latest CodeRabbit validation thread:
Validation passed locally on head
The remaining blocker should be fresh async GitHub checks/review settling on the new head. |
Provider Comparison ReportProvider Summary
📋 Full Provider Details (click to expand)openai
anthropic
Agreement
Disagreement
Unique Insights
🔍 LangSmith Traces |
Closes #2741
Automated Status Summary
Scope
Workflows correctly owns the GitHub event loop and agent-agnostic routing (
docs/keepalive/Agents.md:68-75;GoalsAndPlumbing.md:140-151), but it has no neutral contract for portable Orchestrator capabilities. Keepalive metrics currently return iteration/action/error/duration/task counts without applied capability/gate IDs (docs/keepalive/METRICS_SCHEMA.md:1-36).The research backplane is a separate activation-debt proving case. This issue establishes the neutral capability-bundle contract only; participant emission and Workflows registry transitions are split into dependent repo-specific issues.
Tasks
capability-bundle/v1schema under Workflows contract/schema paths with capability ID/version/hash, deterministic selector predicates, owner, task/acceptance fragments, gate/playbook refs, expiry, and rollback; forbid local weights/credentials/raw prompts..github/scripts/keepalive_prompt_composer.jsand related Keepalive runner code without changing label-to-runner authority.templates/consumer-repo, sync manifests, conformance tests, and freshness tests from the Workflows source of truth.Acceptance criteria
.github/scripts/__tests__/capability-bundle-contract.test.js::validBundle, change onlycontent_hashtosha256:deadbeef; run exact test.github/scripts/__tests__/capability-bundle-contract.test.js::hash mismatch blocks dispatchvianode --test .github/scripts/__tests__/capability-bundle-contract.test.js --test-name-pattern='hash mismatch blocks dispatch'; observeAssertionError: invalid capability hash reached prompt composition; revert and show the exact test passes.Summary by CodeRabbit