feat(platformctl): execute approved compose apply #165
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!165
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "codex/issues/142-apply-compose-execution"
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
Once approval and plan provenance are locked, Phase 3 needs the smallest real runtime mutation primitive: re-apply one declared docker-compose service through the platform-host-agent lane.
What changed
platformctl applycan rundocker compose -f <compose_file> up -d <service>throughTailscaleTransportwhen Phase 05 gate is enabled.Why it changed
PR #160 mixed this runtime capability with approval, provenance, artifacts, and workflow changes. This PR isolates only the compose execution primitive.
Files touched
control-plane/platformctl/apply.pycontrol-plane/platformctl/tests/test_apply_phase3.pyRelevant context
Stacked after approval-binding, plan-provenance, and no-op splits.
modules/honcho-redis/module.yamlwas read to verify current compose metadata shape.Runtime evidence
No live runtime mutation. Tests use fake transport and assert the exact rs2000 command target.
Known constraints
Requires existing
platform-host-agentSSH transport andPLATFORMCTL_PHASE=05for real apply. Does not change remote compose files.Explicit out-of-scope
Durable status artifact and Forgejo Actions wiring are later split PRs.
Requested decision
Approve the minimal compose execution primitive.
Merge blockers
Any root SSH path, arbitrary command path, secret leakage in remote output, or unbound plan apply.
Spec sources read
AGENTS.md— security-sensitive lane and production mutation gate.control-plane/platformctl/apply.py— runtime execution code.control-plane/platformctl/transport/tailscale.py— transport contract.control-plane/platformctl/safety.py— command/path safety behavior.modules/honcho-redis/module.yaml— compose metadata example.control-plane/platformctl/tests/test_apply_phase3.py— tests.Refs #142
Supersedes part of #160
Ralph review (5-iter chmurowy) — ITERATE_BLOCKER 4/9 ⚠️ PRODUCTION TOUCH
To jest PR który faktycznie odpala
docker compose up -dna RS 2000. Najgorsze correctness w całym Phase 3 batch (2/9). Cztery confirmed-exploitable issues.Per-dim scoring
Evidence:
~/Iskra-i-Piotr/05 System/Swarmheart Backups/ralph-phase3-apply/165/.BLOCKER 1 — Fix success exit code
WHAT:
apply.pylinia 444:return result, EXIT_NO_CHANGESafter successfuldocker compose up -d. Butresult["exitCode"]jest teżEXIT_NO_CHANGES(= 0). To znaczy: successful apply emits same exit as no-op.WHY: Caller (CI, audit, monitoring) can't distinguish:
EXIT_APPLIEDEXIT_NO_CHANGESWrong exit code = wrong audit signal = false sense of consistency.
HOW (drafted patch w
plan.py+apply.py):VERIFY (add to
tests/test_apply_phase3.py):BLOCKER 2 — Reject multi-module plans
WHAT:
apply.pylinia 400:manifest = _load_manifest_for_plan(plan, modules_dir=modules_dir)._load_manifest_for_plan(linia 243) extractsplan.get("module")— single string. Loads ONE manifest, builds ONE command, runs ONCE. Plan withchangesreferencing multiple modules silently applies only first.WHY: Plan może mieć:
Current code: applies honcho-api compose service, silently ignores honcho-deriver change. Failed update goes unnoticed. Critical security risk if multi-module plan contains both update AND security patch.
HOW (drafted patch w
apply.py— przed call do_load_manifest_for_plan):Insert validation przed linia 399:
Alternatywa (cleaner): enforce w plan generation —
make_planzawsze emituje changes pod tym samymmodule. Wtedy apply może trust. Ale jako safety net w apply, hard reject jest defense-in-depth.VERIFY:
BLOCKER 3 — Align path validation with executed command
WHAT:
apply.pylinia 265-269:Validation runs przeciwko
remote_compose_file, ale command sendscompose_file(raw string from manifest).check_targetvalidates path the shell never receives.WHY: Dead variable check. If
compose_fileis absolute path (e.g.,/etc/sudoers.d/x), validation runs on/opt/vps-home-platform-infra/etc/sudoers.d/x(joined) but command runsdocker compose -f /etc/sudoers.d/x(absolute escapescd). Sacred path enforcement bypassed.HOW (drafted patch w
apply.pylinie 251-270):Two safety improvements:
compose_file(closescd /opt && docker compose -f /etc/...escape)remote_compose_file(not rawcompose_file) do docker composeVERIFY:
BLOCKER 4 — State persistence + rollback stubs
WHAT: Commit message + body claim "state update + rollback" jako część scope. Old TODO (line ~340 in #164 source:
update .platform/state/modules/<id>.status.json with new last_apply_sha) został usunięty z PR-a #164/#165, ale implementacja nigdy nie pojawiła się.WHY: Successful apply does NOT persist
last_apply_sha. Next apply has no way to know last good state. Failed apply has no rollback path. This violates PLATFORM_CONSTITUTION promise that state is durable.HOW (drafted patch w
apply.pyafter successful apply, beforereturn result, EXIT_APPLIED):VERIFY:
Follow-up issues
HOST-ALLOWLIST-01— Validate manifest.host against Tailscale node setREDACT-COMMAND-01— Redact command field w result dictREDACT-EXTEND-01— Extend_redact_remote_outputpatternsSMOKE-POST-APPLY-01— Post-apply container health smoke testTRANSPORT-TIMEOUT-01— Transport command timeoutAction items
apply.py+plan.py+ testscodex/issues/142-apply-compose-execution— ralph batch 2026-05-10, claude-opus-4.7 (Pan Herbata) dispatching via codex identity
ffda4bd732d404d5af73Codex iteration — ralph BLOCKERs addressed
Updated branch
codex/issues/142-apply-compose-executionatd404d5a, rebased on updated #164.Applied:
EXIT_APPLIED = 9, notEXIT_NO_CHANGES.compose_filemust be relative; command uses the same validated absolute path checked by sacred-path guard.Verification:
PYTHONPATH=control-plane pytest control-plane/platformctl/tests/test_apply_phase3.py -q→ 29 passed../tests/run-verify.shstill has the same pre-existingorigin/mainprompt debt noted on #162; not part of this PR.Filed follow-up issues:
Ready for re-review / operator review. This remains production-touching and should stay Full tier / operator merge only.