Skip to content

fix(agents): narrow broad exception handlers in deploy handoff and orchestrator - #2626

Draft
groupthinking wants to merge 3 commits into
mainfrom
fix/2168-narrow-except-deploy-agents
Draft

groupthinking wants to merge 3 commits into
mainfrom
fix/2168-narrow-except-deploy-agents

Conversation

@groupthinking

@groupthinking groupthinking commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Canonical issue

Closes #2665.

Refs #2168 (AUDIT-006). This is a partial slice; do not close the broad audit issue. The dedicated tracking issue scopes this fix; the broader audit remains open.

Result

Expected deployment CLI and shared-store setup failures are caught by type; unexpected failures reach explicit logged boundaries. Deployment responses preserve completed GitHub work when a later Vercel step fails, while reporting overall failure. A partial GitHub receipt cannot make a failed Vercel handoff successful.

  • Redact configured credentials in both expected CLI stderr/stdout failures and repr-escaped subprocess tracebacks.
  • Validate malformed database URL ports separately; unrelated store-construction ValueErrors still propagate.
  • Clear ambient database configuration before test imports and for each test.
  • Inspect AST exception handlers, including tuple, multiline, bare and except* syntax, rather than counting matching lines.
  • Integrate current main 512a2558f73d6281b6a880548bedf140b7e30292 without discarding either implementation.
  • Disable automatic Vercel deployment for this exact review branch in root and app git.deploymentEnabled configuration.

Verification — November 12, 2026

Published head: 541845423e4838fbf1d6cdd903a4db7f8bf7ba3e. GitHub tree a6ce695b331d443a8285fc5b00f6fc0378a69e91 exactly matches the local tested tree. Branch ref readback verified publication.

Python 3.12.14; pytest 9.2.0; pytest-asyncio 1.5.0. No network, deployment, live database or model calls in the tests.

env -u DATABASE_URL -u EVENTRELAY_SHARED_STATE_DATABASE_URL PYTHONPATH=src python -m pytest tests/unit/test_exception_boundaries_2168.py tests/unit/test_agent_orchestrator.py tests/unit/test_deployment_handoff_failures.py tests/unit/test_antigravity_orchestration.py tests/unit/test_antigravity_backend.py tests/unit/test_one_click_deploy_precheck.py -o addopts='' -o log_cli=false -q

138 passed, exit 0 after main integration. One pre-existing unawaited-AsyncMock warning remains. Added regressions failed before their corresponding fixes: five initial cases for escaped credentials, partial receipts and malformed URL; five of six additional expected-CLI redaction cases. Whitespace checks pass; Ruff retains pre-existing Optional annotation findings, with no new import findings. Independent review identified the expected-CLI leak and the resulting correction is included.

Remaining gates

Keep draft and unmerged. New-head hosted CI and security results must be checked; prior-head green results do not cover this commit. No production or preview deployment is requested. The closing-keyword gate is not waived or weakened. Production deployment and full audit completion remain outside this slice.

Copilot AI max review requested due to automatic review settings November 9, 2026 06:27
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-uvai Ready Ready Preview, v0 Nov 9, 2026 6:28am UTC

@linear-code
linear-code Bot marked this pull request as ready for review November 9, 2026 06:27
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added documentation Improvements or additions to documentation python labels Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Repository reconciliation: this PR does not reference exactly one canonical issue.

Please add a Closes #<issue> reference in the PR description so it can be tracked against the delivery plan.

See governance: #898

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical defects can expose deployment tokens in timeout logs, abort imports on malformed database URLs, and allow tests to read or write a real database.

5 open issues
What changed in this PR

This PR delivers the first slice of issue #2168’s exception-handling audit in UVAI’s internal agent runtime, focusing on deployment handoff and orchestration rather than repository-wide remediation.

Changes:

  • Narrow deployment-step and shared SQL setup handlers to expected exception types.
  • Add contextual exception logging, token redaction, and explicit boundary markers.
  • Add simulated-failure tests and document handling standards and remaining work.
File Description
tests/​unit/​test_exception_boundaries_2168.py Tests failure reporting, exception propagation, redaction, and boundary markers.
src/​youtube_extension/​services/​agents/​adapters/​agent_orchestrator.py Narrows shared-store setup handling and adds contextual boundary logs.
src/​agents/​mcp_tools/​deployment_tool.py Narrows step handlers and adds identity errors and redacted failure reporting.
docs/​EXCEPTION_HANDLING_STANDARDS.md Defines boundary markers and records this remediation slice and remaining scope.

Review effort: Max

Comment thread src/agents/mcp_tools/deployment_tool.py Resolved
Comment thread src/agents/mcp_tools/deployment_tool.py Resolved
Preserve partial deployment receipts; redact expected CLI failures and repr-escaped secrets; validate malformed URL ports without swallowing store bugs; isolate DB environment in tests; count broad handlers with AST. Disable previews for this exact review branch.

Refs #2168
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🔍 PR Validation

⚠️ Large PR detected (619 lines changed)

A failed Vercel step cannot report overall success merely because GitHub creation succeeded. Preserve the completed GitHub artifact and return failed status so pipeline classification also fails.

Refs #2168

This branch was successfully deployed

1 active (outdated) deployment
Preview — bf04b55b Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve deployment failures and redact command error output

3 participants