feat(platformctl): persist apply status artifacts #166
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!166
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "codex/issues/142-apply-evidence-artifacts"
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
Apply results must be inspectable after a job finishes; otherwise the operator only has expiring logs and screenshots.
What changed
.platform/state/modules/<module>.status.jsonwrite for no-op, applied, and remote-failed results..platform/state/in git.Why it changed
PR #160 review flagged that observed/apply evidence could be hidden in expiring artifacts.
Files touched
.gitignorecontrol-plane/platformctl/apply.pycontrol-plane/platformctl/tests/test_apply_phase3.pyRelevant context
Stacked after compose execution split.
Runtime evidence
No live runtime mutation. Local tests validate artifact writes under a temp state root.
Known constraints
This writes local job/worktree artifacts only; upload wiring is in the next split.
Explicit out-of-scope
Forgejo Actions artifact upload and workflow token wiring.
Requested decision
Approve durable local apply evidence surface.
Merge blockers
Any raw secret output written to status artifacts, non-atomic writes, or missing failure evidence.
Spec sources read
AGENTS.md— evidence/canary expectations..gitignore— local state ignore policy.control-plane/platformctl/apply.py— status artifact writer.control-plane/platformctl/tests/test_apply_phase3.py— 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.
Per-dim scoring
Evidence:
~/Iskra-i-Piotr/05 System/Swarmheart Backups/ralph-phase3-apply/166/.BLOCKER 1 — Sanitize
moduleinput (path traversal)WHAT:
_write_status_artifactlinia 290-292:module = result.get("module") or plan.get("module"). Sprawdza only non-empty string. Then linia 310:target = state_root / "modules" / f"{module}.status.json"— Path's/operator joins without sanitization.WHY: Trivial path traversal:
Apply z malicious plan może write status artifacts anywhere on filesystem. Combined z linia 311
target.parent.mkdir(parents=True), attacker creates dirs anywhere.HOW (drafted patch w
apply.pylinie 284-315):VERIFY (add to
tests/test_apply_phase3.py):BLOCKER 2 — Guard artifact emission (exception masking)
WHAT:
_attach_status_artifactlinia 318-322:No try/except. Failed write (OSError: disk full, permission denied, ValueError z BLOCKER 1) raises → propagates do
apply_plan→ unhandled exception → caller gets stack trace zamiast clean exit code. Apply may have succeeded, ale wrapper crash hides that.WHY: Status artifact is enrichment, not gate. Write failure must NOT corrupt apply result/exit code. Observability concern shouldn't mask correctness signal.
HOW (drafted patch w
apply.pylinie 318-322):VERIFY:
BLOCKER 3 — Unique temp filename (concurrent race)
WHAT: Linia 312:
tmp = target.with_suffix(target.suffix + ".tmp")— deterministic<module>.status.json.tmp. Two concurrent applies dla tego samego modułu collide.WHY: Race condition:
Concurrent applies on same module aren't strictly forbidden (operator might trigger via different gates). Deterministic temp = silent corruption.
HOW (drafted patch w
apply.pylinia 312):Add
import timena górze pliku.Note: combining pid + millis avoids both same-process concurrent (gevent/threading) i cross-process collisions.
VERIFY:
Follow-up issues
STATUS-PERMS-01— Restrictive file permissionsSTATUS-FSYNC-01— Disk durability via fsyncSTATUS-ABSPATH-01— Normalize status_artifact pathAction items
apply.py+ testscodex/issues/142-apply-evidence-artifacts— ralph batch 2026-05-10, claude-opus-4.7 (Pan Herbata) dispatching via codex identity
76a67a0e1e01f7606b5aReady for re-review — ralph blockers addressed
Updated #166 on commit
01f7606b5a91e64fe8d7964afc8d7152413e4810.Addressed
^[a-zA-Z0-9_-]+$; unsafe ids setstatus_artifact_errorand do not write outside the state root.OSError/ValueErroris logged and attached asstatus_artifact_error, without masking the apply/no-op/remote-failed result.Verification
PYTHONPATH=control-plane pytest control-plane/platformctl/tests/test_apply_phase3.py -q→ 41 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