Skip to content

fix(tasks): recover resumes from missing branches - #75503

Merged
tatoalo merged 3 commits into
masterfrom
posthog-code/resume-missing-branch-fallback
Jul 31, 2026
Merged

fix(tasks): recover resumes from missing branches#75503
tatoalo merged 3 commits into
masterfrom
posthog-code/resume-missing-branch-fallback

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Problem

A cloud task resume can carry a branch that is unavailable in the task repository. Provisioning currently treats that as a terminal clone failure, so the agent never boots even though its resume history and git checkpoint remain usable.

Why: Resume should remain available when branch metadata is stale or came from secondary repository work. This complements the metadata ownership fix in PostHog/code#4003.

Changes

When Git explicitly reports that a resume branch is missing, retry the clone from the repository default branch. Other clone failures remain terminal. Once booted, the agent can apply its stored git checkpoint as usual

When a saved resume branch no longer exists in the task repository, clone its default branch instead. This lets the agent boot and restore the saved git checkpoint while keeping unrelated clone failures terminal.

Generated-By: PostHog Code
Task-Id: 3721ab47-bf20-4d0a-b474-8a622badccd2
@tatoalo tatoalo self-assigned this Jul 30, 2026
@trunk-io

trunk-io Bot commented Jul 30, 2026

Copy link
Copy Markdown

😎 Merged manually by @tatoalo - details.

@PostHog PostHog deleted a comment from github-actions Bot Jul 30, 2026
@tatoalo
tatoalo marked this pull request as ready for review July 30, 2026 16:55
@tatoalo
tatoalo requested a review from a team July 30, 2026 16:55
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(tasks): recover resumes from missing..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Backend coverage — 12.0% of changed backend lines covered — 14 uncovered

🧪 Backend test coverage

Patch coverage — changed backend lines (products + core): ██░░░░░░░░░░░░░░░░░░ 12.0% (2 / 16)

File Patch Uncovered changed lines
products/tasks/backend/temporal/process_task/activities/tests/test_provision_sandbox.py 0.0% 57–58, 70–71, 82, 84, 95
products/tasks/backend/temporal/process_task/activities/provision_sandbox.py 22.2% 692–693, 698, 712–713, 715–716

🤖 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 30621681454 -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.1% 32,778 / 46,780
signals ████████████████░░░░ 81.2% 24,750 / 30,477
cdp ████████████████░░░░ 82.1% 3,285 / 3,999
data_modeling █████████████████░░░ 85.6% 7,668 / 8,959
notebooks █████████████████░░░ 86.0% 7,794 / 9,060
actions █████████████████░░░ 86.6% 717 / 828
cohorts ██████████████████░░ 87.8% 6,181 / 7,040
product_tours ██████████████████░░ 87.9% 1,303 / 1,482
exports ██████████████████░░ 88.2% 7,046 / 7,986
data_warehouse ██████████████████░░ 88.4% 12,192 / 13,798
engineering_analytics ██████████████████░░ 89.3% 6,529 / 7,309
conversations ██████████████████░░ 89.3% 17,600 / 19,701
dashboards ██████████████████░░ 89.4% 5,983 / 6,693
alerts ██████████████████░░ 90.2% 4,458 / 4,942
streamlit_apps ██████████████████░░ 90.7% 2,630 / 2,901
mcp_analytics ██████████████████░░ 90.9% 3,191 / 3,511
error_tracking ██████████████████░░ 91.0% 10,926 / 12,008
slack_app ██████████████████░░ 91.1% 9,664 / 10,610
marketing_analytics ██████████████████░░ 91.2% 12,092 / 13,265
stamphog ██████████████████░░ 91.3% 4,505 / 4,936
product_analytics ███████████████████░ 92.5% 5,849 / 6,321
early_access_features ███████████████████░ 92.6% 1,287 / 1,390
ai_observability ███████████████████░ 92.8% 15,618 / 16,821
surveys ███████████████████░ 93.1% 5,771 / 6,197
posthog_ai ███████████████████░ 93.2% 1,326 / 1,422
web_analytics ███████████████████░ 93.3% 14,911 / 15,976
approvals ███████████████████░ 93.3% 3,437 / 3,682
reminders ███████████████████░ 93.4% 468 / 501
workflows ███████████████████░ 94.0% 7,219 / 7,679
endpoints ███████████████████░ 94.2% 8,655 / 9,192
review_hog ███████████████████░ 94.6% 8,101 / 8,563
skills ███████████████████░ 94.6% 3,158 / 3,337
experiments ███████████████████░ 95.4% 25,938 / 27,177
logs ███████████████████░ 95.5% 10,440 / 10,937
annotations ███████████████████░ 96.2% 732 / 761
revenue_analytics ███████████████████░ 96.3% 1,887 / 1,960
feature_flags ███████████████████░ 96.4% 17,488 / 18,144
replay_vision ███████████████████░ 96.4% 16,081 / 16,679
user_interviews ███████████████████░ 96.5% 2,638 / 2,734
customer_analytics ███████████████████░ 97.1% 10,444 / 10,758
warehouse_sources ███████████████████░ 97.3% 359,119 / 369,166
data_catalog ████████████████████ 97.7% 2,588 / 2,648
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 added the stamphog Request AI approval (no full review) label Jul 31, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Contained fix to cloud task sandbox provisioning that retries the clone against the default branch when a resume's saved branch is missing, with a matching regression test; author is on the owning team and no risky-territory surface (auth, billing, data model, API contract, CI/deploy, deps) is touched.

  • Author wrote 0% of the modified lines and has 82 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 27L, 1F substantive, 81L/2F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1b-small (81L, 2F, single-area, fix)
stamphog 2.0.0b3 .stamphog/policy.yml @ def52de · reviewed head 9c76e09

@tatoalo
tatoalo merged commit 7253da4 into master Jul 31, 2026
233 checks passed
@tatoalo
tatoalo deleted the posthog-code/resume-missing-branch-fallback branch July 31, 2026 12:17
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-31 12:43 UTC Run
prod-us ✅ Deployed 2026-07-31 13:07 UTC Run
prod-eu ✅ Deployed 2026-07-31 13:09 UTC Run

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

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants