← Back to Pull requests

Add ResourceMetadata.annotations and opt-in control-plane lifecycle hooks #10

Closed
unknown closed this pull request without merging on Nov 23, 2026 01:51 UTC
View on GitHub
unknown unknown commented on Nov 14, 2026 06:41 UTC
Author

Combines the two stacked upstream pull requests onto strata-main (11 commits total on top of cf5768a0):

1. Decorative ResourceMetadata.annotations (Upstream-PR: agent-substrate/substrate PR 3655, commits 1-5)


  • 2d95dae5 (ateapi: add annotations to ResourceMetadata): Add map<string, string> annotations to ResourceMetadata for non-queryable decorative metadata on Actor and ActorTemplate.

  • 53b5a913 (apivalidation: validate ResourceMetadata.annotations): Validate annotation keys as k8s-label-key while rejecting reserved ate.dev domains, cap entries at 16, and bound total key and value size at 4 KiB.

  • 0983c7b5 (controlapi: apply metadata.annotations on UpdateActor): Copy incoming metadata.annotations onto stored metadata during UpdateActor and add apivalidation, controlapi, and functionaltest coverage.

  • 3e223d18 (kubectl-ate: add --annotations flag to create and update actor): Add --annotations flag to kubectl-ate create actor and update actor (with --annotations="" clearing annotations on update).

  • bfc81e33 (controlapi: add BenchmarkActorAnnotations for metadata.annotations): Add BenchmarkActorAnnotations covering protobuf serialization, update validation, PostgreSQL CRUD, and cold ResumeActor/SuspendActor across inline and TOASTed payloads.
  • 2. Opt-In Control-Plane Lifecycle Hooks (Upstream-PR: agent-substrate/substrate PR 3853, commits 6-11)


  • 2b0268a3 (atepg: keep a caller-assigned uid and create_time on create): Preserve caller-assigned metadata.uid and metadata.create_time in setCreateMetadata when pre-assigned by the control plane before insert.

  • 9737d869 (hook: add LifecycleHook v1 wire contract): Define substrate.hook.v1.LifecycleHook (api/hook/v1/hook.proto) with OnCreateActor and OnDeleteActor.

  • 747ad5df (lifecyclehook: add hook config schema and TLS credentials): Parse --lifecycle-hooks-config (maxWaitDuration default 100ms, max 250ms; up to 8 hook targets with disjoint non-reserved allowedAnnotationPrefixes) and dial targets over TLS 1.3 (caBundle or caCertFile + serverName, with MTLS or TLSOnly).

  • fde592aa (lifecyclehook: add HookDispatcher): Parallel OnCreateActor fan-out under maxWaitDuration, veto-only admission (allowed: false), prefix and qualified-name validation on returned annotations, and unified CreateOutcome.Rollback sending compensating OnDeleteActor calls to hooks that allowed or timed out.

  • 230bd361 (ateapi: run lifecycle hooks on CreateActor and DeleteActor behind a preview gate): Wire Hooks into CreateActor and DeleteActor behind --preview=LifecycleHooks and --lifecycle-hooks-config with non-blocking per-actor lease serialization and single-defer rollback.

  • 36f640cc (controlapi/functionaltest: add end-to-end mTLS lifecycle hooks test and benchmark): Add TestLifecycleHooksEndToEnd and BenchmarkCreateActorLifecycleHooks in cmd/ateapi/internal/controlapi/functionaltest/lifecycle_hooks_test.go.
  • AI use: AI-assisted, I reviewed and tested it.

  • Tests pass

  • Docs updated
  • Diff: 396 lines (+297 / -99) across 4 files Reviewer: bexxmodd Review duration: 12669m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 396 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.358
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #10"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.2% (MEDIUM) · Higher = larger blast radius
    43.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.1% · Safe to merge
    17.1%