← Back to Pull requests

fix(substrate): retain failed fork tag cause #274

Merged
Tatsinnit merged 11 files (117 lines) on Nov 16, 2026 02:16 UTC
View on GitHub
Tatsinnit Tatsinnit commented on Nov 15, 2026 23:48 UTC
Author

Summary

  • retain both the lifecycle refusal and original TagActor failure when a stateful Fork finds its parent gone or superseded

  • keep SNAPSHOT_SUPERSEDED ahead of a retained COMPUTE_BUSY cause in the public ErrorInfo reason

  • cover the optional PR #273 follow-ups: Resume approval-handoff cancellation and scoped interruption docs
  • Context

    runtime/substrate.Backend.Fork re-reads the parent after a failed tag so a deleted parent becomes MEMORY_STATE_LOST and a moved parent becomes SNAPSHOT_SUPERSEDED. That branch wrapped the lifecycle error but formatted the original tag failure with %v, dropping it from errors.Is/errors.As.

    The fix joins both causes with %w. Because a real TagActor failure may also wrap ErrActorBusy, the ErrorInfo selector keeps the fork lifecycle result authoritative: a superseded source still reports SNAPSHOT_SUPERSEDED, not COMPUTE_BUSY. The rendered error text and gRPC code remain unchanged.

    The first commit also resolves the two optional review notes left on #273 by adding the Resume variant and narrowing the ErrAdmissionInterrupted comments to the actual public boundaries.

    Closes #268.
    Follow-up to #273.

    Verification

  • go test ./runtime/substrate ./placement ./session

  • go test -race -shuffle=on ./runtime/substrate ./session

  • go test ./... -skip "^TestDocumentedPythonExecutorLogsStorageFailureWithoutPayload$"

  • go test ./... in integrations/substrate

  • go vet ./runtime/substrate ./session

  • go build ./...

  • go run ./hack/doccheck

  • go test ./hack/changelog

  • go run ./hack/changelog check -base upstream-agentsession/main -head HEAD -skip=false

  • git diff --check
  • The one excluded root test is environment-specific: macOS Python 3.9.6 reports SQLite error name unknown where the test requires SQLITE_ERROR; it reproduces on the unmodified base.

    Diff: 117 lines (+106 / -11) across 11 files Reviewer: gambtho Review duration: 147m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.46) × (1 − Review Confidence (0.59)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 117 lines diff across 11 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.23 · 1 substantive comment(s)
    0.23
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    58%
    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.285
    Shallow Review Depth shallow_review_depth
    0.268
    Real PR Conversation Timeline
    4 items
    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Nov 15, 2026 23:51 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟢 Approval recommended

    No active review issues remain for the fork error-handling and cancellation updates.

    No open issues 🎉

    <details>
    <summary><strong>What changed in this PR</strong></summary>

    This PR fixes stateful Substrate Fork error handling so Go callers retain the original TagActor failure alongside the parent lifecycle refusal, addressing #268. It also completes the optional cancellation follow-ups from #273.

    Changes:

  • Preserve both fork failure causes while keeping lifecycle status and public error text unchanged.

  • Prioritize SNAPSHOT_SUPERSEDED over a retained compute-busy cause, with regression coverage.

  • Add Resume approval-handoff cancellation coverage and clarify interruption documentation.
  • | File | Description |
    | ---- | ----------- |
    | spec.md | Document snapshot-superseded reason precedence. |
    | session/​service.go | Clarify caller-interruption scope in comments. |
    | session/​memory_state_lost_test.go | Test lifecycle reason precedence after a busy tag failure. |
    | session/​errors.go | Select snapshot supersession before compute contention. |
    | session/​error_reasons_test.go | Verify reason selection for joined causes. |
    | runtime/​substrate/​substrate.go | Wrap both lifecycle and tag failure causes. |
    | runtime/​substrate/​substrate_test.go | Verify cause retention and tag cleanup ordering. |
    | placement/​placement.go | Clarify documented interruption boundaries. |
    | placement/​approval_test.go | Cover canceled Resume approval-handoff snapshot failure. |
    | changelog/​unreleased/​substrate-fork-tag-cause.md | Record the fork error-chain fix. |
    | changelog/​unreleased/​error-reasons-compat.md | Clarify public Suspend compatibility wording. |
    </details>

    <sub>Review effort: Balanced</sub>

    gambtho gambtho approved these changes on Nov 16, 2026 01:45 UTC
    Approved Reviewer

    Approved these changes.

    aramase aramase approved these changes on Nov 16, 2026 02:10 UTC
    Approved Reviewer

    LGTM, thanks.

    Reviewers
    Assignees
    Tatsinnit Tatsinnit
    Labels
    risk: low confidence: 58.9% 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: 46.2% (MEDIUM) · Higher = larger blast radius
    46.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: 58.9% · Lower = rushed or shallow review
    58.9%
    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: 19.0% · Safe to merge
    19.0%