feat(platformctl): emit apply no-op events #664

Merged
pdurlej merged 3 commits from codex/195-apply-noop-event into main 2026-06-01 14:56:40 +02:00
Collaborator

Canary status: missing - platformctl apply observability; run canary manually before merge if branch policy requires it.

Canary Context Pack

Product story

Operators need to see approved zero-change applies as real events, not invisible successful no-ops. This lets M06/M07 count how often apply confirms in-sync state without creating a parallel metrics system.

What changed

platformctl apply now emits a task_run-aligned apply_noop event when an approved plan is in sync and no remote apply is needed. The event is included in the JSON result and module status artifact.

Why it changed

Issue #195 asked for structured no-op apply counters. #460 landed the minimal ADR-0025 contract: { task_id, repo, agent, event_kind: "apply_noop", count, ts }.

Files touched

  • control-plane/platformctl/apply.py
  • control-plane/platformctl/tests/test_apply_phase3.py

Relevant context

  • state/memory/task-run-schema.md - #460 mini-contract for apply no-op events.
  • Existing apply no-op branch after approval/source/hash/freshness checks.

Runtime evidence

No runtime commands were run. Validation:

UV_CACHE_DIR=/private/tmp/codex-uv-cache uv run pytest platformctl/tests/test_apply_phase3.py -k 'noop_event or approved_noop'
UV_CACHE_DIR=/private/tmp/codex-uv-cache uv run pytest platformctl/tests/test_apply_phase3.py platformctl/tests/test_apply_env_file.py platformctl/tests/test_pr_sanity.py
PYTHONPATH=control-plane UV_CACHE_DIR=/private/tmp/codex-uv-cache uv run --project control-plane python -m platformctl.cli validate all --json

Results: targeted 2 passed; broader 134 passed; validate all exitCode 0.

Known constraints

The event is emitted only for approved in-sync plans that exit no-op. Dry-run no-op remains a dry-run result, not an apply_noop counter.

Explicit out-of-scope

  • No Postgres table creation.
  • No memory writer or checkpoint writer.
  • No runtime apply behavior change.
  • No Forgejo write path.

Requested decision

Approve if the event shape is acceptable for ADR-0025 ingestion and does not leak env-derived secrets.

Merge blockers

  • The event fields diverge from the #460 mini-contract.
  • A secret-shaped env var can appear in event fields. Tests cover fallback for token-shaped task IDs and unsafe agent values.

Spec sources read

  • Issue #195 - scope and acceptance sketch.
  • state/memory/task-run-schema.md - task_run/apply_noop mini-contract.
  • control-plane/platformctl/apply.py - no-op branch and status artifact path.
  • control-plane/platformctl/tests/test_apply_phase3.py - apply regression tests.

Closes #195

