fix(platformctl): emit approval failure reasons #659
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!659
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "codex/191-approval-failure-reasons"
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 - platformctl apply approval hardening; run canary manually before merge if branch policy requires it.
Canary Context Pack
Product story
CI/audit consumers should be able to distinguish why an apply approval failed without scraping human text or exposing Forgejo response bodies.
What changed
Added stable enum-like approval failure reasons to
ApprovalCheck, mapped common failure paths, and surfacedapproval_reasonin failedplatformctl applyJSON results.Why it changed
Issue #191 / ERROR-CODE-01 asked for machine-readable approval failure reasons for missing token, network/API errors, SHA mismatch, unmerged PR, PR-not-found, and related approval failures.
Files touched
control-plane/platformctl/apply.pycontrol-plane/platformctl/tests/test_apply_phase3.pyRelevant context
ApprovalChecknow carries an optionalreasonfield.detailremains redacted/safe and unchanged in spirit.Runtime evidence
No runtime commands were run. Validation:
Results: targeted 14 passed; broader 133 passed;
validate allexitCode 0.Known constraints
This PR does not change approval pass/fail decisions. It only attaches stable reason strings to existing failure decisions.
Explicit out-of-scope
Requested decision
Approve if the reason names are stable enough for CI/audit consumers.
Merge blockers
Spec sources read
control-plane/platformctl/apply.py- approval verification and apply failure JSON path.control-plane/platformctl/tests/test_apply_phase3.py- approval/apply regression tests.state/memory/task-run-schema.md- adjacent observability contract, checked to avoid inventing a parallel metric surface.Closes #191
Patchwarden PR sanity
advisory_findings65901209433d374e744fdda8cf7098f7bd5360783e6presentDeterministic findings
infosensitive-path-touchedSensitive path touched —control-plane/platformctl/apply.pycontrol-plane/platformctl/apply.pyModel reviewers
global-glm/glm-5.1:cloudStatus:
okVerdict:
NOT_OKmediumMisleading fallback reason when approval.reason is Nonecontrol-plane/platformctl/apply.py line 746:"approval_reason": approval.reason or APPROVAL_REASON_FORGEJO_API_ERROR— if a future failure path omits setting reason, or reason is None, this defaults to 'forgejo_api_error' which misclassiflowUnrecognized RuntimeError misclassified as Forgejo API errorcontrol-plane/platformctl/apply.py lines 191-192:_approval_reason_for_errorreturns APPROVAL_REASON_FORGEJO_API_ERROR as default fallback for any RuntimeError not matching known patterns, conflating 'unknown error' with 'known Forgejo APglobal-deepseek/deepseek-v4-pro:cloudStatus:
okVerdict:
OKmediumValueError misclassification as config_error may mislead automationcontrol-plane/platformctl/apply.py:_approval_reason_for_errormaps anyValueErrortoAPPROVAL_REASON_CONFIG_ERROR. Non-configValueErrorinstances (e.g., from_repo_api_pathparsing) will be labeled as config errors, which couldValueErrorcheck to specific config-related exception types or introduce a more generic reason for unexpectedValueErrorcases.lowFallback reason in apply_plan may hide missing reason assignmentscontrol-plane/platformctl/apply.py:apply_plansetsapproval_reasontoapproval.reason or APPROVAL_REASON_FORGEJO_API_ERROR. If a future code path returns anApprovalCheckwithreason=None, the output will incorrectly indicate a FApprovalCheckfailure paths set a reason, and consider logging a warning whenreasonisNoneduring apply result construction.redteam/kimi-k2.6:clouderror-Policy notes
PLATFORMCTL_PR_SANITY_REDTEAM_MODELis configured.