Skip to content

fix(runnerhub): reap a Runner's session bindings in every tenant on enroll (RIG-4296) - #1606

Merged
trunk-io[bot] merged 3 commits into
mainfrom
compass-comms/rig-4296-enroll-reap-all-tenants
Oct 4, 2026
Merged

trunk-io[bot] merged 3 commits into
mainfrom
compass-comms/rig-4296-enroll-reap-all-tenants

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

When the durable enroll sweep fails, Hub.enroll falls back to the in-RAM snapshot of the Runner's sessions and archives each one. It ran those archives under the enroll ctx, which has no tenant. So a non-bootstrap session read SessionMaxEntrySeq = 0 under the bootstrap tenant's RLS and was silently not archived.

Main already reaps every tenant under store.WithSystemRole and archives each swept row under its own tenant (RIG-2872, #1509). After the rebase this PR keeps only the fallback fix:

  • The fallback resolves each session's tenant through runnerSessionCtx (the failed sweep leaves the rows). If the store doesn't answer, the archive runs unscoped as before. A session id bound in several tenants (ErrConflict) is skipped, as dropLostSession does.

Tests:

  • TestEnrollReapFaultArchivesUnderSessionTenant: a faulted sweep archives sess-1 under its tenant. It fails on the old code (tenant "").
  • TestEnrollReapFaultSkipsAmbiguousSessionArchive (synctest): an ambiguous id is not archived. Removing the ok check fails it.
  • TestEnrollReapsSessionBindingAcrossTenants (pgtest) also asserts that tenant B's archive runs under tenant B.

Spec-impact: none

Refs RIG-4296

Co-authored-by: Matt Wilkinson matt@rigel.build

@trunk-io

trunk-io Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@linear-code

linear-code Bot commented Oct 4, 2026

Copy link
Copy Markdown

RIG-4296

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-comms-rig-4296-enrol.compass-eng-docs.pages.dev

Deployed from compass-comms/rig-4296-enroll-reap-all-tenants at b573c07.

@rigel-mintaka
rigel-mintaka marked this pull request as ready for review October 4, 2026 13:52
rigel-mintaka and others added 2 commits October 4, 2026 12:35
…RIG-4296)

When the durable sweep faults, enroll archives the RAM snapshot of the
Runner's sessions. It ran those archives under the enroll ctx, which has no
tenant. Each archive now resolves the session's tenant through
runnerSessionCtx; the failed sweep left the rows, so the lookup still works.

Main already reaps every tenant under the system role (RIG-2872), so this
change covers only the fallback path. A pgtest pins each swept session
archiving under its own tenant, the bootstrap tenant included.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the compass-comms/rig-4296-enroll-reap-all-tenants branch from db51705 to 2398338 Compare October 4, 2026 16:38
… check into the cross-tenant test (RIG-4296)

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@trunk-io
trunk-io Bot merged commit 2059ba7 into main Oct 4, 2026
15 checks passed
@trunk-io
trunk-io Bot deleted the compass-comms/rig-4296-enroll-reap-all-tenants branch October 4, 2026 20:14
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.

2 participants