Skip to content

chore(coderd/database): purge terminal workspace build orchestrations - #25760

Merged
geokat merged 3 commits into
george/plat-143/3-process-on-success-workspace-build-orchestrationfrom
george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations
Jul 6, 2026
Merged

chore(coderd/database): purge terminal workspace build orchestrations#25760
geokat merged 3 commits into
george/plat-143/3-process-on-success-workspace-build-orchestrationfrom
george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations

Conversation

@geokat

@geokat geokat commented May 27, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a stack that adds durable server-side workspace restart support
to the API.

Add dbpurge cleanup for terminal workspace build orchestration rows. Completed,
failed, and canceled rows are retained briefly for observability, then deleted in
bounded batches.

Pending rows and recent terminal rows are preserved so active orchestration state
is not removed.

Ref: https://linear.app/codercom/issue/PLAT-143/add-workspace-restart-functionality-to-api
Ref: #5800


This PR is part of a stack that merges into main:

  1. feat: add workspace build orchestration storage #25757
  2. feat: add on_success workspace build request handling #25758
  3. feat(coderd): process on_success workspace build orchestration #25759
  4. chore(coderd/database): purge terminal workspace build orchestrations #25760 👈
  5. feat(cli): server-side restart orchestration demo #25761

Created with stakk

@geokat
geokat force-pushed the george/plat-143/3-process-on-success-workspace-build-orchestration branch from 096cb57 to 998848a Compare May 28, 2026 04:27
@geokat
geokat force-pushed the george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations branch from 6604ffa to 711f3b7 Compare May 28, 2026 04:27
@geokat
geokat marked this pull request as ready for review May 28, 2026 05:31
@github-actions github-actions Bot added the stale This issue is like stale bread. label Jun 10, 2026
@geokat geokat removed the stale This issue is like stale bread. label Jun 12, 2026
@geokat
geokat force-pushed the george/plat-143/3-process-on-success-workspace-build-orchestration branch from 998848a to cfa75f9 Compare June 16, 2026 23:57
@geokat
geokat force-pushed the george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations branch from 711f3b7 to 7d48ade Compare June 16, 2026 23:57
@geokat
geokat force-pushed the george/plat-143/3-process-on-success-workspace-build-orchestration branch from cfa75f9 to 06af5be Compare June 17, 2026 19:31
@geokat
geokat force-pushed the george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations branch from 7d48ade to c976ecf Compare June 17, 2026 19:32
@geokat
geokat force-pushed the george/plat-143/3-process-on-success-workspace-build-orchestration branch from 06af5be to 0ddfc81 Compare June 17, 2026 20:55
@geokat
geokat force-pushed the george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations branch from c976ecf to 7ab27d6 Compare June 17, 2026 20:56
@geokat
geokat force-pushed the george/plat-143/3-process-on-success-workspace-build-orchestration branch from 0ddfc81 to a1b168a Compare June 17, 2026 23:23
@geokat
geokat force-pushed the george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations branch from 7ab27d6 to afd17c6 Compare June 17, 2026 23:23
@geokat
geokat force-pushed the george/plat-143/3-process-on-success-workspace-build-orchestration branch from a1b168a to 5c38677 Compare June 24, 2026 01:11
@geokat
geokat force-pushed the george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations branch from afd17c6 to 3d602a6 Compare June 24, 2026 01:11
Add dbpurge cleanup for completed, failed, and canceled workspace
build orchestration rows after a short retention window. Keep pending
rows and recent terminal rows, and delete in bounded batches.

Ref: https://linear.app/codercom/issue/PLAT-143/add-workspace-restart-functionality-to-api
Ref: #5800
@geokat
geokat force-pushed the george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations branch from 3d602a6 to 7c9d070 Compare June 30, 2026 21:58
@geokat

geokat commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-06-30 22:22 UTC by @geokat
Spend: $19.07 / $100.00

Review history
  • R1 (2026-06-30): 14 reviewers, 1 Nit, 1 P3, COMMENT. Review

deep-review v0.9.0 | Round 1 | b127602..7c9d070

Last posted: Round 1, 2 findings (1 P3, 1 Nit), COMMENT. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Open workspacebuildorchestrations.sql:118 / dbpurge.go:284 Query uses :exec not :execrows; deleted count not logged or metered R1 Netero P3, Chopper P3, Meruem P3, Ryosuke P3 Yes
CRF-2 Nit Open dbpurge.go:42 Comment is wordier than needed R1 Gon (downgraded from P2; adjacent constants use same 3-line style) Yes
CRF-3 Nit Dropped by orchestrator (codebase convention disproven) workspacebuildorchestrations.sql:118 Missing doc comment on purge query R1 Leorio No

Contested and acknowledged

(none)

Round log

Round 1

Panel: 14 reviewers. 1 P3 (CRF-1), 1 Nit posted (CRF-2), 1 Nit dropped (CRF-3). Reviewed against b127602..7c9d070.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review 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.

Clean, focused purge addition. The SQL query correctly targets terminal statuses, preserves pending rows and recent terminal rows, uses bounded batches, and the RBAC wiring is correct. Test coverage is thorough: status filtering, batch limiting, retention window, and multi-pass cleanup all verified against real PostgreSQL. 14-reviewer panel found almost nothing wrong.

"I tried to build a case against this change and could not." (Pariston)

1 P3, 1 Nit.

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/database/queries/workspacebuildorchestrations.sql Outdated
Comment thread coderd/database/dbpurge/dbpurge.go Outdated
@geokat
geokat requested a review from Emyrk July 6, 2026 19:26

@Emyrk Emyrk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the purge query, dbpurge integration, RBAC grant, concurrency interplay with the orchestrator, tests, and generated code. One blocking issue: the dbauthz test mocks DeleteOldWorkspaceBuildOrchestrations with the wrong Return arity and will fail the Linux PG jobs. One non-blocking note on indexing inline. Everything else looks good.

🤖 Drafted by Coder Agents on behalf of @Emyrk.

Comment thread coderd/database/dbauthz/dbauthz_test.go Outdated
Comment thread coderd/database/queries/workspacebuildorchestrations.sql

@Emyrk Emyrk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only a comment. Approving

LGTM 👍

@geokat
geokat merged commit 4ecf457 into george/plat-143/3-process-on-success-workspace-build-orchestration Jul 6, 2026
25 of 30 checks passed
@geokat
geokat deleted the george/plat-143/4-dbpurge-terminal-workspace-build-orchestrations branch July 6, 2026 20:42
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants