René's URL Explorer Experiment


Title: chatd debug logs: deferred review items from PR stack · Issue #24137 · coder/coder · GitHub

Open Graph Title: chatd debug logs: deferred review items from PR stack · Issue #24137 · coder/coder

X Title: chatd debug logs: deferred review items from PR stack · Issue #24137 · coder/coder

Description: Tracking: chatd Debug Logs — Deferred Review Items This issue tracks deferred review items from the chatd debug logs PR stack (#23913–#23921) that mafredri flagged as needing a tracking artifact. PR #23914 — Types, Context, Model Normali...

Open Graph Description: Tracking: chatd Debug Logs — Deferred Review Items This issue tracks deferred review items from the chatd debug logs PR stack (#23913–#23921) that mafredri flagged as needing a tracking artifact. P...

X Description: Tracking: chatd Debug Logs — Deferred Review Items This issue tracks deferred review items from the chatd debug logs PR stack (#23913–#23921) that mafredri flagged as needing a tracking artifact. P...

Opengraph URL: https://github.com/coder/coder/issues/24137

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"chatd debug logs: deferred review items from PR stack","articleBody":"## Tracking: chatd Debug Logs — Deferred Review Items\n\nThis issue tracks deferred review items from the chatd debug logs PR stack (#23913–#23921) that mafredri flagged as needing a tracking artifact.\n\n### PR #23914 — Types, Context, Model Normalization\n\n- [ ] **`normalizeToolResultOutput` test coverage**: 7/8 type-switch arms untested including nil guards, error-to-string conversion, media placeholder formatting, and default JSON fallback\n- [ ] **`GenerateObject` test coverage**: unique paths (`normalizeObjectCall`, `normalizeObjectResponse`, nil guard, `structured_output` metadata) have 0% test coverage\n- [ ] **Unconsumed stream safety net**: an unconsumed stream wrapper never calls `finalize`, leaving step permanently `in_progress` once real recorder lands. Consider `context.AfterFunc` or `runtime.SetFinalizer`\n- [ ] **`stepHandle.finish` synchronization**: add `sync.Once` to `stepHandle.finish` itself or serialize through holder mutex to prevent data race when recorder inherits the pattern\n\n### PR #23915 — Recorder, Transport, Redaction\n\n- [x] **Transport test coverage**: additional test scenarios for fail-closed `RedactJSONSecrets`, non-JSON response body handling\n- [x] **Recorder test coverage**: additional test scenarios flagged in review (specific gaps addressed: TestNextStepNumber_Concurrent cleanup, step counter tests, nil-safety tests)\n\n### PR #23916 — Service, Summary, Aggregation\n\n- [x] **`FinalizeStale` uses `time.Now()` directly**: Resolved — `quartz.Clock` injected via `WithClock` option; `FinalizeStale`, heartbeat tickers, and `stepHandle.finish` all use `s.clock.Now()`\n- [x] **Reasoning tokens aggregation test**: Resolved — `ReasoningTokensSummedAcrossSteps` and `ZeroReasoningTokensOmitsField` tests added with `updateTestStepWithFullUsage` helper\n- [x] **`nullJSON` typed nils**: `nullJSON` maps both nil and typed nils to `NullRawMessage{Valid: false}` — intentional for write-once-finalize pattern, not a correctness issue\n- [x] **`for {}` loop iteration cap**: Resolved — `maxCreateStepRetries = 10` cap and `ctx.Err()` check between iterations\n- [x] **F25: `TouchStep` uses full `UpdateChatDebugRun`**: Resolved — added dedicated `TouchChatDebugRunUpdatedAt` SQL query that only bumps `updated_at`\n- [x] **F27: TOCTOU race in `CreateStep` finalization guard**: Resolved — added `AND run.finished_at IS NULL` to `InsertChatDebugStep` WHERE clause; `sql.ErrNoRows` mapped to `errRunFinalized`\n- [x] **F18: `stepHandle.generation` dead code**: Resolved — removed field and increment\n- [x] **F22: Priority guard blocks same-priority retries**: Resolved — changed `\u003c=` to `\u003c`\n- [x] **F24: `extractEndpointLabel` deserializes full `Attempt`**: Resolved — `attemptLabel` minimal projection struct\n- [x] **F26: Em-dash characters in comments**: Resolved — replaced with standard punctuation\n- [x] **F28: `errRunFinalized` guard test coverage**: Resolved — `TestService_CreateStep_RejectsFinalizedRun` added\n- [x] **F29: `time.Now()` in recorder.go**: Resolved — replaced with `h.svc.clock.Now()`\n- [x] **F30: `truncateRunes` duplicates `util/strings.Truncate`**: Resolved — replaced with `stringutil.Truncate`\n- [x] **`expectUpdateStep` shallow JSON assertions**: model tests check `.Valid` flags but not JSON content; needs provider-specific fixture data\n- [x] **Non-stream heartbeat for `Generate`/`GenerateObject`**: Resolved -- added `launchHeartbeat` calls in both `Generate` and `GenerateObject` to keep the step alive during blocking provider calls\n\n### PR #23917 — Chat Lifecycle Wiring\n\n- [x] **Unconditional `NewService` call**: Resolved — chatd now initializes the\n  debug service lazily through a factory and only materializes it on demand\n- [x] **`processChat`/`finishActiveChat` interleaving**: Resolved — finish-time\n  status publishing now re-reads the chat state and suppresses stale final\n  updates after a newer write wins\n- [x] **`newDebugModel` nil guard**: Resolved — debug model wrapping now routes\n  through guarded debug-service accessors instead of assuming the service is\n  always present\n- [x] **quickgen debug model wrapping**: Resolved — quickgen now shares a helper\n  that wraps the model before run creation and finalizes with a bounded,\n  uncancelled context\n- [x] **`chatd.go:4215` deferred cleanup**: Resolved — edit/archive debug cleanup\n  now uses retrying best-effort cleanup with bounded timeouts plus the existing\n  stale-finalization safety net\n- [x] **`chatd.go:1311` deferred item**: Resolved — startup stale-finalization\n  now reuses the existing debug service instead of eagerly constructing one\n- [x] **`chatd.go:1918` deferred item**: Resolved — active-chat finalization now\n  avoids publishing stale terminal state after newer control-path updates\n- [x] **`quickgen.go:784` deferred item**: Resolved — quickgen debug lifecycle\n- [x] **Edit cleanup race (Codex P2)**: Resolved — `DeleteChatDebugDataAfterMessageID`\n  now accepts a `started_before` timestamp so retried cleanup does not delete\n  runs created by a replacement turn that raced ahead of the retry window\n- [x] **Startup stale-finalization gating (Codex P3)**: Resolved — startup now uses\n  `debugService()` (forces lazy init) instead of `existingDebugService()` so\n  stale debug rows from a previous crash are finalized even when no request\n  has triggered initialization yet\n  setup is centralized so title and push-summary generation share the same\n  guarded create/finalize flow\n\n### PR #23918 — HTTP Handlers, API Docs\n\n- [x] **Handler test coverage**: `getChatDebugRuns`, `getChatDebugRun`, `getChatDebugLogging`/`putChatDebugLogging`, `getUserChatDebugLogging`/`putUserChatDebugLogging` are covered by `TestChatDebugRuns`, `TestChatDebugRun`, and `TestChatDebugLoggingSettings` (bad UUID, missing run, cross-chat 404, newest-first ordering, 100-row cap, empty-list shape, admin-allow/revoke/re-allow cycle, forced-by-deployment, unauthenticated read)\n- [x] **`ChatDebugEvent` zero consumers**: removed — no references remain in Go or TypeScript\n- [x] **Naming inconsistency**: the per-chat `debug_logs_enabled_override` override was dropped along with the tri-state model; remaining types use `debug_logging_enabled` consistently\n- [x] **`ChatDebugSettings` / `UpdateChatDebugLoggingRequest` type sharing**: split into dedicated admin/user types — `ChatDebugLoggingAdminSettings` + `UpdateChatDebugLoggingAllowUsersRequest` for the deployment endpoint, `UserChatDebugLoggingSettings` + `UpdateUserChatDebugLoggingRequest` for the per-user endpoint\n- [x] **`NullableBool.MarshalJSON` wire format**: the `NullableBool` type and its custom marshaling were removed entirely when the tri-state per-chat override was dropped\n- [ ] **Debug runs list pagination**: SQL `LIMIT 100` with no pagination or truncation signal. Deferred to v2 per DEREM-5 panel closure (5/5 accept) — cap is tested, endpoint is experimental, no UI approaches the limit today; revisit when the frontend needs pagination\n\n### PR #23919 — Frontend API, Panel Utils\n\n- [x] **`debugPanelUtils.test.ts` test coverage**: Resolved — suite expanded to 100 cases across all 14 exported helpers. Coverage now exercises `coerceStepResponse` (OpenAI-choice tool_calls fallback, top-level `tool_calls`, response-body `usage`/`warnings`/`model`, non-object defaults, JSON-string wrapping), `coerceRunSummary` and `coerceStepRequest` JSON-string unwrapping, tool-call/tool-result message-part metadata, nameless tool filtering, `normalizeAttempts` object-shaped errors and pre-built `raw_request`/`raw_response` pass-through, positional attempt-number fallback, `extractTokenCounts` empty-record path, and `clampContent` whitespace/boundary/ellipsis-trim behavior.\n\n### PR #23920 — Debug Panel Components, Settings\n\n- [ ] **Errored runs poll indefinitely**: `errored` status missing from `ERROR_STATUSES`, causing infinite 5s polling\n- [ ] **`state.data` typed as `unknown`**: `debugQueries.ts:35` should be properly typed\n- [ ] **`tool_choice` bare `String()` on `unknown`**: `DebugStepCard.tsx:178` uses unsafe cast\n- [ ] **Unbounded `response.content` rendering**: `DebugStepCard.tsx:346` has no content limit\n- [ ] **NaN-unsafe sort**: `DebugPanel.tsx:23` sort comparator\n- [ ] **Dead branch**: `DebugRunList.tsx:16` dead code\n- [ ] **Tab-ID duplication**: `AgentChatPageView.tsx:317`\n\n### PR #23913 — Database Schema, SDK Types\n\n- [ ] **Three-tier toggle integration test**: site/user/chat enablement resolution has no integration test\n- [ ] **`UpdateChatDebugStep` operation updatable**: defense was acknowledged, no ticket\n\n### PR #23921 — Storybook Stories\n\n- [ ] **Section comment cleanup**: \"Existing stories\" / \"New stories\" reflect development timeline, not semantic grouping\n\n","author":{"url":"https://github.com/ThomasK33","@type":"Person","name":"ThomasK33"},"datePublished":"2026-04-08T05:27:44Z","url":"https://github.com/coder/coder/issues/24137"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:45c34d9e-5395-3e72-b2d5-ee5c9399ab89
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id833A:65478:1D9DBBE:273D338:6B01652F
html-safe-noncee40ef13de66ce7044502d2adbe1b48471d49559ff0dd9da86abce973150c9fe5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzNBOjY1NDc4OjFEOURCQkU6MjczRDMzODo2QjAxNjUyRiIsInZpc2l0b3JfaWQiOiI3OTEzNzI5MTY1OTgyMDAwNDMxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac016915358db3183b34abaec0704ca0c6361112fb14d64fcc4c0e9b11c9f3600d
hovercard-subject-tagissue:4222332755
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/24137/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b284a780385cde832038244ec57d2d3359a211a827fa7ac4929840c845d151e5/coder/coder/issues/24137
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b284a780385cde832038244ec57d2d3359a211a827fa7ac4929840c845d151e5/coder/coder/issues/24137
og:image:altTracking: chatd Debug Logs — Deferred Review Items This issue tracks deferred review items from the chatd debug logs PR stack (#23913–#23921) that mafredri flagged as needing a tracking artifact. P...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameThomasK33
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/coder/coder git https://github.com/coder/coder.git
octolytics-dimension-user_id95932066
octolytics-dimension-user_logincoder
octolytics-dimension-repository_id440752086
octolytics-dimension-repository_nwocoder/coder
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id440752086
octolytics-dimension-repository_network_root_nwocoder/coder
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/coder/coder/issues/24137#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fissues%2F24137
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fissues%2F24137
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=coder%2Fcoder
Reloadhttps://github.com/coder/coder/issues/24137
Reloadhttps://github.com/coder/coder/issues/24137
Reloadhttps://github.com/coder/coder/issues/24137
coderhttps://github.com/coder
coderhttps://github.com/coder/coder
Codehttps://github.com/coder/coder
Issues320 (320)https://github.com/coder/coder/issues
Pull requests470 (470)https://github.com/coder/coder/pulls
Discussionshttps://github.com/coder/coder/discussions
Actionshttps://github.com/coder/coder/actions
Projectshttps://github.com/coder/coder/projects
Security and quality49 (49)https://github.com/coder/coder/security
Insightshttps://github.com/coder/coder/insights
https://github.com/coder/coder
New issuehttps://github.com/login?return_to=https://github.com/coder/coder/issues/24137
New issuehttps://github.com/login?return_to=https://github.com/coder/coder/issues/24137
chatd debug logs: deferred review items from PR stackhttps://github.com/coder/coder/issues/24137#top
https://github.com/ThomasK33
ThomasK33https://github.com/ThomasK33
on Apr 8, 2026https://github.com/coder/coder/issues/24137#issue-4222332755
#23913https://github.com/coder/coder/pull/23913
#23921https://github.com/coder/coder/pull/23921
#23914https://github.com/coder/coder/pull/23914
#23915https://github.com/coder/coder/pull/23915
#23916https://github.com/coder/coder/pull/23916
#23917https://github.com/coder/coder/pull/23917
#23918https://github.com/coder/coder/pull/23918
#23919https://github.com/coder/coder/pull/23919
#23920https://github.com/coder/coder/pull/23920
#23913https://github.com/coder/coder/pull/23913
#23921https://github.com/coder/coder/pull/23921
ThomasK33https://github.com/ThomasK33
completedhttps://github.com/coder/coder/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Apr 24, 2026https://github.com/coder/coder/issues/24137#event-24832900802
Sign up for freehttps://github.com/signup?return_to=https://github.com/coder/coder/issues/24137
Sign in to commenthttps://github.com/login?return_to=https://github.com/coder/coder/issues/24137
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.