Skip to content

fix(tasks): terminalize runs when sandbox relay closes - #80330

Merged
trunk-io[bot] merged 5 commits into
masterfrom
posthog-code/terminalize-closed-sandbox-relay
Aug 10, 2026
Merged

fix(tasks): terminalize runs when sandbox relay closes#80330
trunk-io[bot] merged 5 commits into
masterfrom
posthog-code/terminalize-closed-sandbox-relay

Conversation

@tatoalo

@tatoalo tatoalo commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Problem

A closed sandbox relay must update the run lifecycle before another message is routed to the unavailable agent server. Regression found from #74038

Changes

  • Return whether the relay ended because the sandbox became unavailable.
  • Mark the workflow's sandbox as gone after unexpected stream closure, permanent HTTP errors, or exhausted reconnects.
  • Keep terminal agent events classified as normal completion.

Generated-By: PostHog Code
Task-Id: 69d90c03-1afe-414c-af6e-1fce5a051612
@trunk-io

trunk-io Bot commented Aug 10, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

Generated-By: PostHog Code
Task-Id: 69d90c03-1afe-414c-af6e-1fce5a051612
@tatoalo tatoalo added the reviewhog ($$$) Reviews pull requests before humans do label Aug 10, 2026
@PostHog PostHog deleted a comment from github-actions Bot Aug 10, 2026
@posthog

posthog Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦔 ReviewHog reviewed this pull request

Found 0 must fix, 1 should fix, 1 consider.

Published 2 findings (view the review).

@tatoalo
tatoalo marked this pull request as ready for review August 10, 2026 09:27
@tatoalo
tatoalo requested review from a team and VojtechBartos August 10, 2026 09:27
@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
products/tasks/backend/temporal/process_task/activities/tests/test_relay_sandbox_events.py:654-669
**Incomplete reconnect-flow coverage**

The new clean-close test exercises only one reconnect before success, leaving the reconnect counter, backoff sequence, and sandbox-gone result at budget exhaustion unprotected against regressions. Cover multiple consecutive clean closures through the exhaustion branch as required for new retry logic.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(tasks): reconnect clean sandbox stre..." | Re-trigger Greptile

@trunk-io

trunk-io Bot commented Aug 10, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

Generated-By: PostHog Code
Task-Id: 69d90c03-1afe-414c-af6e-1fce5a051612
@posthog

posthog Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

ReviewHog Alpha 🦔 If you find any issues helpful - please reply "valid", "invalid", etc., for evaluation purposes 🙏

@posthog posthog Bot 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.

ReviewHog Report

Changes

Issues: 2 issues

Files (2)
  • products/tasks/backend/temporal/process_task/activities/relay_sandbox_events.py
  • products/tasks/backend/temporal/process_task/workflow.py

Comment thread products/tasks/backend/temporal/process_task/activities/relay_sandbox_events.py Outdated
Generated-By: PostHog Code
Task-Id: 69d90c03-1afe-414c-af6e-1fce5a051612
Generated-By: PostHog Code
Task-Id: 69d90c03-1afe-414c-af6e-1fce5a051612
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Backend coverage — 4.0% of changed backend lines covered — 80 uncovered

🧪 Backend test coverage

Patch coverage — changed backend lines (products + core): █░░░░░░░░░░░░░░░░░░░ 4.0% (4 / 84)

File Patch Uncovered changed lines
products/tasks/backend/temporal/execute_sandbox/workflow.py 0.0% 1387, 1418–1419
products/tasks/backend/temporal/process_task/workflow.py 0.0% 1954, 1977–1978, 1982
products/tasks/backend/temporal/process_task/activities/tests/test_relay_sandbox_events.py 0.0% 376–379, 381, 385–386, 450, 460, 499, 509, 651, 674, 679–681, 686, 695, 704–707, 711, 714, 719–720, 722–723, 725–726, 728–729, 731–733, 735, 737–738, 740–741, 743–745, 747, 756–761, 909, 911, 923
products/tasks/backend/temporal/process_task/activities/relay_sandbox_events.py 16.7% 101, 107, 172, 202, 493, 497–501, 506–507, 532–533, 564, 569, 580–583

🤖 Agents: add a test covering the lines above, or note why under "How did you test this code?". Machine-readable gap list: the patch-coverage artifact on this run (gh run download 31377512440 -n patch-coverage), or the coverage-data block at the end of this comment.

