feat(FN-1524): add POST /routines/:id/trigger endpoint

- Add POST /routines/:id/trigger as canonical endpoint for manual routine triggers
- Keep POST /routines/:id/run as backward-compatible alias
- Remove duplicate recordRun calls from routine route handlers (persistence handled by RoutineRunner)
- Update webhook auth to return 401 instead of 403 for signature failures
- Fix TypeScript types for promptOverrides to support null values (delete semantics)
- Fix API endpoint to return empty diff stats when worktree doesn't exist
This commit is contained in:
gsxdsm
2026-04-14 09:28:05 -07:00
parent 817f5eae90
commit bc74460340
6 changed files with 22 additions and 23 deletions

View File

@@ -457,9 +457,10 @@ export type PromptOverrideEntry = string | undefined;
/**
* Collection of prompt overrides keyed by PromptKey.
* Stored in project settings as `promptOverrides: Record<PromptKey, string>`.
* Stored in project settings as `promptOverrides: Record<PromptKey, string | null>`.
* Null values are interpreted as "delete this override".
*/
export type PromptOverrideMap = Partial<Record<PromptKey, string>>;
export type PromptOverrideMap = Partial<Record<PromptKey, string | null>>;
// ---------------------------------------------------------------------------
// Resolver Functions
@@ -492,8 +493,8 @@ export function resolvePrompt(
// Check for a valid override
if (overrides && key in overrides) {
const override = overrides[key];
// Non-empty string is a valid override
if (override !== undefined && override !== "") {
// Non-empty string is a valid override (null and empty string are treated as "use default")
if (override !== undefined && override !== null && override !== "") {
return override;
}
}

View File

@@ -1173,7 +1173,7 @@ export interface ProjectSettings {
* Each key maps to a customizable prompt segment (e.g., "executor-welcome",
* "triage-context"). When a key is present with a non-empty value, that
* override replaces the default prompt segment. Missing or empty values
* fall back to the default prompt content.
* fall back to the default prompt content. Null values delete the key.
*
* This is separate from `agentPrompts` which controls full role templates.
* `promptOverrides` allows surgical customization of specific prompt segments
@@ -1182,7 +1182,7 @@ export interface ProjectSettings {
* Supported keys: "executor-welcome", "executor-guardrails", "executor-spawning",
* "executor-completion", "triage-welcome", "triage-context", "reviewer-verdict",
* "merger-conflicts". */
promptOverrides?: Record<string, string>;
promptOverrides?: Record<string, string | null>;
/** Enable/disable agent self-reflection workflows. Default: false. */
reflectionEnabled?: boolean;
/** How often periodic reflections occur in milliseconds. Default: 3_600_000 (1 hour). */