← Back to Pull requests

docs(delegation): describe the terminal background lifetime honestly instead of promising restart durability #136143

Open
unknown opened this pull request with 550 lines diff across 6 files
View on GitHub
unknown unknown commented on Oct 10, 2026 13:42 UTC
Author

What does this PR do?

The "Lifetime and Durability" section of the delegation guide listed terminal(background=True, notify_on_complete=True) under "durable execution that must survive session closure or process restart". That promise contradicts the actual lifecycle:

  • A graceful gateway shutdown calls process_registry.kill_all(source="gateway_shutdown") (gateway/run_shutdown.py), and gateway_shutdown is not in _LIFECYCLE_KILL_SOURCES (tools/process_registry.py), so every tracked process is killed — even persist_on_release=True sessions that survive session close.

  • After a crash, checkpoint recovery may re-adopt a surviving PID, but only as a detached session: "can't read output, but can report status + kill" (tools/process_registry_checkpoint.py), i.e. stdout cannot be reconnected.
  • The docs now keep cronjob as the single durable-execution option and describe honestly what the terminal background path survives: past the turn that started it always; session close/reset, compression and error recovery only with persist_on_release=True; never a gateway shutdown. Code is unchanged — this is a documentation-only correction aligning the guide with the implementation.

    Related Issue

    Fixes #136133

    Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

  • ✨ New feature (non-breaking change that adds functionality)

  • 🔒 Security fix (undisclosed vulnerabilities in SECURITY.md §3.1 scope go to Security Advisories first, not a public PR)

  • 📝 Documentation update

  • ✅ Tests (adding or improving test coverage)

  • ♻️ Refactor (no behavior change)

  • 🎯 New skill (bundled or hub)
  • Changes Made

  • website/docs/user-guide/features/delegation.md — removed terminal(background=True, notify_on_complete=True) from the "durable execution" list and replaced it with a paragraph stating its real lifetime (turn end always; owner close/compression/error recovery only with persist_on_release=True; graceful gateway shutdown kills every tracked process; crash adoption is detached with no stdout) and pointing restart-proof work at cronjob.
  • How to Test

    1. Read the rendered "Lifetime and Durability" section (website/docs/user-guide/features/delegation.md) — ::: container pairing is intact (4 opens / 4 closes) and the section renders as before with the corrected wording.
    2. Cross-check each claim against code on main: gateway/run_shutdown.py (kill_all with source="gateway_shutdown"), tools/process_registry.py _LIFECYCLE_KILL_SOURCES (no gateway_shutdown member), tools/terminal_tool.py persist_on_release semantics, tools/process_registry_checkpoint.py detached recovery.
    3. Observed result: python scripts/check passes — "11 checks, ok" (docs-only diff; no Python path touched).

    Checklist

    Code

  • I've read the Contributing Guide

  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)

  • I searched for existing PRs to make sure this isn't a duplicate

  • My PR contains only changes related to this fix/feature (no unrelated commits)

  • I've run pytest tests/ -q and all tests pass — N/A: documentation-only change, no code path affected

  • python scripts/check passes (the blocking lint and code-health checks CI runs)

  • I've added tests for my changes (required for bug fixes, strongly encouraged for features) — N/A: documentation-only change

  • I've tested on my platform: macOS 26 (darwin 25.4, arm64)
  • Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A

  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A

  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A

  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A

  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A
  • Diff: 550 lines (+412 / -138) across 6 files Reviewer: PRATHAMESH75 Review duration: 78414m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.55) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.55 · 550 lines diff across 6 files
    0.55
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    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.378
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #136143"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% 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: 55.1% (MEDIUM) · Higher = larger blast radius
    55.1%
    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: 44.7% · Lower = rushed or shallow review
    44.7%
    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: 30.5% · Safe to merge
    30.5%