Skip to content

docs(coderd/database/migrations/chatdmig): record the acquisition query rewrite as the one upstream query edit - #173

Merged
ibetitsmike merged 1 commit into
mainfrom
mike/fork-acquisition-query-exception
Nov 11, 2026
Merged

ibetitsmike merged 1 commit into
mainfrom
mike/fork-acquisition-query-exception

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

Closes #170. Related to #8.

Records the fork's one edit to an upstream query in coderd/database/migrations/chatdmig/README.md. #47 rewrote upstream's GetChatWorkerAcquisitionCandidates in coderd/database/queries/chats.sql for the fork-nested-subagents fairness ranking, and regenerated queries.sql.go and querier.go. The "Fork queries" rule says fork queries go to forkdb so that upstream's generated code never conflicts, and nothing wrote this exception down. The triage on #170 keeps the edit, so this PR documents it instead of moving it.

  • New subsection, "The one upstream query edit". It names the query and the three files, and what the rewrite adds: the unowned_chats CTE, the fair_position order term, and the interleave_subagents branch. It says why the edit stays in place: upstream's worker loop reads its candidates through this query, so a forkdb version would be a full copy that an upstream change merges past without a conflict. It notes that the rewritten SQL also runs with the experiment off, and returns upstream's order then. It lists the sync steps: reapply the rewrite to upstream's version, keep upstream's candidate filter in unowned_chats, regenerate with make gen instead of merging generated files, and run the coderd/x/chatd tests that cover the ranking and upstream's order.
  • Upstream sync. A fourth hand-over case points to that subsection for any sync that changes the query, with or without a conflict. It says the job doesn't detect the case and a clean sync PR merges itself.

coderd/x/chatd/ARCHITECTURE.md is unchanged.

Validation

  • markdownlint-cli2 0.16.0 on the README: 0 errors. The added lines have no em dashes, en dashes, spaced double hyphens, or semicolons.
  • Facts checked on main at ce90b5bb74: git diff --numstat 99fb0da864 ce90b5bb74 -- coderd/database/queries/ coderd/database/queries.sql.go coderd/database/querier.go lists only chats.sql, queries.sql.go, and querier.go. The only caller is coderd/x/chatd/worker.go:171-175, with InterleaveSubagents: w.server.nestedSubagentsEnabled(). The named tests exist in coderd/x/chatd/fork_capacity_internal_test.go and upstream's unchanged agentadmission_internal_test.go. No file under .github/ or scripts/ mentions the query.

Xum opened this PR on behalf of @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T03:22:25.983511Z 0736596 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ibetitsmike
ibetitsmike merged commit e661171 into main Nov 11, 2026
10 checks passed
@ibetitsmike
ibetitsmike deleted the mike/fork-acquisition-query-exception branch November 11, 2026 06:26
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) merged this on behalf of @ibetitsmike.

Merge evidence for head 073659667ccc215b47dd2766d7b344b3edada038: docs-only (coderd/database/migrations/chatdmig/README.md). fork-ci run 42952060605 passed on this exact head, Codex completed with no findings on 0736596 (#173 (comment)), 0 unresolved threads. Merged alongside #175 so one deploy covers both.

ibetitsmike added a commit that referenced this pull request Nov 11, 2026
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.

coderd/database: the subagent fairness ranking is written into upstream's acquisition query, against the fork's query rule

1 participant