@superblocksteam/vite-plugin-file-sync 2.0.154 → 2.0.155-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts +23 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js +84 -29
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
- package/dist/ai-service/agent/subagents/apis/prompt-builder.d.ts +2 -0
- package/dist/ai-service/agent/subagents/apis/prompt-builder.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/apis/prompt-builder.js +11 -2
- package/dist/ai-service/agent/subagents/apis/prompt-builder.js.map +1 -1
- package/dist/ai-service/agent/tool-permission-delivery.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-permission-delivery.js +4 -0
- package/dist/ai-service/agent/tool-permission-delivery.js.map +1 -1
- package/dist/ai-service/agent/tools/app-environment/update-app-environment.d.ts +29 -0
- package/dist/ai-service/agent/tools/app-environment/update-app-environment.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/app-environment/update-app-environment.js +387 -0
- package/dist/ai-service/agent/tools/app-environment/update-app-environment.js.map +1 -0
- package/dist/ai-service/agent/tools/databases/destructive-migration-prompt.d.ts +58 -0
- package/dist/ai-service/agent/tools/databases/destructive-migration-prompt.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/databases/destructive-migration-prompt.js +258 -0
- package/dist/ai-service/agent/tools/databases/destructive-migration-prompt.js.map +1 -0
- package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts +18 -6
- package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/databases/dev-database-tasks.js +203 -51
- package/dist/ai-service/agent/tools/databases/dev-database-tasks.js.map +1 -1
- package/dist/ai-service/agent/tools/databases/dev-database-tools.d.ts +12 -10
- package/dist/ai-service/agent/tools/databases/dev-database-tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/databases/dev-database-tools.js +29 -8
- package/dist/ai-service/agent/tools/databases/dev-database-tools.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.d.ts +3 -0
- package/dist/ai-service/agent/tools/integrations/metadata.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.js +10 -2
- package/dist/ai-service/agent/tools/integrations/metadata.js.map +1 -1
- package/dist/ai-service/agent/tools.d.ts +9 -1
- package/dist/ai-service/agent/tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools.js +25 -1
- package/dist/ai-service/agent/tools.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts +8 -0
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +104 -14
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
- package/dist/ai-service/app-interface/npm-registry.d.ts +9 -0
- package/dist/ai-service/app-interface/npm-registry.d.ts.map +1 -1
- package/dist/ai-service/app-interface/npm-registry.js +50 -1
- package/dist/ai-service/app-interface/npm-registry.js.map +1 -1
- package/dist/ai-service/app-skills/helpers.d.ts.map +1 -1
- package/dist/ai-service/app-skills/helpers.js +1 -0
- package/dist/ai-service/app-skills/helpers.js.map +1 -1
- package/dist/ai-service/dev-database-client.d.ts +3 -1
- package/dist/ai-service/dev-database-client.d.ts.map +1 -1
- package/dist/ai-service/dev-database-client.js.map +1 -1
- package/dist/ai-service/features.d.ts +24 -0
- package/dist/ai-service/features.d.ts.map +1 -1
- package/dist/ai-service/features.js +24 -0
- package/dist/ai-service/features.js.map +1 -1
- package/dist/ai-service/helper-system-ai-attributes.d.ts +19 -0
- package/dist/ai-service/helper-system-ai-attributes.d.ts.map +1 -0
- package/dist/ai-service/helper-system-ai-attributes.js +17 -0
- package/dist/ai-service/helper-system-ai-attributes.js.map +1 -0
- package/dist/ai-service/index.d.ts +58 -2
- package/dist/ai-service/index.d.ts.map +1 -1
- package/dist/ai-service/index.js +186 -34
- package/dist/ai-service/index.js.map +1 -1
- package/dist/ai-service/integrations/store.d.ts +3 -0
- package/dist/ai-service/integrations/store.d.ts.map +1 -1
- package/dist/ai-service/integrations/store.js +3 -0
- package/dist/ai-service/integrations/store.js.map +1 -1
- package/dist/ai-service/live-edit-events/bridge.d.ts +21 -0
- package/dist/ai-service/live-edit-events/bridge.d.ts.map +1 -0
- package/dist/ai-service/live-edit-events/bridge.js +52 -0
- package/dist/ai-service/live-edit-events/bridge.js.map +1 -0
- package/dist/ai-service/live-edit-events/forwarder.d.ts +158 -0
- package/dist/ai-service/live-edit-events/forwarder.d.ts.map +1 -0
- package/dist/ai-service/live-edit-events/forwarder.js +403 -0
- package/dist/ai-service/live-edit-events/forwarder.js.map +1 -0
- package/dist/ai-service/state-machine/clark-fsm.d.ts +14 -0
- package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/awaiting-user.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/awaiting-user.js +4 -0
- package/dist/ai-service/state-machine/handlers/awaiting-user.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/idle.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/idle.js +3 -0
- package/dist/ai-service/state-machine/handlers/idle.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.d.ts +2 -0
- package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js +93 -3
- package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/headless-turn-lifecycle.d.ts +27 -0
- package/dist/ai-service/state-machine/helpers/headless-turn-lifecycle.d.ts.map +1 -0
- package/dist/ai-service/state-machine/helpers/headless-turn-lifecycle.js +34 -0
- package/dist/ai-service/state-machine/helpers/headless-turn-lifecycle.js.map +1 -0
- package/dist/ai-service/state-machine/helpers/peer.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/peer.js +24 -0
- package/dist/ai-service/state-machine/helpers/peer.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.js +4 -0
- package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/prompt-request-metrics.d.ts +103 -1
- package/dist/ai-service/state-machine/helpers/prompt-request-metrics.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/prompt-request-metrics.js +263 -3
- package/dist/ai-service/state-machine/helpers/prompt-request-metrics.js.map +1 -1
- package/dist/ai-service/state-machine/helpers/stable-peer.d.ts +143 -0
- package/dist/ai-service/state-machine/helpers/stable-peer.d.ts.map +1 -1
- package/dist/ai-service/state-machine/helpers/stable-peer.js +220 -2
- package/dist/ai-service/state-machine/helpers/stable-peer.js.map +1 -1
- package/dist/ai-service/tasks/peer-push.d.ts.map +1 -1
- package/dist/ai-service/tasks/peer-push.js +7 -0
- package/dist/ai-service/tasks/peer-push.js.map +1 -1
- package/dist/dev-server-ws-smoke-client.d.ts.map +1 -1
- package/dist/dev-server-ws-smoke-client.js +1 -0
- package/dist/dev-server-ws-smoke-client.js.map +1 -1
- package/dist/file-sync-vite-plugin.d.ts.map +1 -1
- package/dist/file-sync-vite-plugin.js +9 -2
- package/dist/file-sync-vite-plugin.js.map +1 -1
- package/dist/lock-service/activity-tracker.d.ts.map +1 -1
- package/dist/lock-service/activity-tracker.js +5 -6
- package/dist/lock-service/activity-tracker.js.map +1 -1
- package/dist/lock-service/index.d.ts +56 -1
- package/dist/lock-service/index.d.ts.map +1 -1
- package/dist/lock-service/index.js +158 -13
- package/dist/lock-service/index.js.map +1 -1
- package/dist/rename-manager.d.ts.map +1 -1
- package/dist/rename-manager.js +2 -6
- package/dist/rename-manager.js.map +1 -1
- package/dist/socket-manager.d.ts +64 -0
- package/dist/socket-manager.d.ts.map +1 -1
- package/dist/socket-manager.js +236 -51
- package/dist/socket-manager.js.map +1 -1
- package/dist/util/logger.d.ts +2 -0
- package/dist/util/logger.d.ts.map +1 -1
- package/dist/util/logger.js +5 -0
- package/dist/util/logger.js.map +1 -1
- package/package.json +9 -9
- package/dist/parsing/entity/to-code-entity.d.ts +0 -3
- package/dist/parsing/entity/to-code-entity.d.ts.map +0 -1
- package/dist/parsing/entity/to-code-entity.js +0 -77
- package/dist/parsing/entity/to-code-entity.js.map +0 -1
- package/dist/parsing/entity/to-value-entity.d.ts +0 -8
- package/dist/parsing/entity/to-value-entity.d.ts.map +0 -1
- package/dist/parsing/entity/to-value-entity.js +0 -129
- package/dist/parsing/entity/to-value-entity.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer.js","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/peer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"peer.js","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/peer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC,MAAM,oBA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,EAAE,CACxC,CAAC;QACJ,CAAC,EAAE,KAAK,CAAC,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-gate-usage-metrics.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/policy-gate-usage-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAML,KAAK,aAAa,EAEnB,MAAM,6BAA6B,CAAC;AAIrC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAE5E;AAaD,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GACtC,aAAa,CAKf;AAED,wBAAsB,yBAAyB,CAAC,MAAM,EAAE;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE;QACN,KAAK,EAAE,WAAW,CAChB,KAAK,CAAC;YACJ,QAAQ,CAAC,EAAE;gBAAE,OAAO,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;YAChC,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD,CAAC,CACH,CAAC;QACF,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACxE,CAAC;CACH,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAkCpC;AAED,wBAAsB,8BAA8B,CAAC,MAAM,EAAE;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,MAAM,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;KAAE,CAAC;IAC/C,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;CAChC,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"policy-gate-usage-metrics.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/policy-gate-usage-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAML,KAAK,aAAa,EAEnB,MAAM,6BAA6B,CAAC;AAIrC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAE5E;AAaD,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GACtC,aAAa,CAKf;AAED,wBAAsB,yBAAyB,CAAC,MAAM,EAAE;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE;QACN,KAAK,EAAE,WAAW,CAChB,KAAK,CAAC;YACJ,QAAQ,CAAC,EAAE;gBAAE,OAAO,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;YAChC,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;SACvD,CAAC,CACH,CAAC;QACF,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACxE,CAAC;CACH,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAkCpC;AAED,wBAAsB,8BAA8B,CAAC,MAAM,EAAE;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,MAAM,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;KAAE,CAAC;IAC/C,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;CAChC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwChB"}
|
|
@@ -59,6 +59,10 @@ export async function finalizePolicyGateUsageMetrics(params) {
|
|
|
59
59
|
dedupeKey: params.aiAgentRunId,
|
|
60
60
|
failure: params.outcome === "failure" ? params.failure : undefined,
|
|
61
61
|
outcome: params.outcome,
|
|
62
|
+
// A policy-gate scan is not a user turn. Counting it toward (or clearing)
|
|
63
|
+
// the conversation streak pages a scan that failed twice, or lets a
|
|
64
|
+
// successful scan hide a stuck chat (ENG-5477 review).
|
|
65
|
+
streakEligible: false,
|
|
62
66
|
});
|
|
63
67
|
if (params.llmUsage.length === 0) {
|
|
64
68
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-gate-usage-metrics.js","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/policy-gate-usage-metrics.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EACL,+BAA+B,EAC/B,qBAAqB,EACrB,mB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C;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;QAClD,OAAO;YACL;gBACE,KAAK,EAAE,MAAM,CAAC,SAAS;gBACvB,QAAQ,EAAE,MAAM,CAAC,YAAY;gBAC7B,GAAG,uBAAuB,CAAC,UAAU,IAAI,EAAE,CAAC;aAC7C;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAC,MASpD;IACC,MAAM,MAAM,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAE9C,mBAAmB,CAAC;QAClB,GAAG,MAAM;QACT,SAAS,EAAE,MAAM,CAAC,YAAY;QAC9B,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;QAClE,OAAO,EAAE,MAAM,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"policy-gate-usage-metrics.js","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/policy-gate-usage-metrics.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EACL,+BAA+B,EAC/B,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GAGpB,MAAM,6BAA6B,CAAC;AAErC,MAAM,mBAAmB,GAAG,aAAsB,CAAC;AAEnD,MAAM,UAAU,uBAAuB,CAAC,MAA8B;IACpE,mBAAmB,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,sBAAsB,CAAC,MAG/B;IACC,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,WAAW,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_PROMPT_FAILURE_REASONS, PROMPT_FAILURE_ORIGINS, TELEMETRY_FAILURE_ORIGINS, telemetryFailureOrigin, isUserInitiatedPromptAbort, promptFailureFromLlmError, promptFailureFromStreamAbort, promptFailureLlmProviderUnknown, promptFailurePaywall, promptFailurePlatform, promptFailureUserCanceled, type PlatformPromptFailureReason, type PromptFailureOrigin, type TelemetryFailureOrigin, type UserPromptFailureReason, USER_PROMPT_FAILURE_REASONS, } from "./prompt-failure.js";
|
|
7
7
|
export declare const METRIC_AWAITING_USER_DISMISSED = "superblocks.clark.prompt.awaiting_user_dismissed_total";
|
|
8
8
|
export declare const METRIC_BASE_COMMIT_RESOLUTION_FAILED = "superblocks.clark.prompt.base_commit_resolution_failed_total";
|
|
9
|
+
export declare const METRIC_REPEATED_FAILURES = "superblocks.clark.prompt.repeated_failures_total";
|
|
10
|
+
/**
|
|
11
|
+
* Consecutive failed turns that make a conversation "stuck" (ENG-5477).
|
|
12
|
+
*
|
|
13
|
+
* Two is deliberate rather than conservative: in-turn provider retries and the
|
|
14
|
+
* post-processing debug loop are already exhausted before a terminal outcome is
|
|
15
|
+
* recorded, so a streak of two means the user's own retry failed too. That is
|
|
16
|
+
* the signature of a poisoned context or a provider outage, not a flake.
|
|
17
|
+
*/
|
|
18
|
+
export declare const REPEATED_FAILURE_STREAK_THRESHOLD = 2;
|
|
19
|
+
export declare const REPEATED_FAILURE_LOG_MESSAGE = "[clark:prompt] Conversation failing repeatedly";
|
|
20
|
+
/**
|
|
21
|
+
* Queried as `@event:` by the Datadog monitors in terraform/datadog (both the
|
|
22
|
+
* cloud-prem and SaaS halves of this alert). Their triage links resolve on this
|
|
23
|
+
* name, not on the message above, so the prose stays editable -- renaming this
|
|
24
|
+
* silently breaks them.
|
|
25
|
+
*/
|
|
26
|
+
export declare const REPEATED_FAILURE_LOG_EVENT = "clark.prompt_repeated_failures";
|
|
27
|
+
/** Marks a dedupe key derived from prompt text rather than a request id. */
|
|
28
|
+
export declare const EPHEMERAL_DEDUPE_KEY_PREFIX = "ephemeral:";
|
|
29
|
+
/**
|
|
30
|
+
* Platform failures that make a conversation "stuck" for the user.
|
|
31
|
+
*
|
|
32
|
+
* `outcomes_total` carries every platform reason because a dashboard wants the
|
|
33
|
+
* full rollup; this metric pages, so the bar is higher. Excluded reasons are
|
|
34
|
+
* either not a broken conversation or not ours to fix:
|
|
35
|
+
* - `aborted` / `peer_disconnect`: the client went away mid-stream. The
|
|
36
|
+
* user-initiated flags are best-effort, so these skew toward navigation and
|
|
37
|
+
* network rather than a conversation that cannot make progress.
|
|
38
|
+
* - `service_busy`: contention. Two quick sends while a generation is in flight
|
|
39
|
+
* produce two rejections with nothing broken, and capacity has its own alerts.
|
|
40
|
+
*
|
|
41
|
+
* `unexpected` counts, despite the name reading like a catch-all:
|
|
42
|
+
* `platformReasonFromLlmError` has no case for `auth_error` or
|
|
43
|
+
* `validation_error`, so a Clark-side rejection -- a poisoned context, the
|
|
44
|
+
* incident this alert exists for -- lands here. Advice give-ups (debug-loop
|
|
45
|
+
* exhaustion, missing/expired JWT) also record `unexpected`; those stuck the
|
|
46
|
+
* conversation, so they page with it.
|
|
47
|
+
*
|
|
48
|
+
* `satisfies Record<PlatformPromptFailureReason, boolean>` is the runtime
|
|
49
|
+
* classification: adding a platform reason without a decision here fails to
|
|
50
|
+
* compile, so a mid-incident "add to the ignore list" cannot silently miss
|
|
51
|
+
* a reason that still pages.
|
|
52
|
+
*/
|
|
53
|
+
export declare const STREAK_POLICY: {
|
|
54
|
+
readonly aborted: false;
|
|
55
|
+
readonly api_error: true;
|
|
56
|
+
readonly handler_error: true;
|
|
57
|
+
readonly integration_fetch: true;
|
|
58
|
+
readonly no_output: true;
|
|
59
|
+
readonly peer_disconnect: false;
|
|
60
|
+
readonly rate_limit: true;
|
|
61
|
+
readonly retries_exhausted: true;
|
|
62
|
+
readonly service_busy: false;
|
|
63
|
+
readonly service_dead: true;
|
|
64
|
+
readonly unexpected: true;
|
|
65
|
+
};
|
|
66
|
+
export declare const STREAK_WORTHY_PLATFORM_REASONS: ("aborted" | "no_output" | "rate_limit" | "api_error" | "retries_exhausted" | "handler_error" | "integration_fetch" | "peer_disconnect" | "service_busy" | "service_dead" | "unexpected")[];
|
|
9
67
|
export declare const AWAITING_USER_DISMISS_REASONS: readonly ["cancel", "new_prompt"];
|
|
10
68
|
export type AwaitingUserDismissReason = (typeof AWAITING_USER_DISMISS_REASONS)[number];
|
|
11
69
|
export declare const AWAITING_USER_DISMISS_REASON_TAG = "dismiss_reason";
|
|
@@ -14,6 +72,29 @@ export declare const PROMPT_CORE_MODEL_TAG = "core_model";
|
|
|
14
72
|
export declare const PROMPT_HAD_FALLBACK_TAG = "had_fallback";
|
|
15
73
|
export declare const PROMPT_ORGANIZATION_ID_TAG = "organization_id";
|
|
16
74
|
export declare const PROMPT_SURFACE_TAG = "surface";
|
|
75
|
+
/**
|
|
76
|
+
* Closed set of `usageMetadata.origin` values that decide streak eligibility.
|
|
77
|
+
* Producers (index.ts) and consumers (resolvePromptMetricLabels) must both
|
|
78
|
+
* reference these literals — a rename that only updates one side is a type error
|
|
79
|
+
* once the producer uses the const (ENG-5477 scout review).
|
|
80
|
+
*/
|
|
81
|
+
export declare const CLARK_USAGE_ORIGIN: {
|
|
82
|
+
readonly app_clark_generation: "app_clark_generation";
|
|
83
|
+
readonly app_migration: "app_migration";
|
|
84
|
+
readonly policy_gate: "policy_gate";
|
|
85
|
+
};
|
|
86
|
+
export type ClarkUsageOrigin = (typeof CLARK_USAGE_ORIGIN)[keyof typeof CLARK_USAGE_ORIGIN];
|
|
87
|
+
/**
|
|
88
|
+
* Optional `attempts_total` label distinguishing how a request entered the
|
|
89
|
+
* agent loop. Omitted for ordinary `aiGenerate` so existing untagged series
|
|
90
|
+
* stay the bulk of the metric; set only for server-driven continuations
|
|
91
|
+
* (ENG-5477 scout review).
|
|
92
|
+
*/
|
|
93
|
+
export declare const PROMPT_ATTEMPT_ENTRYPOINT_TAG = "entrypoint";
|
|
94
|
+
export declare const PROMPT_ATTEMPT_ENTRYPOINT: {
|
|
95
|
+
readonly tool_permission_continuation: "tool_permission_continuation";
|
|
96
|
+
};
|
|
97
|
+
export type PromptAttemptEntrypoint = (typeof PROMPT_ATTEMPT_ENTRYPOINT)[keyof typeof PROMPT_ATTEMPT_ENTRYPOINT];
|
|
17
98
|
export declare const METRIC_CREDITS = "superblocks.clark.prompt.credits";
|
|
18
99
|
/**
|
|
19
100
|
* Credit-scale bucket boundaries for credits-per-prompt. Centered on the
|
|
@@ -34,11 +115,16 @@ export declare function resolvePromptMetricLabels(context: {
|
|
|
34
115
|
llmConfig?: {
|
|
35
116
|
coreModel?: string;
|
|
36
117
|
};
|
|
118
|
+
usageMetadata?: {
|
|
119
|
+
origin?: string;
|
|
120
|
+
};
|
|
37
121
|
workflowMetrics?: {
|
|
38
122
|
hadProviderFallback?: boolean;
|
|
39
123
|
};
|
|
40
124
|
surface?: ClarkUsageSurface;
|
|
41
|
-
}): PromptMetricLabels
|
|
125
|
+
}): PromptMetricLabels & {
|
|
126
|
+
streakEligible: boolean;
|
|
127
|
+
};
|
|
42
128
|
export interface PromptRequestMetricIdentity {
|
|
43
129
|
applicationId?: string;
|
|
44
130
|
organizationId?: string;
|
|
@@ -46,6 +132,7 @@ export interface PromptRequestMetricIdentity {
|
|
|
46
132
|
export declare function setPromptRequestMetricIdentity(identity: PromptRequestMetricIdentity): void;
|
|
47
133
|
export declare function recordPromptAttempt(params?: {
|
|
48
134
|
coreModel?: string;
|
|
135
|
+
entrypoint?: PromptAttemptEntrypoint;
|
|
49
136
|
outcomeDedupeKey?: string;
|
|
50
137
|
surface?: ClarkUsageSurface;
|
|
51
138
|
}): void;
|
|
@@ -63,6 +150,13 @@ export declare function recordPromptOutcome(params: {
|
|
|
63
150
|
failure?: PromptFailure;
|
|
64
151
|
hadFallback?: boolean;
|
|
65
152
|
outcome: PromptOutcome;
|
|
153
|
+
promptId?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Opt-in: only a user conversation turn may advance or clear the streak.
|
|
156
|
+
* Omit (or pass false) for background / system-driven outcomes — the default
|
|
157
|
+
* is off so a forgotten call site cannot silently join the pager (ENG-5477).
|
|
158
|
+
*/
|
|
159
|
+
streakEligible?: boolean;
|
|
66
160
|
surface?: ClarkUsageSurface;
|
|
67
161
|
}): void;
|
|
68
162
|
export declare function recordPromptCredits(params: {
|
|
@@ -112,14 +206,22 @@ export declare function recordAwaitingUserPromptOutcome(params: {
|
|
|
112
206
|
advice?: string;
|
|
113
207
|
coreModel?: string;
|
|
114
208
|
countsAsPromptSuccess?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Opt-in: this success ends the turn (knowledge approval) and should reset
|
|
211
|
+
* the conversation failure streak. Mid-turn pauses leave this unset.
|
|
212
|
+
*/
|
|
213
|
+
clearsFailureStreak?: boolean;
|
|
115
214
|
dedupeKey: string | undefined;
|
|
116
215
|
hadFallback?: boolean;
|
|
216
|
+
promptId?: string;
|
|
217
|
+
streakEligible?: boolean;
|
|
117
218
|
}): boolean;
|
|
118
219
|
/** Record attempt + immediate failure for pre-FSM entry rejections (no promptId yet). */
|
|
119
220
|
export declare function recordPromptEntryRejection(params: {
|
|
120
221
|
coreModel?: string;
|
|
121
222
|
dedupeKey: string | undefined;
|
|
122
223
|
failure: PromptFailure;
|
|
224
|
+
promptId?: string;
|
|
123
225
|
surface?: ClarkUsageSurface;
|
|
124
226
|
}): void;
|
|
125
227
|
export declare function _resetPromptRequestMetricsForTesting(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-request-metrics.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/prompt-request-metrics.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt-request-metrics.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/prompt-request-metrics.ts"],"names":[],"mappings":"AAMA,OA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zD,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,MAAM,EAAE,yBAAyB,CAAC;CACnC,GAAG,IAAI,CAQP;AAED,wBAAgB,+BAA+B,CAAC,MAAM,EAAE;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAkCV;AAED,yFAAyF;AACzF,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,GAAG,IAAI,CAaP;AAED,wBAAgB,oCAAoC,IAAI,IAAI,CAE3D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { metrics } from "@opentelemetry/api";
|
|
2
2
|
import { coreModelLabel, usageSurfaceLabel, } from "@superblocksteam/library-shared/types";
|
|
3
|
+
import { getLogger } from "../../../util/logger.js";
|
|
3
4
|
import { AGENT_CANCELED, AGENT_NEEDS_USER_INPUT, APP_RUNTIME_UPDATED_WITHOUT_EDITS, RUNTIME_REVIEW_FINISHED, USER_CANCELED, V3_AGENT_FINISHED, } from "../clark-fsm.js";
|
|
4
5
|
import { promptFailureAttributes, promptFailurePlatform, promptFailureUserCanceled, promptOutcomeTagsFromFailure, PROMPT_OUTCOME_TAG, } from "./prompt-failure.js";
|
|
5
6
|
export const PROMPT_OUTCOMES = ["failure", "success"];
|
|
@@ -10,6 +11,64 @@ const METRIC_ATTEMPTS = "superblocks.clark.prompt.attempts_total";
|
|
|
10
11
|
const METRIC_OUTCOMES = "superblocks.clark.prompt.outcomes_total";
|
|
11
12
|
export const METRIC_AWAITING_USER_DISMISSED = "superblocks.clark.prompt.awaiting_user_dismissed_total";
|
|
12
13
|
export const METRIC_BASE_COMMIT_RESOLUTION_FAILED = "superblocks.clark.prompt.base_commit_resolution_failed_total";
|
|
14
|
+
export const METRIC_REPEATED_FAILURES = "superblocks.clark.prompt.repeated_failures_total";
|
|
15
|
+
/**
|
|
16
|
+
* Consecutive failed turns that make a conversation "stuck" (ENG-5477).
|
|
17
|
+
*
|
|
18
|
+
* Two is deliberate rather than conservative: in-turn provider retries and the
|
|
19
|
+
* post-processing debug loop are already exhausted before a terminal outcome is
|
|
20
|
+
* recorded, so a streak of two means the user's own retry failed too. That is
|
|
21
|
+
* the signature of a poisoned context or a provider outage, not a flake.
|
|
22
|
+
*/
|
|
23
|
+
export const REPEATED_FAILURE_STREAK_THRESHOLD = 2;
|
|
24
|
+
export const REPEATED_FAILURE_LOG_MESSAGE = "[clark:prompt] Conversation failing repeatedly";
|
|
25
|
+
/**
|
|
26
|
+
* Queried as `@event:` by the Datadog monitors in terraform/datadog (both the
|
|
27
|
+
* cloud-prem and SaaS halves of this alert). Their triage links resolve on this
|
|
28
|
+
* name, not on the message above, so the prose stays editable -- renaming this
|
|
29
|
+
* silently breaks them.
|
|
30
|
+
*/
|
|
31
|
+
export const REPEATED_FAILURE_LOG_EVENT = "clark.prompt_repeated_failures";
|
|
32
|
+
/** Marks a dedupe key derived from prompt text rather than a request id. */
|
|
33
|
+
export const EPHEMERAL_DEDUPE_KEY_PREFIX = "ephemeral:";
|
|
34
|
+
/**
|
|
35
|
+
* Platform failures that make a conversation "stuck" for the user.
|
|
36
|
+
*
|
|
37
|
+
* `outcomes_total` carries every platform reason because a dashboard wants the
|
|
38
|
+
* full rollup; this metric pages, so the bar is higher. Excluded reasons are
|
|
39
|
+
* either not a broken conversation or not ours to fix:
|
|
40
|
+
* - `aborted` / `peer_disconnect`: the client went away mid-stream. The
|
|
41
|
+
* user-initiated flags are best-effort, so these skew toward navigation and
|
|
42
|
+
* network rather than a conversation that cannot make progress.
|
|
43
|
+
* - `service_busy`: contention. Two quick sends while a generation is in flight
|
|
44
|
+
* produce two rejections with nothing broken, and capacity has its own alerts.
|
|
45
|
+
*
|
|
46
|
+
* `unexpected` counts, despite the name reading like a catch-all:
|
|
47
|
+
* `platformReasonFromLlmError` has no case for `auth_error` or
|
|
48
|
+
* `validation_error`, so a Clark-side rejection -- a poisoned context, the
|
|
49
|
+
* incident this alert exists for -- lands here. Advice give-ups (debug-loop
|
|
50
|
+
* exhaustion, missing/expired JWT) also record `unexpected`; those stuck the
|
|
51
|
+
* conversation, so they page with it.
|
|
52
|
+
*
|
|
53
|
+
* `satisfies Record<PlatformPromptFailureReason, boolean>` is the runtime
|
|
54
|
+
* classification: adding a platform reason without a decision here fails to
|
|
55
|
+
* compile, so a mid-incident "add to the ignore list" cannot silently miss
|
|
56
|
+
* a reason that still pages.
|
|
57
|
+
*/
|
|
58
|
+
export const STREAK_POLICY = {
|
|
59
|
+
aborted: false,
|
|
60
|
+
api_error: true,
|
|
61
|
+
handler_error: true,
|
|
62
|
+
integration_fetch: true,
|
|
63
|
+
no_output: true,
|
|
64
|
+
peer_disconnect: false,
|
|
65
|
+
rate_limit: true,
|
|
66
|
+
retries_exhausted: true,
|
|
67
|
+
service_busy: false,
|
|
68
|
+
service_dead: true,
|
|
69
|
+
unexpected: true,
|
|
70
|
+
};
|
|
71
|
+
export const STREAK_WORTHY_PLATFORM_REASONS = Object.keys(STREAK_POLICY).filter((reason) => STREAK_POLICY[reason]);
|
|
13
72
|
export const AWAITING_USER_DISMISS_REASONS = ["cancel", "new_prompt"];
|
|
14
73
|
export const AWAITING_USER_DISMISS_REASON_TAG = "dismiss_reason";
|
|
15
74
|
export const PROMPT_APPLICATION_ID_TAG = "application_id";
|
|
@@ -17,6 +76,27 @@ export const PROMPT_CORE_MODEL_TAG = "core_model";
|
|
|
17
76
|
export const PROMPT_HAD_FALLBACK_TAG = "had_fallback";
|
|
18
77
|
export const PROMPT_ORGANIZATION_ID_TAG = "organization_id";
|
|
19
78
|
export const PROMPT_SURFACE_TAG = "surface";
|
|
79
|
+
/**
|
|
80
|
+
* Closed set of `usageMetadata.origin` values that decide streak eligibility.
|
|
81
|
+
* Producers (index.ts) and consumers (resolvePromptMetricLabels) must both
|
|
82
|
+
* reference these literals — a rename that only updates one side is a type error
|
|
83
|
+
* once the producer uses the const (ENG-5477 scout review).
|
|
84
|
+
*/
|
|
85
|
+
export const CLARK_USAGE_ORIGIN = {
|
|
86
|
+
app_clark_generation: "app_clark_generation",
|
|
87
|
+
app_migration: "app_migration",
|
|
88
|
+
policy_gate: "policy_gate",
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Optional `attempts_total` label distinguishing how a request entered the
|
|
92
|
+
* agent loop. Omitted for ordinary `aiGenerate` so existing untagged series
|
|
93
|
+
* stay the bulk of the metric; set only for server-driven continuations
|
|
94
|
+
* (ENG-5477 scout review).
|
|
95
|
+
*/
|
|
96
|
+
export const PROMPT_ATTEMPT_ENTRYPOINT_TAG = "entrypoint";
|
|
97
|
+
export const PROMPT_ATTEMPT_ENTRYPOINT = {
|
|
98
|
+
tool_permission_continuation: "tool_permission_continuation",
|
|
99
|
+
};
|
|
20
100
|
export const METRIC_CREDITS = "superblocks.clark.prompt.credits";
|
|
21
101
|
/**
|
|
22
102
|
* Credit-scale bucket boundaries for credits-per-prompt. Centered on the
|
|
@@ -39,9 +119,14 @@ export const BASE_COMMIT_RESOLUTION_FAILED_SOURCE_TAG = "source";
|
|
|
39
119
|
// chat-store-only one on a dashboard instead of requiring a log dive.
|
|
40
120
|
export const BASE_COMMIT_RESOLUTION_PREFERRED_SOURCE_FAILED_TAG = "preferred_source_failed";
|
|
41
121
|
export function resolvePromptMetricLabels(context) {
|
|
122
|
+
// Opt-in: only an ordinary user conversation turn may page or clear the
|
|
123
|
+
// streak. Background origins stay false so a forgotten call site cannot
|
|
124
|
+
// silently join the pager (ENG-5477 scout review).
|
|
125
|
+
const streakEligible = context.usageMetadata?.origin !== CLARK_USAGE_ORIGIN.app_migration;
|
|
42
126
|
return {
|
|
43
127
|
coreModel: context.llmConfig?.coreModel,
|
|
44
128
|
hadFallback: context.workflowMetrics?.hadProviderFallback ?? false,
|
|
129
|
+
streakEligible,
|
|
45
130
|
surface: context.surface,
|
|
46
131
|
};
|
|
47
132
|
}
|
|
@@ -67,6 +152,53 @@ function promptOutcomeModelAttributes(labels) {
|
|
|
67
152
|
[PROMPT_HAD_FALLBACK_TAG]: labels.hadFallback ? "true" : "false",
|
|
68
153
|
};
|
|
69
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* A user cancel or a paywall stop is the system doing what it was told, so it
|
|
157
|
+
* neither extends a streak nor clears one. Clearing would let an interleaved
|
|
158
|
+
* cancel mask a conversation that fails on every real turn — and a user whose
|
|
159
|
+
* turns keep failing cancels often.
|
|
160
|
+
*
|
|
161
|
+
* A failure with no classification still counts: the origin split for
|
|
162
|
+
* validation errors depends on which layer rejected the request, and locally
|
|
163
|
+
* thrown SDK errors can arrive unclassified, so anything that is not provably
|
|
164
|
+
* user-driven has to count or the alert misses the cases it exists for.
|
|
165
|
+
*/
|
|
166
|
+
function countsTowardFailureStreak(failure) {
|
|
167
|
+
if (!failure) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
switch (failure.origin) {
|
|
171
|
+
// Every provider-side rejection counts, including the `validation_error`
|
|
172
|
+
// that a poisoned context produces on every turn.
|
|
173
|
+
case "llm_provider":
|
|
174
|
+
return true;
|
|
175
|
+
case "platform":
|
|
176
|
+
return STREAK_POLICY[failure.platformReason];
|
|
177
|
+
// Keyed on the `user` discriminant rather than the `user_action` /
|
|
178
|
+
// `user_paywall` telemetry strings: those are a reporting split of this one
|
|
179
|
+
// origin, so a third `user_*` value would have to be excluded here too, and
|
|
180
|
+
// enumerating them would let it start tripping the streak with no type error.
|
|
181
|
+
case "user":
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Dedupe keys are also log fields, and `resolvePromptRequestDedupeKey` falls
|
|
187
|
+
* back to the prompt itself when a request carries no id. Prompts are user
|
|
188
|
+
* content, so the fallback is dropped rather than logged: an unsearchable turn
|
|
189
|
+
* still leaves the counter, origin, and detail to triage from.
|
|
190
|
+
*/
|
|
191
|
+
function requestIdLogAttribute(dedupeKey) {
|
|
192
|
+
return dedupeKey.startsWith(EPHEMERAL_DEDUPE_KEY_PREFIX)
|
|
193
|
+
? {}
|
|
194
|
+
: { request_id: dedupeKey };
|
|
195
|
+
}
|
|
196
|
+
function promptIdLogAttribute(promptId) {
|
|
197
|
+
if (!promptId || promptId.startsWith(EPHEMERAL_DEDUPE_KEY_PREFIX)) {
|
|
198
|
+
return {};
|
|
199
|
+
}
|
|
200
|
+
return { prompt_id: promptId };
|
|
201
|
+
}
|
|
70
202
|
class PromptRequestMetrics {
|
|
71
203
|
cachedMeter;
|
|
72
204
|
cachedInstruments;
|
|
@@ -75,7 +207,40 @@ class PromptRequestMetrics {
|
|
|
75
207
|
recordedAwaitingUserDismissedKeys = new Set();
|
|
76
208
|
recordedCreditsKeys = new Set();
|
|
77
209
|
recordedOutcomeKeys = new Set();
|
|
210
|
+
/**
|
|
211
|
+
* Consecutive failed turns for this process, which is one app+user session.
|
|
212
|
+
* Not strictly per-chat: the process outlives a single chat, and starting a
|
|
213
|
+
* new one is exactly what a user does after a poisoning, so a streak can
|
|
214
|
+
* carry across chats. Any successful turn clears it, so the new chat resets
|
|
215
|
+
* the count as soon as it works; the residual case is a new chat whose first
|
|
216
|
+
* turn also fails, which reports a count spanning two chats and trips one
|
|
217
|
+
* turn early. That is tolerable at a threshold of 2 -- the user really did
|
|
218
|
+
* just fail twice -- and cheaper than threading a chat id down here.
|
|
219
|
+
*
|
|
220
|
+
* Also resets on process restart. That does *not* end the user's session:
|
|
221
|
+
* the editor reconnects behind StablePeer and chat history is server-
|
|
222
|
+
* persisted, so a crash-looping dev-server produces at most one streak-
|
|
223
|
+
* eligible failure per process lifetime and can never reach the threshold.
|
|
224
|
+
* Crash-loop / OOM incidents are therefore invisible to this alert by
|
|
225
|
+
* construction (ENG-5477 / ENG-5702 soak caveat).
|
|
226
|
+
*/
|
|
227
|
+
consecutiveFailures = 0;
|
|
228
|
+
/**
|
|
229
|
+
* Last key that actually advanced the streak. Independent of
|
|
230
|
+
* `recordedOutcomeKeys`: `recordPromptAttempt` forgets the outcome key so a
|
|
231
|
+
* genuine retry can emit a new `outcomes_total` point, but a reconnect of
|
|
232
|
+
* the same request is still one turn and must not page.
|
|
233
|
+
*/
|
|
234
|
+
lastStreakedDedupeKey;
|
|
78
235
|
setIdentity(identity) {
|
|
236
|
+
// A different app or org means a different conversation, so a streak
|
|
237
|
+
// carried over would page against the wrong one. Today one process serves
|
|
238
|
+
// one conversation and this never fires; it keeps that assumption from
|
|
239
|
+
// being load-bearing if a process is ever reused.
|
|
240
|
+
if (this.applicationId !== identity.applicationId ||
|
|
241
|
+
this.organizationId !== identity.organizationId) {
|
|
242
|
+
this.clearFailureStreak();
|
|
243
|
+
}
|
|
79
244
|
this.applicationId = identity.applicationId;
|
|
80
245
|
this.organizationId = identity.organizationId;
|
|
81
246
|
}
|
|
@@ -137,15 +302,23 @@ class PromptRequestMetrics {
|
|
|
137
302
|
description: "Terminal outcomes for user prompt requests in the Clark agent loop.",
|
|
138
303
|
unit: "1",
|
|
139
304
|
}),
|
|
305
|
+
repeatedFailureCounter: meter.createCounter(METRIC_REPEATED_FAILURES, {
|
|
306
|
+
description: "Clark prompt failures on a conversation already at or past REPEATED_FAILURE_STREAK_THRESHOLD consecutive failed turns, excluding user cancels and paywall stops. Deliberately carries only identity plus failure_origin/failure_detail: this is the page-worthy signal, so core_model and had_fallback stay on outcomes_total rather than multiplying series here.",
|
|
307
|
+
unit: "1",
|
|
308
|
+
}),
|
|
140
309
|
};
|
|
141
310
|
return this.cachedInstruments;
|
|
142
311
|
}
|
|
143
312
|
recordAttempt(labels = {}) {
|
|
144
|
-
|
|
313
|
+
const attributes = {
|
|
145
314
|
...this.baseAttributes(),
|
|
146
315
|
...promptCoreModelAttributes(labels),
|
|
147
316
|
...promptSurfaceAttributes(labels),
|
|
148
|
-
}
|
|
317
|
+
};
|
|
318
|
+
if (labels.entrypoint) {
|
|
319
|
+
attributes[PROMPT_ATTEMPT_ENTRYPOINT_TAG] = labels.entrypoint;
|
|
320
|
+
}
|
|
321
|
+
this.getInstruments().attemptCounter.add(1, attributes);
|
|
149
322
|
}
|
|
150
323
|
recordBaseCommitResolutionFailed(params) {
|
|
151
324
|
this.getInstruments().baseCommitResolutionFailedCounter.add(1, {
|
|
@@ -158,6 +331,63 @@ class PromptRequestMetrics {
|
|
|
158
331
|
forgetOutcomeDedupeKey(dedupeKey) {
|
|
159
332
|
this.recordedOutcomeKeys.delete(dedupeKey);
|
|
160
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Clear the streak because the conversation made progress.
|
|
336
|
+
*
|
|
337
|
+
* Deliberately not gated on the outcome dedupe guard: that guard exists to
|
|
338
|
+
* stop one turn being counted twice, and a turn can legitimately report a
|
|
339
|
+
* failure and then a success on the same key (the outcome key survives
|
|
340
|
+
* AwaitingUser -> RuntimeReviewing -> AwaitingUser, since `resetContext` only
|
|
341
|
+
* runs on the Idle path). Skipping the reset there would leave a stale streak
|
|
342
|
+
* that pages on the next single failure.
|
|
343
|
+
*/
|
|
344
|
+
clearFailureStreak() {
|
|
345
|
+
this.consecutiveFailures = 0;
|
|
346
|
+
this.lastStreakedDedupeKey = undefined;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Advance the streak for one failed turn, signaling once it is deep enough to
|
|
350
|
+
* be actionable. `lastStreakedDedupeKey` stops a reconnect of one turn from
|
|
351
|
+
* inflating the streak even after `recordPromptAttempt` forgets the outcome
|
|
352
|
+
* key.
|
|
353
|
+
*/
|
|
354
|
+
advanceFailureStreak(params) {
|
|
355
|
+
if (!countsTowardFailureStreak(params.failure)) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
if (this.lastStreakedDedupeKey === params.dedupeKey) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
this.lastStreakedDedupeKey = params.dedupeKey;
|
|
362
|
+
this.consecutiveFailures += 1;
|
|
363
|
+
if (this.consecutiveFailures < REPEATED_FAILURE_STREAK_THRESHOLD) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
try {
|
|
367
|
+
const failureAttributes = params.failure
|
|
368
|
+
? promptFailureAttributes(params.failure)
|
|
369
|
+
: {};
|
|
370
|
+
this.getInstruments().repeatedFailureCounter.add(1, {
|
|
371
|
+
...this.baseAttributes(),
|
|
372
|
+
...failureAttributes,
|
|
373
|
+
});
|
|
374
|
+
// The counter says how many; on-call still needs which conversation, so
|
|
375
|
+
// pair it with a log carrying the turn ids the metric deliberately omits.
|
|
376
|
+
// `prompt_id` is the Clark UUID; `request_id` is the UI request id used
|
|
377
|
+
// for outcome dedupe. Triage `@prompt_id:` against LLMObs / clark_stream.
|
|
378
|
+
getLogger().warnStructured?.(REPEATED_FAILURE_LOG_MESSAGE, {
|
|
379
|
+
...this.baseAttributes(),
|
|
380
|
+
...failureAttributes,
|
|
381
|
+
consecutive_failures: this.consecutiveFailures,
|
|
382
|
+
event: REPEATED_FAILURE_LOG_EVENT,
|
|
383
|
+
...promptIdLogAttribute(params.promptId),
|
|
384
|
+
...requestIdLogAttribute(params.dedupeKey),
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
catch {
|
|
388
|
+
// Best-effort; generation (including AGENT_CANCELED teardown) must continue.
|
|
389
|
+
}
|
|
390
|
+
}
|
|
161
391
|
recordAwaitingUserDismissed(params) {
|
|
162
392
|
if (this.recordedAwaitingUserDismissedKeys.has(params.dedupeKey)) {
|
|
163
393
|
return;
|
|
@@ -182,6 +412,9 @@ class PromptRequestMetrics {
|
|
|
182
412
|
this.getInstruments().creditsHistogram.record(params.credits, this.creditsAttributes(params.labels));
|
|
183
413
|
}
|
|
184
414
|
recordOutcome(params) {
|
|
415
|
+
if (params.outcome === "success" && params.streakEligible === true) {
|
|
416
|
+
this.clearFailureStreak();
|
|
417
|
+
}
|
|
185
418
|
if (this.recordedOutcomeKeys.has(params.dedupeKey)) {
|
|
186
419
|
return;
|
|
187
420
|
}
|
|
@@ -195,6 +428,13 @@ class PromptRequestMetrics {
|
|
|
195
428
|
Object.assign(attributes, promptFailureAttributes(params.failure));
|
|
196
429
|
}
|
|
197
430
|
this.getInstruments().outcomeCounter.add(1, attributes);
|
|
431
|
+
if (params.outcome === "failure" && params.streakEligible === true) {
|
|
432
|
+
this.advanceFailureStreak({
|
|
433
|
+
dedupeKey: params.dedupeKey,
|
|
434
|
+
failure: params.failure,
|
|
435
|
+
promptId: params.promptId,
|
|
436
|
+
});
|
|
437
|
+
}
|
|
198
438
|
}
|
|
199
439
|
/** One attempt + failure outcome per dedupe key for pre-FSM entry rejections. */
|
|
200
440
|
recordEntryRejection(params) {
|
|
@@ -215,12 +455,19 @@ class PromptRequestMetrics {
|
|
|
215
455
|
outcome: "failure",
|
|
216
456
|
...promptFailureAttributes(params.failure),
|
|
217
457
|
});
|
|
458
|
+
this.advanceFailureStreak({
|
|
459
|
+
dedupeKey: params.dedupeKey,
|
|
460
|
+
failure: params.failure,
|
|
461
|
+
promptId: params.promptId,
|
|
462
|
+
});
|
|
218
463
|
}
|
|
219
464
|
_resetForTesting() {
|
|
220
465
|
this.cachedMeter = undefined;
|
|
221
466
|
this.cachedInstruments = undefined;
|
|
222
467
|
this.applicationId = undefined;
|
|
223
468
|
this.organizationId = undefined;
|
|
469
|
+
this.consecutiveFailures = 0;
|
|
470
|
+
this.lastStreakedDedupeKey = undefined;
|
|
224
471
|
this.recordedAwaitingUserDismissedKeys.clear();
|
|
225
472
|
this.recordedCreditsKeys.clear();
|
|
226
473
|
this.recordedOutcomeKeys.clear();
|
|
@@ -236,6 +483,7 @@ export function recordPromptAttempt(params) {
|
|
|
236
483
|
}
|
|
237
484
|
promptRequestMetrics.recordAttempt({
|
|
238
485
|
coreModel: params?.coreModel,
|
|
486
|
+
entrypoint: params?.entrypoint,
|
|
239
487
|
surface: params?.surface,
|
|
240
488
|
});
|
|
241
489
|
}
|
|
@@ -253,6 +501,8 @@ export function recordPromptOutcome(params) {
|
|
|
253
501
|
dedupeKey: params.dedupeKey,
|
|
254
502
|
outcome: params.outcome,
|
|
255
503
|
failure: params.failure,
|
|
504
|
+
promptId: params.promptId,
|
|
505
|
+
streakEligible: params.streakEligible,
|
|
256
506
|
labels: {
|
|
257
507
|
coreModel: params.coreModel,
|
|
258
508
|
hadFallback: params.hadFallback ?? false,
|
|
@@ -275,7 +525,7 @@ export function recordPromptCredits(params) {
|
|
|
275
525
|
});
|
|
276
526
|
}
|
|
277
527
|
export function resolvePromptRequestDedupeKey(request) {
|
|
278
|
-
return request.requestId ??
|
|
528
|
+
return request.requestId ?? `${EPHEMERAL_DEDUPE_KEY_PREFIX}${request.prompt}`;
|
|
279
529
|
}
|
|
280
530
|
/**
|
|
281
531
|
* Tags for the Clark root span when a prompt cycle ends via a terminal FSM
|
|
@@ -343,12 +593,21 @@ export function recordAwaitingUserPromptOutcome(params) {
|
|
|
343
593
|
const outcomeLabels = {
|
|
344
594
|
coreModel: params.coreModel,
|
|
345
595
|
hadFallback: params.hadFallback ?? false,
|
|
596
|
+
promptId: params.promptId,
|
|
597
|
+
streakEligible: params.streakEligible,
|
|
346
598
|
};
|
|
347
599
|
if (params.countsAsPromptSuccess) {
|
|
348
600
|
recordPromptOutcome({
|
|
349
601
|
dedupeKey: params.dedupeKey,
|
|
350
602
|
outcome: "success",
|
|
351
603
|
...outcomeLabels,
|
|
604
|
+
// A mid-turn pause is not the conversation recovering — Clark stopped to
|
|
605
|
+
// ask the user something (plan approval, tool permission). Clearing the
|
|
606
|
+
// streak here would zero a real failure streak that a later failure must
|
|
607
|
+
// still see (ENG-5477 review). Terminal handoffs (knowledge approval)
|
|
608
|
+
// pass clearsFailureStreak so a completed user action can reset it.
|
|
609
|
+
// Must follow the spread so it wins.
|
|
610
|
+
streakEligible: params.clearsFailureStreak === true,
|
|
352
611
|
});
|
|
353
612
|
return true;
|
|
354
613
|
}
|
|
@@ -370,6 +629,7 @@ export function recordPromptEntryRejection(params) {
|
|
|
370
629
|
promptRequestMetrics.recordEntryRejection({
|
|
371
630
|
dedupeKey: params.dedupeKey,
|
|
372
631
|
failure: params.failure,
|
|
632
|
+
promptId: params.promptId,
|
|
373
633
|
labels: {
|
|
374
634
|
coreModel: params.coreModel,
|
|
375
635
|
surface: params.surface,
|