Canary status: missing - platformctl apply observability; run canary manually before merge if branch policy requires it. ## Canary Context Pack ### Product story Operators need to see approved zero-change applies as real events, not invisible successful no-ops. This lets M06/M07 count how often apply confirms in-sync state without creating a parallel metrics system. ### What changed `platformctl apply` now emits a task_run-aligned `apply_noop` event when an approved plan is in sync and no remote apply is needed. The event is included in the JSON result and module status artifact. ### Why it changed Issue #195 asked for structured no-op apply counters. #460 landed the minimal ADR-0025 contract: `{ task_id, repo, agent, event_kind: "apply_noop", count, ts }`. ### Files touched - `control-plane/platformctl/apply.py` - `control-plane/platformctl/tests/test_apply_phase3.py` ### Relevant context - `state/memory/task-run-schema.md` - #460 mini-contract for apply no-op events. - Existing apply no-op branch after approval/source/hash/freshness checks. ### Runtime evidence No runtime commands were run. Validation: ```bash UV_CACHE_DIR=/private/tmp/codex-uv-cache uv run pytest platformctl/tests/test_apply_phase3.py -k 'noop_event or approved_noop' UV_CACHE_DIR=/private/tmp/codex-uv-cache uv run pytest platformctl/tests/test_apply_phase3.py platformctl/tests/test_apply_env_file.py platformctl/tests/test_pr_sanity.py PYTHONPATH=control-plane UV_CACHE_DIR=/private/tmp/codex-uv-cache uv run --project control-plane python -m platformctl.cli validate all --json ``` Results: targeted 2 passed; broader 134 passed; `validate all` exitCode 0. ### Known constraints The event is emitted only for approved in-sync plans that exit no-op. Dry-run no-op remains a dry-run result, not an apply_noop counter. ### Explicit out-of-scope - No Postgres table creation. - No memory writer or checkpoint writer. - No runtime apply behavior change. - No Forgejo write path. ### Requested decision Approve if the event shape is acceptable for ADR-0025 ingestion and does not leak env-derived secrets. ### Merge blockers - The event fields diverge from the #460 mini-contract. - A secret-shaped env var can appear in event fields. Tests cover fallback for token-shaped task IDs and unsafe agent values. ## Spec sources read - Issue #195 - scope and acceptance sketch. - `state/memory/task-run-schema.md` - task_run/apply_noop mini-contract. - `control-plane/platformctl/apply.py` - no-op branch and status artifact path. - `control-plane/platformctl/tests/test_apply_phase3.py` - apply regression tests. Closes #195
feat(platformctl): emit apply no-op events
Some checks failed
platformctl plan / auto-apply scope (pull_request) Successful in 16s
pyfallow / Pyfallow gate (control-plane) (pull_request) Successful in 15s
python-ci / Python 3.12 (pull_request) Successful in 36s
canary-required / canary (pull_request) Successful in 11s
patchwarden-client-dry-run / dry-run (pull_request) Successful in 15s
base-is-main / guard (pull_request) Successful in 1s
canary-required / collect-diff (pull_request) Successful in 3s
patchwarden-client-dry-run / collect-diff (pull_request) Successful in 3s
patchwarden-pr-sanity / collect-diff (pull_request) Successful in 3s
python-ci / Python 3.11 (pull_request) Successful in 34s
python-ci / Python 3.13 (pull_request) Successful in 1m4s
patchwarden-pr-sanity / sanity (pull_request) Failing after 4m59s
50225a251e
Author
Collaborator

Patchwarden PR sanity

  • Status: blocked
  • PR: 664
  • Commit: 66f5ac57a9689f10db6db823a0104157166e8da3
  • Security-sensitive label: missing
  • Authority: advisory model review plus deterministic blockers only
  • 3+3 canary: still alive; this does not replace it

Deterministic findings

  • blocker security-sensitive-label-missing Security-sensitive change missing class/security-sensitive label — control-plane/platformctl/apply.py
    • Evidence: control-plane/platformctl/apply.py
    • Next: Apply class/security-sensitive and route through the full security-sensitive review lane before merge.
  • info sensitive-path-touched Sensitive path touched — control-plane/platformctl/apply.py
    • Evidence: control-plane/platformctl/apply.py
    • Next: Route through the existing 3+3/risk-tier process; model review remains advisory.

Model reviewers

global-glm / glm-5.1:cloud

  • Status: ok

  • Verdict: NOT_OK

  • medium Event shape diverges from ADR-0025 mini-contract

    • Evidence: PR description states #460 mini-contract specifies { task_id, repo, agent, event_kind, count, ts }. Implementation in control-plane/platformctl/apply.py:469-483 adds module, approved_pr, plan_age_seconds, source_sha beyond the contract. PR
    • Next: Policy decision needed: either update ADR-0025 to include the additional fields, or strip module/approved_pr/plan_age_seconds/source_sha from the event payload to match the contract exactly.
  • low Inconsistent event shape when approved_pr is None

    • Evidence: control-plane/platformctl/apply.py:483 filters None values: return {key: value for key, value in event.items() if value is not None}. When approved_pr is None, the key is omitted entirely rather than set to null, creating inconsistent eve
    • Next: Consider using None -> null mapping explicitly or always including approved_pr with a sentinel value (e.g., 0 or -1) for schema consistency.

global-deepseek / deepseek-v4-pro:cloud

  • Status: ok

  • Verdict: NOT_OK

  • high Event schema diverges from ADR-0025 mini-contract

    • Evidence: control-plane/platformctl/apply.py: _noop_apply_event returns fields 'module', 'approved_pr', 'plan_age_seconds', 'source_sha' not in the #460 contract { task_id, repo, agent, event_kind, count, ts }.
    • Next: Align event fields with the mini-contract or update the contract to include these fields before merge.
  • medium Status artifact gains new 'events' field, may break strict downstream parsers

    • Evidence: control-plane/platformctl/apply.py: _write_status_artifact now includes 'events' key. Downstream consumers of module status JSON may reject unknown fields.
    • Next: Verify that all consumers of status artifacts tolerate additional fields, or version the artifact schema.

