Skip to content

TypeScript: fix tsgo regressions, add prompt-build diagnostics, and harden workq/tool typings#178

Merged
dgarson merged 1 commit intofeat/sysprompt-contributor-patternfrom
codex/enhance-test-coverage-and-telemetry-for-prompts
Feb 24, 2026
Merged

TypeScript: fix tsgo regressions, add prompt-build diagnostics, and harden workq/tool typings#178
dgarson merged 1 commit intofeat/sysprompt-contributor-patternfrom
codex/enhance-test-coverage-and-telemetry-for-prompts

Conversation

@dgarson
Copy link
Owner

@dgarson dgarson commented Feb 24, 2026

Motivation

  • Fix repository TypeScript regressions so pnpm tsgo passes and prompt-building telemetry can be safely emitted.
  • Make prompt contributor selection observable and deterministic for debugging/diagnostics while keeping telemetry opt-in.
  • Harden work queue tooling/types so plugin API shapes and gateway parsing are enum-safe and satisfy stricter TS checks.

Description

  • Prompt diagnostics and tracing: added PromptContributorDecision and PromptContributorAssemblyTrace, PromptContributorRegistry.resolveWithTrace and assembleWithTrace, and emit opt-in prompt.build diagnostic events via emitDiagnosticEvent guarded by isDiagnosticsEnabled(cfg), and wired cfg through prompt entry points (buildAgentSystemPrompt, CLI runner helpers, and commands-system-prompt).
  • Diagnostic event types: extended DiagnosticEventPayload with DiagnosticPromptBuildEvent shape to carry contributors and final stage payloads.
  • Prompt contributor robustness: contributors now tolerate shouldContribute/contribute failures and record selection/exclusion reasons (tag-miss, veto, errors, empty sections) and section sizes in traces.
  • Workq typing and gateway parsing: introduced asEnumOrList for enum-safe status/priority parsing in gateway handlers and added explicit unknown intermediate casts for SQLite row results to satisfy TS checks.
  • Workq tools: added required label fields to all workq tool definitions so they satisfy AnyAgentTool typing; fixed tests/mocks to use ClaimResult/FilesResult and include getById in DB mocks.
  • Test/schema fixes: updated pi-tool-definition-adapter tests to use Type.Object(...) schemas (TypeBox) instead of raw JSON objects; fixed reviewer typing by adding ReviewerAssignment and aligning tests; fixed nullable access patterns in legacy config migration (dm?.policy, dm?.allowFrom).
  • Minor CLI wiring: pass cfg into buildAgentSystemPrompt callers (embedded/CLI path) to enable gated diagnostics.

Testing

  • Ran pnpm tsgo and it completed successfully (TypeScript checks pass).
  • Ran targeted unit tests: pnpm test extensions/issue-tracking/src/reviewers.test.ts extensions/issue-tracking/src/local-md-provider.test.ts extensions/workq/src/cli.test.ts extensions/workq/src/tools.test.ts src/agents/pi-tool-definition-adapter.test.ts src/agents/system-prompt.test.ts src/agents/prompt-contributors/registry.test.ts and all test files passed (80 tests across those suites passed).
  • Ran pnpm check (format + typecheck) which passes for the modified files, but lint (oxlint) still reports pre-existing repository-wide unused-import/unused-var issues in unrelated apps/web* files; these are not introduced by this change and remain outside the scope of this PR.

Codex Task

@dgarson dgarson merged commit 016165f into feat/sysprompt-contributor-pattern Feb 24, 2026
2 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant