feat(policy-engine): honor the manifest approval.timeout_seconds in HostSession #4045
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.46) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 477 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.369
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4045"
general
weight: 0.35
david-long1
HostSessionbounded its synchronous approval wait with a fixedDEFAULT_APPROVAL_TIMEOUT_SECONDS(300 s) unless the caller passedapproval_timeout_seconds, and its docstring noted that the manifest'sapproval.timeout_seconds(SPECIFICATION section 24,spec/schema/approval.schema.json: integer seconds) could not be read because nothing surfaced theapprovalsection across the native boundary. A host that declaredtimeout_seconds: 120in its manifest therefore still waited 300 s before failing closed withhost_error:approval_unresolved.HostSessiononly ever sees an already-built control, and the SDK holds the manifest text only forfrom_native;from_pathresolvesextendsparents, andfrom_url/from_manifest_chainnever hand the merged text back to Python, so re-parsing on the Python side with the publicparse_manifestwould miss an inherited or chainedapprovalblock.This follows the existing
policy_labelspattern instead:NativeRuntimenow keeps the merged manifest'sapprovalsection (serialised from the crate's typedApprovalSection,Nonewhen undeclared) and exposes it asapproval_config();NativeRuntimeClient.approval_config()mirrors it best-effort (empty mapping when the extension or accessor is missing, likepolicy_labels);AgentControl.approval_configis a read-only mapping populated at construction for every native-backed constructor; andHostSessionreadstimeout_secondsfrom it when the caller passes noapproval_timeout_seconds. The explicit argument still wins, a custom control withoutapproval_configor with a non-integer value keeps the 300 s default, andon_timeoutis left for a follow-up becauseHostSessiondoes not implement thesuspendoutcome yet. The README's escalation section documents the new accessor.Testing
Unit tests added:
policy-engine/sdk/python/tests/test_host.pycovers the manifest value replacing the default, the explicit argument winning over the manifest, unusable values ({}, notimeout_seconds, string, bool, negative, non-mapping) keeping the default, and a hung resolver being cut off by the manifest bound.policy-engine/sdk/python/tests/test_native_runtime.pyadds a manifest fixture with anapprovalblock (timeout_seconds: 120) and checksAgentControl.from_native(...).approval_configand the resultingHostSessiontimeout end to end through the real parser, plus the no-approvalcase.The Rust change means
_nativemust be rebuilt (maturin build/maturin develop); against a stale extension the two native-gated tests fail because the accessor is absent.The 6 failures are the pre-existing
tests/test_validation.pycases that need anopabinary onPATH;origin/maingives6 failed, 248 passed, 34 skippedin the same environment (Python 3.12, pytest 9.1.1).