redteam / kimi-k2.6:cloud

  • Status: error
  • Verdict: -
  • Note: ReadTimeout: The read operation timed out
  • Findings: none

Policy notes

  • GLM 5.1 + DeepSeek V4 Pro are the operator-required model mix for this bot.
  • Optional red-team model is enabled only when PLATFORMCTL_PR_SANITY_REDTEAM_MODEL is configured.
  • Auto-merge is not enabled here.
<!-- patchwarden-pr-sanity:pdurlej/platform:PR-664 --> # Patchwarden PR sanity - Status: `blocked` - PR: `664` - Commit: `66f5ac57a9689f10db6db823a0104157166e8da3` - Security-sensitive label: `missing` - Authority: advisory model review plus deterministic blockers only - 3+3 canary: still alive; this does not replace it ## Deterministic findings - **`blocker` `security-sensitive-label-missing`** Security-sensitive change missing class/security-sensitive label — `control-plane/platformctl/apply.py` - Evidence: `control-plane/platformctl/apply.py` - Next: Apply `class/security-sensitive` and route through the full security-sensitive review lane before merge. - **`info` `sensitive-path-touched`** Sensitive path touched — `control-plane/platformctl/apply.py` - Evidence: `control-plane/platformctl/apply.py` - Next: Route through the existing 3+3/risk-tier process; model review remains advisory. ## Model reviewers ### `global-glm` / `glm-5.1:cloud` - Status: `ok` - Verdict: `NOT_OK` - **`medium`** Event shape diverges from ADR-0025 mini-contract - Evidence: `PR description states #460 mini-contract specifies { task_id, repo, agent, event_kind, count, ts }. Implementation in control-plane/platformctl/apply.py:469-483 adds module, approved_pr, plan_age_seconds, source_sha beyond the contract. PR ` - Next: Policy decision needed: either update ADR-0025 to include the additional fields, or strip module/approved_pr/plan_age_seconds/source_sha from the event payload to match the contract exactly. - **`low`** Inconsistent event shape when approved_pr is None - Evidence: `control-plane/platformctl/apply.py:483 filters None values: `return {key: value for key, value in event.items() if value is not None}`. When approved_pr is None, the key is omitted entirely rather than set to null, creating inconsistent eve` - Next: Consider using `None` -> `null` mapping explicitly or always including approved_pr with a sentinel value (e.g., 0 or -1) for schema consistency. ### `global-deepseek` / `deepseek-v4-pro:cloud` - Status: `ok` - Verdict: `NOT_OK` - **`high`** Event schema diverges from ADR-0025 mini-contract - Evidence: `control-plane/platformctl/apply.py: _noop_apply_event returns fields 'module', 'approved_pr', 'plan_age_seconds', 'source_sha' not in the #460 contract { task_id, repo, agent, event_kind, count, ts }.` - Next: Align event fields with the mini-contract or update the contract to include these fields before merge. - **`medium`** Status artifact gains new 'events' field, may break strict downstream parsers - Evidence: `control-plane/platformctl/apply.py: _write_status_artifact now includes 'events' key. Downstream consumers of module status JSON may reject unknown fields.` - Next: Verify that all consumers of status artifacts tolerate additional fields, or version the artifact schema. ### `redteam` / `kimi-k2.6:cloud` - Status: `error` - Verdict: `-` - Note: ReadTimeout: The read operation timed out - Findings: none ## Policy notes - GLM 5.1 + DeepSeek V4 Pro are the operator-required model mix for this bot. - Optional red-team model is enabled only when `PLATFORMCTL_PR_SANITY_REDTEAM_MODEL` is configured. - Auto-merge is not enabled here.
chore(ci): rerun patchwarden sanity for apply noop
Some checks are pending
canary-required / canary (pull_request) Waiting to run
patchwarden-client-dry-run / collect-diff (pull_request) Successful in 3s
patchwarden-client-dry-run / dry-run (pull_request) Waiting to run
patchwarden-pr-sanity / collect-diff (pull_request) Successful in 4s
base-is-main / guard (pull_request) Successful in 1s
canary-required / collect-diff (pull_request) Successful in 4s
python-ci / Python 3.12 (pull_request) Successful in 36s
python-ci / Python 3.13 (pull_request) Successful in 36s
patchwarden-pr-sanity / sanity (pull_request) Waiting to run
platformctl plan / auto-apply scope (pull_request) Successful in 16s
pyfallow / Pyfallow gate (control-plane) (pull_request) Successful in 15s
python-ci / Python 3.11 (pull_request) Successful in 36s
f7ce7dd097
Merge main into apply noop event branch
Some checks failed
base-is-main / guard (pull_request) Successful in 1s
canary-required / collect-diff (pull_request) Successful in 4s
patchwarden-client-dry-run / collect-diff (pull_request) Successful in 4s
patchwarden-pr-sanity / collect-diff (pull_request) Successful in 3s
platformctl plan / auto-apply scope (pull_request) Successful in 17s
python-ci / Python 3.11 (pull_request) Successful in 35s
python-ci / Python 3.12 (pull_request) Successful in 36s
python-ci / Python 3.13 (pull_request) Successful in 36s
patchwarden-pr-sanity / sanity (pull_request) Failing after 4m44s
pyfallow / Pyfallow gate (control-plane) (pull_request) Successful in 15s
canary-required / canary (pull_request) Successful in 12s
patchwarden-client-dry-run / dry-run (pull_request) Successful in 16s
66f5ac57a9
pdurlej deleted branch codex/195-apply-noop-event 2026-06-01 14:56:40 +02:00
Sign in to join this conversation.
No reviewers
No labels
W6d-automerge-calibration
agent/claude-code
agent/codex
agent/hermes
agent/iskra
agent/ollama
agent/patchwarden
automerge-candidate
class/security-sensitive
cutover-gate
dependency/blocked
dependency/blocks-others
dependency/cross-repo
dependency/needs-confirmation
domain:agents
domain:ci
domain:docs
domain:forgejo
domain:infra
domain:memory
domain:runtime
domain:signal
domain:ux
flow/architecture
flow/blocked
flow/deployed
flow/done
flow/implementation
flow/intake
flow/maintained
flow/observed
flow/ready
flow/refining
flow/retired
flow/review
iterating
judge/codex-candidate
judge/hermes-candidate
judge/low-confidence
judge/needs-refinement
judge/operator-needed
judge/p0
judge/p1
judge/p2
judge/p3
judge/park
judge/patchwarden-candidate
judge/stale-priority
kind/adr
kind/bug
kind/chore
kind/feature
kind/infra
kind/ops
kind/refactor
kind/research
large-impact
merge/auto
merge/manual
merge/manual-dependency-conflict
merge/manual-failing-tests
merge/manual-merge-conflict
merge/manual-missing-review
merge/manual-operator-preference
merge/manual-red-zone
merge/manual-security-sensitive
merge/manual-unclear-scope
merge/manual-unknown
meta
mode:operator-only
mode:patchwarden-iskra-approved
mode:safe-auto
needs-operator-decision
needs-triage
not-ready
observed/erroring
observed/needs-followup
observed/pending
observed/retire-candidate
observed/unused
observed/used
operator-emotional
owner-attention
phase/02
phase/03
priority:p0
priority:p1
priority:p2
priority:p3
proposed
ready-for-agent
ready-for-operator
recovery
review:claude-reviewed
review:codex-reviewed
review:dziadek-reviewed
review:needs-human
risk/exposure
risk/process
risk/product
risk/runtime
safety:external-write
safety:no-prod-mutation
safety:prod-impact
safety:secret-touch
size/large
size/medium
size/small
size/tiny
size/unknown
source/adr
source/agent-generated
source/manual
source/operator-chat
source/voice-note
status:blocked
status:codex-ready
status:merged:pending-evidence
status:needs-evidence
status:operator-needed
status:parked
tier/full
tier/lite
tier/stacked
tier:0-platform-substrate
tier:1-iskra-value-layer
tier:2-tools-products-modules
type:bug
type:chore
type:docs
type:feat
type:policy
type:research
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pdurlej/platform!664
No description provided.