-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add CI operational checkpoint v0.1 #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
safal207
wants to merge
40
commits into
main
Choose a base branch
from
feat/ci-operational-checkpoint-v0-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 33 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
b218417
feat: add CI operational checkpoint schema
safal207 54e0102
feat: add CI operational checkpoint example
safal207 7b3cbf3
feat: add deterministic checkpoint evaluator
safal207 4d00568
test: add CI checkpoint conformance cases
safal207 b082991
docs: add CI checkpoint outcome registry
safal207 37d9a8b
docs: define CI operational checkpoint contract
safal207 f1dc1e9
ci: add agent continuity conformance workflow
safal207 166498a
docs: add CI checkpoint profile to continuity README
safal207 5c1677d
fix: preserve checkpoint proof and workspace evidence
safal207 2f975ba
test: cover checkpoint lineage and workspace evidence
safal207 324c61a
fix: make dirty-state optional and require evidence refs
safal207 100d6f8
docs: preserve proof lineage and explicit workspace evidence
safal207 79ee81b
docs: register checkpoint lineage and workspace codes
safal207 a62bed7
fix: require verified parent checkpoint lineage
safal207 d9514ca
test: require full parent checkpoint
safal207 27f6f52
test: validate parent checkpoint integrity
safal207 d4a8878
docs: register verified parent lineage codes
safal207 bdbcdf7
docs: require verified parent lineage
safal207 b26e66c
fix: preserve objective constraints and pending verification
safal207 be56545
test: preserve active checkpoint state
safal207 e3e2a19
docs: register active-state lineage codes
safal207 0b11b69
docs: preserve active checkpoint state
safal207 ce7cd8a
fix: anchor checkpoint example evidence to commit
safal207 6a1e51b
fix: harden checkpoint parent link invariants
safal207 14ff094
docs: register checkpoint link invariant code
safal207 08fdb3d
fix: reject parent authority bypass
safal207 3791135
test: reject parent authority bypass
safal207 0a5fef1
fix: centralize checkpoint integrity guards in core
safal207 28b78e5
fix: make cached schema loader non-recursive
safal207 9dc8027
fix: preserve canonical checkpoint validation order
safal207 79109f4
refactor: remove preemptive facade validation
safal207 d806ce6
test: preserve checkpoint diagnostic priority
safal207 4a07a52
test: align empty evidence with schema precedence
safal207 f5a7a00
noop
safal207 65d4672
chore: remove accidental temporary file
safal207 1923353
fix: make parent hook reload-idempotent
safal207 9f1059b
test: cover reload-idempotent parent hook
safal207 48d043c
fix: reject whitespace-prefixed memory evidence
safal207 02f1040
test: normalize memory evidence prefixes
safal207 b0461bf
test: isolate parent memory evidence guard
safal207 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Agent Continuity conformance | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "standards/agent-continuity/**" | ||
| - ".github/workflows/agent-continuity-conformance.yml" | ||
| push: | ||
| paths: | ||
| - "standards/agent-continuity/**" | ||
| - ".github/workflows/agent-continuity-conformance.yml" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| conformance: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install conformance dependency | ||
| run: | | ||
| python -m pip install --disable-pip-version-check \ | ||
| -r standards/agent-continuity/conformance/requirements.txt | ||
|
|
||
| - name: Run Agent Continuity conformance suite | ||
| run: | | ||
| python -m unittest discover \ | ||
| -s standards/agent-continuity/conformance \ | ||
| -p 'test_*.py' \ | ||
| -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # CI Operational Checkpoint v0.1 Outcome Registry | ||
|
|
||
| Consumers MUST branch on `outcome` and `reason_code`, not on `detail`. | ||
|
|
||
| ## Outcomes | ||
|
|
||
| | Outcome | Meaning | | ||
| |---|---| | ||
| | `CONTINUE` | The checkpoint is valid, lineage is coherent, the workspace matches, and the next step may resume as context-only work. | | ||
| | `REVALIDATE_WORKSPACE` | Repository identity matches, but required workspace evidence is missing or base, head, or dirty-state evidence changed. | | ||
| | `RESTART_REQUIRED` | The checkpoint cannot safely resume in the current workspace or failed schema/digest validation. | | ||
| | `IDEMPOTENT_REPLAY` | The same checkpoint was already consumed; no duplicate work should be created. | | ||
| | `REJECT_LINEAGE_MISMATCH` | Parent, checkpoint identity, time, objective, constraints, sequence, trajectory, rejected-approach continuity, or parent integrity is inconsistent. | | ||
| | `REJECT_UNVERIFIED_COMPLETION` | Verification was completed without durable evidence, disappeared, or conflicts with prior proof or pending-work lineage. | | ||
| | `REJECT_INVALID_AUTHORITY` | Continuity material attempted to carry action authority or bypass fresh authorization. | | ||
|
|
||
| ## Reason codes | ||
|
|
||
| | Outcome | Reason code | | ||
| |---|---| | ||
| | `CONTINUE` | `CONTINUE_OK` | | ||
| | `REVALIDATE_WORKSPACE` | `WORKSPACE_STATE_CHANGED`, `CURRENT_WORKSPACE_FIELD_MISSING` | | ||
| | `RESTART_REQUIRED` | `SCHEMA_INVALID`, `DIGEST_MISMATCH`, `WORKSPACE_IDENTITY_MISMATCH`, `CURRENT_WORKSPACE_FIELD_MISSING` | | ||
| | `IDEMPOTENT_REPLAY` | `CHECKPOINT_ALREADY_CONSUMED` | | ||
| | `REJECT_LINEAGE_MISMATCH` | `ROOT_HAS_PARENT`, `PARENT_REQUIRED`, `PARENT_NOT_FOUND`, `PREVIOUS_CHECKPOINT_REQUIRED`, `PREVIOUS_CHECKPOINT_SCHEMA_INVALID`, `PREVIOUS_CHECKPOINT_DIGEST_MISMATCH`, `PREVIOUS_CHECKPOINT_SEMANTIC_INVALID`, `CHECKPOINT_ID_REUSED`, `PARENT_MISMATCH`, `SEQUENCE_MISMATCH`, `TRAJECTORY_CHANGED`, `CREATION_TIME_REGRESSED`, `OBJECTIVE_CHANGED`, `CONSTRAINT_LOST`, `REJECTED_APPROACH_ID_DUPLICATED`, `REJECTED_APPROACH_LOST`, `REJECTED_APPROACH_CHANGED` | | ||
| | `REJECT_UNVERIFIED_COMPLETION` | `VERIFICATION_ID_DUPLICATED`, `VERIFICATION_SET_MISMATCH`, `COMPLETION_EVIDENCE_MISSING`, `MEMORY_IS_NOT_VERIFICATION`, `COMPLETED_VERIFICATION_LOST`, `COMPLETED_VERIFICATION_CHANGED`, `PENDING_VERIFICATION_LOST`, `PENDING_VERIFICATION_CHANGED` | | ||
| | `REJECT_INVALID_AUTHORITY` | `AUTHORITY_NOT_CONTEXT_ONLY`, `FRESH_AUTHORITY_REQUIRED` | | ||
|
|
||
| Within version `0.1`, existing reason codes MUST NOT change meaning. |
107 changes: 107 additions & 0 deletions
107
standards/agent-continuity/CI-OPERATIONAL-CHECKPOINT-V0.1.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # CI Operational Checkpoint v0.1 | ||
|
|
||
| - **Status:** Draft | ||
| - **Profile:** `pythia.ci_operational_checkpoint.v0.1` | ||
| - **Parent:** [RFC-001](RFC-001-VERIFIABLE-CONTINUATION-ENVELOPE.md) | ||
| - **Scope:** CI/CD phase transitions, retries, restart, and agent handoff | ||
|
|
||
| ## Purpose | ||
|
|
||
| This profile defines a bounded checkpoint for resuming delivery work without | ||
| reconstructing state from narrative memory and without inheriting authority for | ||
| a consequential action. | ||
|
|
||
| ```text | ||
| validate schema and digest | ||
| -> check replay | ||
| -> validate parent checkpoint and lineage | ||
| -> preserve objective, constraints, rejected rationale, and verification proof | ||
| -> compare current workspace | ||
| -> CONTINUE | REVALIDATE | RESTART | IDEMPOTENT_REPLAY | REJECT | ||
| ``` | ||
|
|
||
| ## Core boundary | ||
|
|
||
| > Context may continue. Authority must be evaluated again. | ||
|
|
||
| `authority` is fixed to `context_only`. Merge and deploy intent MUST set | ||
| `requires_fresh_authority=true`. A checkpoint never replaces an Action Envelope, | ||
| current checks, current reviews, or an executor guard. | ||
|
|
||
| ## Required content | ||
|
|
||
| A conforming checkpoint records trajectory and parent identity, source agent and | ||
| session, repository and workspace identity, objective, phase, constraints, | ||
| rejected approaches, touched resources, verification state, the next action, | ||
| and a canonical SHA-256 digest. `dirty_state_digest` is optional. | ||
|
|
||
| The strict schema is | ||
| [`schema/ci-operational-checkpoint-v0.1.schema.json`](schema/ci-operational-checkpoint-v0.1.schema.json). | ||
|
|
||
| ## Active-state continuity | ||
|
|
||
| Within one trajectory: | ||
|
|
||
| - child creation time MUST NOT precede parent creation time; | ||
| - objective and acceptance criteria MUST remain unchanged; | ||
| - every prior `must` and `must_not` constraint MUST remain active; | ||
| - every rejected approach row and rationale MUST remain unchanged; | ||
| - every completed verification target and prior evidence reference MUST remain; | ||
| - every pending verification MUST remain with the same target or move to | ||
| completed with durable evidence. | ||
|
|
||
| Constraints and evidence may be added. Existing active state and proof may not be | ||
| silently removed or rewritten. A changed objective requires a new trajectory. | ||
|
|
||
| ## Verification boundary | ||
|
|
||
| Completed verification requires durable evidence. Memory and agent summaries | ||
| are not verification evidence, regardless of URI-scheme letter case. Additional | ||
| evidence may be appended, but existing evidence cannot be removed or replaced. | ||
|
|
||
| ## Parent-checkpoint integrity | ||
|
|
||
| Every non-root resume requires the full previous checkpoint. A known parent ID | ||
| alone is insufficient because it cannot prove active-state or verification | ||
| continuity. | ||
|
|
||
| Before comparison, the previous checkpoint MUST pass schema validation, | ||
| canonical digest verification, identifier uniqueness, verification-set | ||
| consistency, and the memory-evidence boundary. Invalid or missing parent material | ||
| returns `REJECT_LINEAGE_MISMATCH`. | ||
|
|
||
| Durable lookup and storage remain follow-up work in issue #223. | ||
|
|
||
| ## Workspace comparison | ||
|
|
||
| A repository or working-directory mismatch returns `RESTART_REQUIRED`. Changes | ||
| to base ref, head SHA, or a declared dirty-state digest return | ||
| `REVALIDATE_WORKSPACE`. | ||
|
|
||
| When the checkpoint declares `dirty_state_digest`, the resumed runtime MUST | ||
| explicitly report it, including `null` for an observed clean workspace. Missing | ||
| observation returns `CURRENT_WORKSPACE_FIELD_MISSING`. If the checkpoint omits | ||
| the field, it is outside the comparison boundary. | ||
|
|
||
| ## Replay | ||
|
|
||
| A consumed checkpoint ID returns `IDEMPOTENT_REPLAY`; completed work must not be | ||
| repeated. | ||
|
|
||
| ## Relationship to Action Envelope V1 | ||
|
|
||
| The checkpoint says what context and verification state to restore. Action | ||
| Envelope V1 decides whether an exact consequential action may execute now. The | ||
| contracts are complementary and non-substitutable. | ||
|
|
||
| ## Reference files | ||
|
|
||
| - example: [`examples/ci-operational-checkpoint-v0.1.example.json`](examples/ci-operational-checkpoint-v0.1.example.json) | ||
| - evaluator: [`conformance/ci_operational_checkpoint_reference.py`](conformance/ci_operational_checkpoint_reference.py) | ||
| - tests: [`conformance/test_ci_operational_checkpoint.py`](conformance/test_ci_operational_checkpoint.py) | ||
| - codes: [`CI-CHECKPOINT-CODES.md`](CI-CHECKPOINT-CODES.md) | ||
|
|
||
| ## Non-claims | ||
|
|
||
| This profile is not durable storage, a distributed lease, proof of execution, or | ||
| permission for a tool call. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
standards/agent-continuity/conformance/ci_operational_checkpoint_reference.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import Any, Iterable, Mapping | ||
|
|
||
| import ci_operational_checkpoint_reference_core as _core | ||
| from ci_operational_checkpoint_reference_core import * # noqa: F401,F403 | ||
|
|
||
|
|
||
| def evaluate_resume( | ||
| checkpoint: Mapping[str, Any], | ||
| *, | ||
| current_workspace: Mapping[str, Any], | ||
| previous_checkpoint: Mapping[str, Any] | None = None, | ||
| seen_checkpoint_ids: Iterable[str] = (), | ||
| known_parent_ids: Iterable[str] = (), | ||
| ) -> dict[str, str]: | ||
| """Delegate to the canonical core evaluator without pre-validation.""" | ||
|
|
||
| return _core.evaluate_resume( | ||
| checkpoint, | ||
| current_workspace=current_workspace, | ||
| previous_checkpoint=previous_checkpoint, | ||
| seen_checkpoint_ids=seen_checkpoint_ids, | ||
| known_parent_ids=known_parent_ids, | ||
| ) |
111 changes: 111 additions & 0 deletions
111
standards/agent-continuity/conformance/ci_operational_checkpoint_reference_core.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import Any, Iterable, Mapping | ||
|
|
||
| import ci_operational_checkpoint_reference_impl as _impl | ||
| from ci_operational_checkpoint_reference_impl import * # noqa: F401,F403 | ||
|
|
||
| _result = _impl._result | ||
| _schema_errors = _impl._schema_errors | ||
| _ORIGINAL_PREVIOUS_CHECKPOINT_INTEGRITY_ERROR = ( | ||
| _impl._previous_checkpoint_integrity_error | ||
| ) | ||
|
|
||
|
|
||
| def _previous_checkpoint_integrity_error( | ||
| previous_checkpoint: Mapping[str, Any], | ||
| ) -> tuple[str, str] | None: | ||
| """Extend parent integrity after canonical schema and digest validation.""" | ||
|
|
||
| error = _ORIGINAL_PREVIOUS_CHECKPOINT_INTEGRITY_ERROR(previous_checkpoint) | ||
| if error is not None: | ||
| return error | ||
|
|
||
| sequence = previous_checkpoint["sequence"] | ||
| parent_id = previous_checkpoint["parent_checkpoint_id"] | ||
| checkpoint_id = previous_checkpoint["checkpoint_id"] | ||
| if sequence == 0 and parent_id is not None: | ||
| return ( | ||
| "PREVIOUS_CHECKPOINT_SEMANTIC_INVALID", | ||
| "root previous checkpoint must not declare a parent", | ||
| ) | ||
| if sequence > 0 and parent_id is None: | ||
| return ( | ||
| "PREVIOUS_CHECKPOINT_SEMANTIC_INVALID", | ||
| "non-root previous checkpoint must declare a parent", | ||
| ) | ||
| if parent_id is not None and checkpoint_id == parent_id: | ||
| return ( | ||
| "PREVIOUS_CHECKPOINT_SEMANTIC_INVALID", | ||
| "previous checkpoint cannot be its own parent", | ||
| ) | ||
|
|
||
| for row in previous_checkpoint["verification"]["completed"]: | ||
| if not row["evidence_refs"]: | ||
| return ( | ||
| "PREVIOUS_CHECKPOINT_SEMANTIC_INVALID", | ||
| f"{row['verification_id']} has no evidence references", | ||
| ) | ||
|
|
||
| next_action = previous_checkpoint["next_action"] | ||
| if ( | ||
| next_action["action_class"] in {"merge", "deploy"} | ||
| and not next_action["requires_fresh_authority"] | ||
| ): | ||
| return ( | ||
| "PREVIOUS_CHECKPOINT_SEMANTIC_INVALID", | ||
| "parent merge or deploy intent requires fresh authority", | ||
| ) | ||
| return None | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
|
|
||
| # Install the enhanced parent hook into the canonical ordered implementation. | ||
| _impl._previous_checkpoint_integrity_error = _previous_checkpoint_integrity_error | ||
|
|
||
|
|
||
| def evaluate_resume( | ||
| checkpoint: Mapping[str, Any], | ||
| *, | ||
| current_workspace: Mapping[str, Any], | ||
| previous_checkpoint: Mapping[str, Any] | None = None, | ||
| seen_checkpoint_ids: Iterable[str] = (), | ||
| known_parent_ids: Iterable[str] = (), | ||
| ) -> dict[str, str]: | ||
| """Preserve canonical validation order and stable authority diagnostics.""" | ||
|
|
||
| errors = _schema_errors(checkpoint) | ||
| authority_error = next( | ||
| ( | ||
| error | ||
| for error in errors | ||
| if list(error.absolute_path) == ["authority"] | ||
| ), | ||
| None, | ||
| ) | ||
| if authority_error is not None: | ||
| return _result( | ||
| REJECT_INVALID_AUTHORITY, | ||
| "AUTHORITY_NOT_CONTEXT_ONLY", | ||
| authority_error.message, | ||
| ) | ||
|
|
||
| result = _impl.evaluate_resume( | ||
| checkpoint, | ||
| current_workspace=current_workspace, | ||
| previous_checkpoint=previous_checkpoint, | ||
| seen_checkpoint_ids=seen_checkpoint_ids, | ||
| known_parent_ids=known_parent_ids, | ||
| ) | ||
|
|
||
| if result["outcome"] == CONTINUE: | ||
| sequence = checkpoint["sequence"] | ||
| if ( | ||
| sequence > 0 | ||
| and checkpoint["checkpoint_id"] == checkpoint["parent_checkpoint_id"] | ||
| ): | ||
| return _result( | ||
| REJECT_LINEAGE_MISMATCH, | ||
| "CHECKPOINT_ID_REUSED", | ||
| "a checkpoint cannot reuse its parent checkpoint ID", | ||
| ) | ||
| return result | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.