Merge commit 'd16c06308d6e4eaad91f251b4de258f17ec23784' into codex/private-dot-15b-source-union

* commit 'd16c06308d6e4eaad91f251b4de258f17ec23784':
  perf(release): number canaries by master position and confirm them outside the release lock (#21917)
  fix(wake-queue): keep the child-completion reason when a person's comment merges into its held wake (#21918)
  fix(dispatch): start work on a task tree a person created in the person tier (#21916)
  fix(heartbeat): keep saved sessions across config edits the provider thread cannot see (#21862)
  fix(wake-queue): reopen a finished task for a person's comment merged into a system wake (#21914)
  fix(runner-e2e): keep the supervisor off the heartbeat graph and ship the plugin SDK build (#21860)
This commit is contained in:
Dotta committed 2026-11-16 11:41:18 -06:00
commit d900d37bce
42 files changed
+1896 -234

No files matched your search

@@ -474,10 +474,18 @@ function buildTransaction(tx: Db, deps: WakeQueuePostgresAdapterDeps, db: Db, ru
async getCommentSelfAuthorship({ companyId, issueId, finishingRunId, commentIds }) {
const rows = await tx
.select({ createdByRunId: issueComments.createdByRunId })
.select({
createdByRunId: issueComments.createdByRunId, authorType: issueComments.authorType,
authorUserId: issueComments.authorUserId, authorAgentId: issueComments.authorAgentId,
derivedAuthorAgentId: issueComments.derivedAuthorAgentId, deletedAt: issueComments.deletedAt,
})
.from(issueComments)
.where(and(eq(issueComments.companyId, companyId), eq(issueComments.issueId, issueId), inArray(issueComments.id, commentIds)));
return { allSelfAuthored: rows.length > 0 && rows.every((row) => row.createdByRunId === finishingRunId) };
return {
allSelfAuthored: rows.length > 0 && rows.every((row) => row.createdByRunId === finishingRunId),
includesPersonComment: rows.some((row) => !row.deletedAt && row.authorUserId !== null && row.createdByRunId === null &&
row.authorAgentId === null && row.derivedAuthorAgentId === null && (row.authorType === "user" || row.authorType === null)),
};
},
async isWatcherCommentDuringFinishingRun({ companyId, issueId, finishingRunId, commentIds }) {
@@ -178,7 +178,7 @@ export interface WakeQueueTransaction {
issueId: string;
finishingRunId: string;
commentIds: string[];
}): Promise<{ allSelfAuthored: boolean }>;
}): Promise<{ allSelfAuthored: boolean; includesPersonComment: boolean }>;
/** Proves all candidate comments only report completed child work in the finishing parent's own run. */
isCompletedDelegationMention(input: {
companyId: string;
@@ -115,7 +115,7 @@ function createFakeTransaction(overrides: Partial<WakeQueueTransaction> = {}): W
reason: null,
releasePolicy: null,
})),
getCommentSelfAuthorship: vi.fn(async () => ({ allSelfAuthored: false })),
getCommentSelfAuthorship: vi.fn(async () => ({ allSelfAuthored: false, includesPersonComment: false })),
isWatcherCommentDuringFinishingRun: vi.fn(async () => false),
owedInteractionAnswer: vi.fn(async (): Promise<"deliver" | "blocked" | null> => null),
isCompletedDelegationMention: vi.fn(async () => false),
@@ -681,7 +681,7 @@ describe("releaseIssueExecution", () => {
liveNonSelfCommentIds: scenario === "done_missing" || scenario === "done_self" ? [] : commentIds,
containedSelfAuthoredComment: scenario === "done_self",
})),
getCommentSelfAuthorship: vi.fn(async () => ({ allSelfAuthored: scenario === "done_self" })),
getCommentSelfAuthorship: vi.fn(async () => ({ allSelfAuthored: scenario === "done_self", includesPersonComment: false })),
isWatcherCommentDuringFinishingRun: vi.fn(async () => scenario === "done_watcher_during_run"),
reopenIssue: vi.fn(async () => ({ ...ISSUE, status: "todo" })),
});
@@ -1,5 +1,5 @@
import { readWakeChatConversationId } from "../../run-dispatch/index.js";
import { enrichPromotedWakeContext, wakeMustNotJoinActiveRun } from "../domain/context.js";
import { enrichPromotedWakeContext, wakeMustNotJoinActiveRun, withMergedWakeReasons } from "../domain/context.js";
import { QUEUED_MESSAGES_DELIVERED_REASON } from "../domain/policy.js";
import {
decideQueuedCommentAction,
@@ -392,6 +392,7 @@ async function promoteDeferredWake(
shouldReopen =
!selfAuthorship.allSelfAuthored &&
(workingCandidate.requestedByActorType === "user" ||
selfAuthorship.includesPersonComment ||
workingCandidate.wakeReason === "issue_reopened_via_comment" ||
// The agent watching the task posted it while the run that closed the
// task was active. That agent receives the completed result and can
@@ -978,12 +979,16 @@ export function createAdmitWakeBehindIssueExecution(deps: {
});
if (existingDeferred && !existingDeferred.payload?.interactionId && !existingDeferred.deferredContext.interactionId) {
const mergedDeferredContext = deps.helpers.mergeCoalescedContextSnapshot(
const mergedDeferredContext = withMergedWakeReasons(
deps.helpers.mergeCoalescedContextSnapshot(
existingDeferred.deferredContext,
input.contextSnapshot,
{
preserveExistingInteractionContinuation: true,
},
),
existingDeferred.deferredContext,
input.contextSnapshot,
{
preserveExistingInteractionContinuation: true,
},
);
const mergedPayload = {
...existingDeferred.payload,
@@ -89,6 +89,23 @@ export function wakeMustNotJoinActiveRun(
wakeChatConversationsConflict(activeRunContext, wakeContext);
}
const WAKE_REASONS_KEY = "wakeReasons";
function readWakeReasons(context: unknown): string[] {
const parsed = parseObject(context);
const listed = Array.isArray(parsed[WAKE_REASONS_KEY]) ? parsed[WAKE_REASONS_KEY] as unknown[] : [];
return [...listed, parsed.wakeReason].flatMap((value) => readNonEmptyString(value) ?? []);
}
export function withMergedWakeReasons(
merged: Record<string, unknown>,
existing: unknown,
incoming: unknown,
): Record<string, unknown> {
const reasons = [...new Set([...readWakeReasons(existing), ...readWakeReasons(incoming)])];
return reasons.length > 1 ? { ...merged, [WAKE_REASONS_KEY]: reasons } : merged;
}
export function hasRetainedExternalChatRetry(context: unknown): boolean {
const active = parseObject(context);
const activeSource = readNonEmptyString(active.source);