fix: expose reconciliation wake reason in diagnostics (#18236)

## Thinking Path

> - Paperclip projects wake records into safe task diagnostics.
> - The projection keeps a small allowlist of stable, non-sensitive
reasons.
> - `execution_reconciliation_required` is a stable wake reason, but the
projection currently converts it to `other`.
> - This hides the actionable reason for a skipped wake.
> - This pull request preserves that reason in diagnostics.
> - The benefit is that operators can diagnose this wake state without
exposing raw error or payload data.

## Linked Issues or Issue Description

Refs #13532

Related: #16966 handles the separate future wake recovery path. This
draft does not add recovery or retry behavior.

## What Changed

- Add `execution_reconciliation_required` to the safe wake-diagnostic
reason allowlist.
- Add focused projection coverage for the known reason and
unknown-reason redaction.
- Extend the existing diagnostics-route regression matrix.

## Verification

- Passed: `pnpm exec vitest run
server/src/routes/issues-wake-diagnostics.test.ts --reporter=verbose` —
1 file, 2 tests.
- Added endpoint-level embedded-Postgres coverage in the existing route
suite.
- The full embedded-Postgres route suite did not complete locally: its
tests timed out in this isolated checkout. A direct embedded-Postgres
start, query, and cleanup probe succeeded. This PR remains draft until
hosted CI provides the broader result.

## Risks

Low. The change exposes one existing stable reason. Unknown reasons
still project to `other`. It does not expose payloads or raw error text,
and it does not change wake admission, recovery, or scheduling.

## Model Used

OpenAI Codex — `gpt-5.6-terra`; tool-assisted coding and reasoning.
Context-window size was not disclosed by the provider runtime.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR is a targeted bug
fix, not a new roadmap feature
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have linked the existing public issue
- [x] I have not referenced internal or instance-local issues or links
- [x] My branch name describes the change and contains no
instance-derived details
- [x] I have run the focused local test and it passes
- [x] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes (not
applicable: no public contract text changed)
- [x] I have considered and documented risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

Co-authored-by: DeadlySilent <3342508+DeadlySilent@users.noreply.github.com>
This commit is contained in:
DeadlySilentandDeadlySilent authored and GitHub committed 2026-11-12 20:45:51 -06:00
1 parent 8d3dfab52c
commit 53608bd1d6
3 files changed
+21 -2

No files matched your search

@@ -267,7 +267,11 @@ describeEmbeddedPostgres("issue wake diagnostics route", () => {
expect(serialized).not.toContain("\"error\"");
});
it.each(["chat_task_completed", "issue_execution_deferred"])("preserves the known %s reason without exposing completion payloads", async reason => {
it.each([
"chat_task_completed",
"issue_execution_deferred",
"execution_reconciliation_required",
])("preserves the known %s reason without exposing completion payloads", async reason => {
const company = await seedCompany(db);
const agent = await seedAgent(db, company.id);
const issue = await seedIssue(db, { companyId: company.id, title: "Completion target", assigneeAgentId: agent.id });
@@ -0,0 +1,14 @@
import { describe, expect, it } from "vitest";
import { projectWakeDiagnosticReason } from "./issues.js";
describe("issue wake diagnostics", () => {
it("preserves the reconciliation-required reason", () => {
expect(projectWakeDiagnosticReason("execution_reconciliation_required")).toBe(
"execution_reconciliation_required",
);
});
it("continues to redact unrecognized reasons", () => {
expect(projectWakeDiagnosticReason("private-provider-detail")).toBe("other");
});
});
+2 -1
View File
@@ -1468,6 +1468,7 @@ const ISSUE_WAKE_DIAGNOSTIC_KNOWN_REASONS = new Set([
"missing_issue_comment",
"process_lost_retry",
"run_liveness_continuation",
"execution_reconciliation_required",
"heartbeat.disabled",
"heartbeat.timer.no_actionable_work",
"heartbeat.wakeOnDemand.disabled",
@@ -1496,7 +1497,7 @@ function projectWakeDiagnosticSource(value: string | null) {
return ISSUE_WAKE_DIAGNOSTIC_KNOWN_SOURCES.has(value) ? value : "other";
}
function projectWakeDiagnosticReason(value: string | null) {
export function projectWakeDiagnosticReason(value: string | null) {
if (!value) return null;
return ISSUE_WAKE_DIAGNOSTIC_KNOWN_REASONS.has(value) ? value : "other";
}