Skip to content

fix: cancel unbound goals before deleting sessions - #647

Merged
pedronauck merged 4 commits into
mainfrom
fix/issue-643-bulk-delete-goal-binding
Sep 15, 2026
Merged

pedronauck merged 4 commits into
mainfrom
fix/issue-643-bulk-delete-goal-binding

Conversation

@pedronauck

@pedronauck pedronauck commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

What & why

Closes #643. Goal cancellation uses the persisted session origin for its status projection when the checkpoint has no binding. Clear stays null, moved bindings remain authoritative, and catalog Goals emit no session projection. Stopped-session deletion preserves Goal audit and neighboring sessions.

Authored and integrated by Codex (GPT-6 Astra). No human verification is claimed.

Squash-merged as 6b081d46f1fdf65f297e332abd679f7a58774f1a. All five PRs (#645–#649) are integrated and verified on main.

How you verified it

Canonical SQLite/Manager integration and the existing bulk browser suite cover unbound cancellation, idempotency, mixed active/stopped selection and neighbor preservation. Partial-failure/retry belongs to the existing bulk hook suite. The missing-checker review finding is disproved by the tracked file and resolved; QA is verified on f3fbea7: real SQLite/Manager with race detection and bulk browser shard 3 passed. Codex inspected all three selection/confirmation/completion screenshots. Both review threads are resolved. This verifies the issue-specific automated slice, not a new full manual walk. CodeRabbit reviewed the Go changes without inline defects.

CI-only user override: no local make gate, builds, tests, typechecks or React Doctor runs. Local work is limited to source inspection, formatting and diff checks. Final integrated-main CI passed on e7e4a7e329499a56fa11b364ed453a1e9d5447f7: 26 successful jobs covering Go lint/build/race, frontend lint/types/tests/build, native Windows, real role/Goal integrations, and web/runtime/desktop E2E. PR-title validation is skipped on push; no applicable CI job failed or remained pending.

All available general, inline, outdated and collapsed first-review findings were collected. One consolidated remediation round is authorized; no second review or final-head reapproval is requested. Generic docstring quotas do not override the repository's requirement to comment non-obvious intent rather than repeat identifiers; no reviewer configuration or check is changed.

Final-head evidence: real SQLite/Manager cancellation and deletion and bulk browser screenshots. Codex inspected selection, confirmation and completion on the final main commit.

Impact

Existing session delete/stop and Goal surfaces keep IDs and DTOs. No migration, config, hook or SDK change. Session-owned-history and bulk-action QA scenarios plus impact audit are updated. Official skill remains accurate.

Cross-surface audit: docs/_memory/change-impact.md.


  • make gate passes locally; this PR is delivered only after its required CI checks are green — local execution waived by explicit CI-only user instruction.
  • New or changed behavior is covered by tests, or I explained above why not
  • If an agent wrote or co-wrote this, I named it above and verified the result myself — authorship is named; no human verification is claimed.

@vercel

vercel Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
compozy-site Ready Ready Preview Sep 15, 2026 1:12pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 3875c91.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • .github/workflows/ci.yml is excluded by !**/*.yml
  • docs/_memory/change-impact.md is excluded by !**/*.md

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: d337eef6-d53f-4d5f-9564-da153c423ca3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 157a4c7c-f721-458d-a8e0-98460c1a0201

📥 Commits

Reviewing files that changed from the base of the PR and between 25604aa and f3fbea7.

⛔ Files ignored due to path filters (5)
  • .github/workflows/ci.yml is excluded by !**/*.yml
  • docs/_memory/change-impact.md is excluded by !**/*.md
  • docs/qa/scenarios/ET-web-session-list-bulk-actions.md is excluded by !**/*.md
  • docs/qa/scenarios/RT-session-delete-owned-history.md is excluded by !**/*.md
  • web/e2e/__tests__/session-bulk-actions.spec.ts is excluded by !web/e2e/**
📒 Files selected for processing (2)
  • internal/daemon/loop_goal_managed_runtime_integration_test.go
  • internal/store/globaldb/global_db_goal_turn_runtime_integration_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 0 remain after this review.


Walkthrough

The change fixes empty session bindings during Goal cancellation. It adds integration coverage for idempotent cancellation and deletion of stopped sessions with retained Goal state.

Changes

Goal cancellation lifecycle

Layer / File(s) Summary
Goal projection binding
internal/store/globaldb/global_db_goal_prompt_revoke_control.go
enqueueRevokedGoalProjection now resolves the session origin before enqueueing. Non-clear projections use the checkpoint session ID or the origin session ID as the bound session.
Lifecycle integration coverage
internal/store/globaldb/global_db_goal_turn_runtime_integration_test.go, internal/daemon/loop_goal_managed_runtime_integration_test.go
Tests call RequestRunCancellation twice for session-origin and catalog-origin runs. They verify canceled runs, terminal checkpoints, projection counts, preserved fields, and stopped-session deletion with retained Goal state.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to f3fbe

The stopped-session cancellation path preserves the required projection and validation behavior, with no actionable current-head risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy the coding requirements in [#643]. enqueueRevokedGoalProjection resolves the canonical session origin and uses it when an unbound checkpoint has no session ID. It preserves nonem…
Out of Scope Changes check ✅ Passed The changes remain within [#643]. The production change fixes Goal cancellation projection ownership and binding resolution. The tests cover the affected cancellation, stopped-session deletion, and bu…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: canceling unbound Goal state before session deletion.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch fix/issue-643-bulk-delete-goal-binding
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-643-bulk-delete-goal-binding

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

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR fixes stopped-session deletion when a session-origin Goal has an unbound checkpoint. Cancellation now projects status against the persisted origin session while retaining moved bindings, clear tombstones, catalog behavior, Goal audit history, and unrelated sessions.

  • Uses the persisted session origin only as the fallback for an empty checkpoint binding.
  • Adds SQLite/Manager integration coverage for cancellation, idempotency, retained history, and neighboring-session preservation.
  • Extends bulk browser coverage to mixed active/stopped selections and retained neighbors.
  • Adds targeted CI execution, artifact collection, QA documentation, and the required cross-surface impact audit.

Confidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness, security, or repository-rule findings.

The persisted origin is used only for session-origin Goals whose checkpoint binding is empty, while moved bindings remain authoritative and catalog origins emit no projection. Integration coverage verifies cancellation idempotency, retained Goal history, successful stopped-session deletion, and preservation of neighboring sessions. Both previous threads were resolved: the QA evidence was accepted, and the missing-checker report was correctly withdrawn after confirming that the script is tracked.

Important Files Changed

Filename Overview
internal/store/globaldb/global_db_goal_prompt_revoke_control.go Loads the persisted Goal origin and uses it only as the fallback for an empty cancellation binding.
internal/store/globaldb/global_db_goal_turn_runtime_integration_test.go Covers unbound session origins, moved bindings, catalog origins, retained checkpoint state, and idempotent cancellation.
internal/daemon/loop_goal_managed_runtime_integration_test.go Verifies real Manager/SQLite deletion of a stopped Goal owner while retaining audit history and a neighboring session.
web/e2e/tests/session-bulk-actions.spec.ts Expands the bulk deletion journey to selected active and stopped sessions while proving an unselected neighbor remains.
.github/workflows/ci.yml Adds targeted race-enabled integration execution and persistent bulk-deletion browser evidence.
docs/_memory/change-impact.md Records compatibility, isolation, recovery, surface, documentation, and validation impacts for issue 643.
docs/qa/scenarios/ET-web-session-list-bulk-actions.md Documents the mixed-state bulk deletion regression and the boundaries of its automated evidence.
docs/qa/scenarios/RT-session-delete-owned-history.md Documents stopped-owner deletion with an unbound Goal checkpoint and retained audit history.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Delete stopped session] --> B[Cancel owned Goal run]
    B --> C{Run has session origin?}
    C -- No: catalog origin --> D[Cancel run without session projection]
    C -- Yes --> E{Checkpoint binding present?}
    E -- Yes --> F[Project canceled status to moved binding]
    E -- No --> G[Project canceled status to persisted origin]
    F --> H[Retain checkpoint and Goal audit history]
    G --> H
    D --> H
    H --> I[Delete origin session]
    I --> J[Preserve unrelated neighboring sessions]
Loading

Reviews (5): Last reviewed commit: "test: verify goal deletion with complete..." | Re-trigger Greptile

Comment thread docs/qa/scenarios/ET-web-session-list-bulk-actions.md
coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 15, 2026
Comment thread .github/workflows/ci.yml
coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 15, 2026
@pedronauck
pedronauck force-pushed the fix/issue-643-bulk-delete-goal-binding branch from f3fbea7 to 3875c91 Compare September 15, 2026 13:08
@pedronauck
pedronauck merged commit 6b081d4 into main Sep 15, 2026
14 of 15 checks passed
@pedronauck
pedronauck deleted the fix/issue-643-bulk-delete-goal-binding branch September 15, 2026 13:08
@pedronauck

Copy link
Copy Markdown
Member Author

Consolidated integration disposition

Squash merge: 6b081d46f1fdf65f297e332abd679f7a58774f1a. Integrated main: e7e4a7e329499a56fa11b364ed453a1e9d5447f7.

The missing-checker finding was a false positive: the referenced checker exists in the repository. The QA finding is addressed by real SQLite/Manager cancellation and deletion coverage plus browser bulk selection, confirmation and neighbor preservation. Both threads are resolved. Rebase changed only the placement of the impact record; range-diff preserved the four implementation commits. Cancellation uses persisted origin for projection only; clear remains null and moved bindings remain authoritative.

All pages of general/inline reviews and review threads, including outdated and collapsed material, were collected. Existing test owners were retained. Blanket docstring quotas and invitations to change reviewer filters do not override repository conventions and were not treated as production defects. No reviewer configuration, branch protection or published main history was rewritten.

Validation: integrated-main CI — passed: 26 successful jobs, with only the PR-title job skipped because this is a main push. Heavy verification ran only in GitHub CI under the explicit user override. Authorship and verification are agent-based, not human approval.

Final-head evidence: real SQLite/Manager cancellation and deletion and bulk browser screenshots. Codex inspected selection, confirmation and completion on the final main commit.

This branch was successfully deployed

1 active deployment
Preview — 3875c91d Deployed Sep 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bulk session deletion fails when Goal cancellation emits an empty bound session ID

1 participant