Per-product line coverage (touched products)
Product Coverage Lines
demo ███████████░░░░░░░░░ 56.3% 1,497 / 2,661
tasks ██████████████░░░░░░ 70.3% 35,576 / 50,625
signals █████████████████░░░ 82.6% 27,320 / 33,075
cdp █████████████████░░░ 84.2% 3,914 / 4,649
notebooks █████████████████░░░ 86.4% 8,029 / 9,296
data_modeling █████████████████░░░ 86.5% 8,459 / 9,782
actions █████████████████░░░ 86.6% 717 / 828
cohorts ██████████████████░░ 87.6% 6,482 / 7,400
managed_warehouse ██████████████████░░ 87.8% 5,928 / 6,752
product_tours ██████████████████░░ 87.9% 1,303 / 1,482
data_warehouse ██████████████████░░ 88.4% 11,653 / 13,185
exports ██████████████████░░ 89.1% 7,490 / 8,406
engineering_analytics ██████████████████░░ 89.3% 6,759 / 7,570
dashboards ██████████████████░░ 89.4% 6,001 / 6,710
alerts ██████████████████░░ 90.3% 4,482 / 4,966
mcp_analytics ██████████████████░░ 90.4% 3,968 / 4,388
conversations ██████████████████░░ 90.5% 18,337 / 20,256
canvas ██████████████████░░ 90.6% 2,080 / 2,296
streamlit_apps ██████████████████░░ 90.7% 2,630 / 2,901
error_tracking ██████████████████░░ 91.1% 11,147 / 12,237
stamphog ██████████████████░░ 91.3% 4,505 / 4,936
slack_app ██████████████████░░ 91.7% 10,813 / 11,789
ai_observability ███████████████████░ 92.9% 17,116 / 18,426
early_access_features ███████████████████░ 92.9% 1,347 / 1,450
web_analytics ███████████████████░ 93.1% 15,963 / 17,154
marketing_analytics ███████████████████░ 93.1% 15,445 / 16,591
surveys ███████████████████░ 93.2% 5,919 / 6,349
posthog_ai ███████████████████░ 93.3% 1,327 / 1,423
reminders ███████████████████░ 93.4% 468 / 501
approvals ███████████████████░ 93.5% 3,491 / 3,734
product_analytics ███████████████████░ 93.5% 7,095 / 7,587
workflows ███████████████████░ 94.3% 7,951 / 8,436
endpoints ███████████████████░ 94.3% 8,771 / 9,306
review_hog ███████████████████░ 94.6% 8,246 / 8,715
skills ███████████████████░ 94.8% 3,496 / 3,687
logs ███████████████████░ 95.6% 11,815 / 12,362
replay_vision ███████████████████░ 95.7% 18,220 / 19,043
experiments ███████████████████░ 95.8% 28,701 / 29,962
annotations ███████████████████░ 96.2% 732 / 761
revenue_analytics ███████████████████░ 96.3% 1,887 / 1,960
data_quality ███████████████████░ 96.4% 747 / 775
feature_flags ███████████████████░ 96.4% 17,770 / 18,429
user_interviews ███████████████████░ 96.5% 2,638 / 2,734
customer_analytics ███████████████████░ 96.6% 11,420 / 11,816
warehouse_sources ███████████████████░ 97.5% 380,922 / 390,776
data_catalog ████████████████████ 97.9% 2,677 / 2,734
pulse ████████████████████ 98.4% 2,017 / 2,049

Report-only. Patch coverage = changed backend lines covered vs origin/master. Sorted lowest first.
Known gaps: lines covered only by Temporal tests show as uncovered; core line numbers may drift if master changed the same file.

@tatoalo
tatoalo enabled auto-merge (squash) August 10, 2026 11:28
@trunk-io
trunk-io Bot merged commit 4258dc5 into master Aug 10, 2026
341 of 345 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/terminalize-closed-sandbox-relay branch August 10, 2026 11:34
@deployment-status-posthog

deployment-status-posthog Bot commented Aug 10, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-10 12:09 UTC Run
prod-us ✅ Deployed 2026-08-10 12:22 UTC Run
prod-eu ✅ Deployed 2026-08-10 12:24 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/desktop Feature Tag: Desktop reviewhog ($$$) Reviews pull requests before humans do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants