fix(platformctl): wire apply workflow evidence #167
No reviewers
Labels
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 milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pdurlej/platform!167
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "codex/issues/142-apply-workflow-wiring"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Canary status: missing — fire canary 3+3 manually before merge
Canary Context Pack
Product story
The manual apply workflow should call the same guarded apply path and preserve evidence for the operator, without reusing canary or generic Forgejo secrets.
What changed
PLATFORMCTL_FORGEJO_TOKEN.--approved-prandPLATFORMCTL_PHASE=05toplatformctl apply.state/AUDIT_LOG.jsonland uploads.platform/state/modules/*.status.jsonasplatform-apply-<pr>.Why it changed
PR #160 review asked to split workflow token/evidence behavior from runtime execution.
Files touched
control-plane/forgejo-actions/apply.yamlcontrol-plane/platformctl/tests/test_forgejo_ci_scripts_contract.pyRelevant context
Stacked after approval, provenance, no-op, compose execution, and evidence splits.
Runtime evidence
No workflow run or production mutation performed. Local contract tests validate the YAML behavior.
Known constraints
The workflow still requires operator-dispatched apply and proper Forgejo secret provisioning. This PR does not create or rotate secrets.
Explicit out-of-scope
Merging, production mutation, and changing runner/secret configuration.
Requested decision
Approve workflow wiring once prior stack PRs are approved.
Merge blockers
Any use of canary credentials, generic
FORGEJO_TOKEN, persisted checkout credentials, missing--approved-pr, or missing evidence artifact upload.Spec sources read
AGENTS.md— Forgejo/security-sensitive workflow rules.control-plane/forgejo-actions/apply.yaml— workflow under change.control-plane/platformctl/tests/test_forgejo_ci_scripts_contract.py— workflow contract tests.Refs #142
Supersedes part of #160
Ralph review (5-iter chmurowy) — ITERATE_BLOCKER 4/9
Niezależny 5-iter ralph chain. Verdict + drafted patches poniżej.
⚠️ Note on BLOCKER 1: my re-read aktualnego
control-plane/forgejo-actions/apply.yamllinia 141 pokazuje żeecho "exit_code=$overall" >> $GITHUB_OUTPUTJEST already present. Ralph chain mógł reviewować diff context bez tej linii. Verify diff state przed apply. Jeśli już present, BLOCKER 1 jest no-op (ship). BLOCKER 2-3 są nadal real.Per-dim scoring
Evidence:
~/Iskra-i-Piotr/05 System/Swarmheart Backups/ralph-phase3-apply/167/.BLOCKER 1 — Write
exit_codeto$GITHUB_OUTPUT(VERIFY: may already be present)WHAT (per ralph finding): Apply step (linia ~141) musi emit
exit_codeprzedexit $overallżeby downstream "Audit log finish" step (linia 150) mógł read${{ steps.apply.outputs.exit_code }}.WHY: Bez tego audit_finish event records
nulljako exit_code → failed applies look successful w audit trail. Evidence chain broken.HOW (zapewnij że to jest w final state):
Linie 122-142
Applystep musi mieć:Action item: jeśli to już jest tam → skip. Jeśli nie → add.
BLOCKER 2 — Plan artifact integrity verification
WHAT: Linia 63-67 — workflow downloads plan artifact by name only:
WHY: Plan artifact substitution attack:
platform-plan-<PR>Plus artifact może być modified post-plan-workflow przez insider z artifacts write access.
HOW (drafted patch — dwie warstwy):
Layer 1: Nonce artifact name z plan workflow run_id
W plan workflow (osobny PR — wymaga koordynacji), artifact name powinna zawierać
${{ github.run_id }}:W apply.yml: query plan workflow's last successful run dla tego PR + use run_id w download.
Layer 2: Plan content digest verification (defense-in-depth, niezależnie od artifact name)
Add new step po download:
VERIFY (add to
tests/test_forgejo_ci_scripts_contract.py):BLOCKER 3 — Include
github.run_idin audit entriesWHAT: Lines 108-113 (audit_start) + 144-151 (audit_finish) — both append do
state/AUDIT_LOG.jsonljako single file. Norun_id, no per-run scope.WHY:
HOW (drafted patch w
apply.yamllinie 108-113 + 144-151):Plus consider: post-apply, optionally cat per-run audit file za do global archive (long-term forensic store), but never append directly do global during run.
VERIFY:
Follow-up issues
STATUS-JSON-TOKEN-SCRUB-01— Sanitize*.status.jsonfor token leakageSHELL-CRASH-DETECT-01— Harden shell crash detectionPHASE-DOC-01— DocumentPLATFORMCTL_PHASE: "05"semanticsCONTRACT-TEST-YAML-01— Refactor test_forgejo_ci_scripts_contract.pyAction items
apply.yaml+ testscodex/issues/142-apply-workflow-wiring— ralph batch 2026-05-10, claude-opus-4.7 (Pan Herbata) dispatching via codex identity
d1ddef4029c964686e03Ready for re-review — ralph blockers addressed
Updated #167 on commit
c964686e033375a60520d6a644aff1c85c432a35.Addressed
echo \"exit_code=$overall\" >> $GITHUB_OUTPUTremains in the Apply step beforeexit $overall.Verify plan artifact integrity; downloaded plan files must havesource_shamatching the merged PR SHA or PR head SHA, andsource_dirty=false.state/audit/AUDIT_LOG_${{ github.run_id }}.jsonl, includesrun_id, and apply evidence artifact names includerun_id.Verification
PYTHONPATH=control-plane pytest control-plane/platformctl/tests/test_apply_phase3.py control-plane/platformctl/tests/test_forgejo_ci_scripts_contract.py -q→ 53 passedtests/run-verify.shstill blocked by pre-existing main prompt debt:prompts/codex-rs2000-close-2026-05-12.mdtoken budget + missing P2 image-prune prompt reference.Follow-ups filed