Skip to content

Commit 0c60c8a

Browse files
author
ben
authored
feat(den): one Settings › Diagnostics page for cloud and self-hosted (#6252)
Merge Settings › Services into Settings › Diagnostics with sections for desktop app startups, AI providers, connectors, installation services and the network check. Each section is shown or locked for the viewer; the installation section is for self-hosted installation administrators only. - GET /v1/org/diagnostics (?strict=1 for smoke tests) and POST /check; sessions and org API keys, including an installation admin's key. - Desktop app reports one startup per launch (window, engine, signed in, org tools) to POST /v1/diagnostics/desktop-startup; failed launches are kept and sent after the next connection. New desktop_startup_report table. - AI providers are checked against their endpoints by listing models with the organization credential; no prompt is ever sent. - Slack assistant and Resumable answers are no longer deployment services (they could never be verified); Slack is checked per organization and resume settings are a headless runner detail. - Email is verified by SMTP sign-in or the Resend key and sender domain, without sending a message. Every check records its duration; the answering Den reports its version, start time and startup duration. - Remove the serviceReadiness feature flag.
1 parent 9f0c6b2 commit 0c60c8a

127 files changed

Lines changed: 30519 additions & 2068 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci-tests.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
pnpm --filter @openwork-ee/headless-runner test:service-health
109109
pnpm --filter @openwork-ee/workbot test:service-readiness
110110
# Den web does not install tsx in CI; keep its JSX config with the API-owned loader.
111-
TSX_TSCONFIG_PATH=../den-web/tsconfig.json pnpm --filter @openwork-ee/den-api exec node --conditions=development --import tsx --test '../den-web/components/admin/services/*.test.ts' '../den-web/components/admin/services/*.test.tsx' '../den-web/components/services/*.test.ts' '../den-web/app/(den)/dashboard/_lib/deployment-services-access.test.ts' '../den-web/app/(den)/_lib/service-readiness.test.ts'
111+
TSX_TSCONFIG_PATH=../den-web/tsconfig.json pnpm --filter @openwork-ee/den-api exec node --conditions=development --import tsx --test '../den-web/components/diagnostics/*.test.ts' '../den-web/components/diagnostics/*.test.tsx' '../den-web/components/admin/services/*.test.ts' '../den-web/components/services/*.test.tsx' '../den-web/app/(den)/dashboard/_lib/diagnostics-access.test.ts' '../den-web/app/(den)/_lib/service-readiness.test.ts'
112112
bun test apps/app/tests/deployment-service-readiness.test.ts
113113
- name: Boot the app provider tree
114114
run: pnpm test:boot

‎apps/app/src/app/lib/den.ts‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
AUTOMATION_MODEL_ATTENTION_CAPABILITY_HEADER,
99
} from "@openwork/types/automations";
1010
import type { GatewayProviderSummary } from "@openwork/types/den/gateway";
11+
import type { DesktopStartupReport } from "@openwork/types/den/diagnostics";
1112
import {
1213
parseModelRemovalInventory,
1314
type ModelRemovalInventory,
@@ -2802,6 +2803,8 @@ type DenRequestOptions = {
28022803
automationModelAttentionCapable?: boolean;
28032804
/** Cancels the request, e.g. a waiting status call when the window hides. */
28042805
signal?: AbortSignal;
2806+
/** Leave the request out of connection diagnostics: its failure is not a connection problem. */
2807+
unobserved?: boolean;
28052808
};
28062809

28072810
async function fetchWithTimeout(fetchImpl: FetchLike, url: string, init: RequestInit, timeoutMs: number, onTimeout?: () => void) {
@@ -2862,7 +2865,7 @@ async function requestJsonRaw<T>(
28622865
headers["Content-Type"] = "application/json";
28632866
}
28642867

2865-
return observeDenRequest(async (onTimeout) => {
2868+
const send = async (onTimeout?: () => void): Promise<RawJsonResponse<T>> => {
28662869
const response = await fetchWithTimeout(
28672870
resolveFetch(url),
28682871
url,
@@ -2886,7 +2889,8 @@ async function requestJsonRaw<T>(
28862889
json = null;
28872890
}
28882891
return { ok: response.ok, status: response.status, json };
2889-
});
2892+
};
2893+
return options.unobserved ? send() : observeDenRequest(send);
28902894
}
28912895

28922896
async function requestJson<T>(
@@ -3020,6 +3024,27 @@ export function createDenClient(options: {
30203024
return user;
30213025
},
30223026

3027+
/**
3028+
* Sends this launch's startup report (one per launch, idempotent by
3029+
* attemptId) and resolves to the HTTP status. Rejects when the request
3030+
* does not complete. Telemetry: never retried here and never recorded as
3031+
* a connection failure.
3032+
*/
3033+
async reportDesktopStartup(
3034+
report: DesktopStartupReport,
3035+
options: { organizationId?: string | null; timeoutMs?: number } = {},
3036+
): Promise<number> {
3037+
const response = await requestJsonRaw<unknown>(baseUrls, "/v1/diagnostics/desktop-startup", {
3038+
method: "POST",
3039+
token,
3040+
body: report,
3041+
organizationId: options.organizationId ?? null,
3042+
timeoutMs: options.timeoutMs,
3043+
unobserved: true,
3044+
});
3045+
return response.status;
3046+
},
3047+
30233048
async getAppVersionMetadata(): Promise<DenAppVersionMetadata> {
30243049
const payload = await requestJson<unknown>(baseUrls, "/v1/app-version", {
30253050
method: "GET",

‎apps/app/src/app/lib/desktop-types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export type {
2323
DesktopBinaryDownloadResult,
2424
DesktopFetchInit,
2525
DesktopFetchResult,
26+
DesktopStartupTimings,
2627
EngineDoctorResult,
2728
EngineInfo,
2829
EvalRelaunchResult,

‎apps/app/src/app/lib/desktop.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type {
1212
OpencodeCommandDraft,
1313
WorkspaceOpenworkConfig,
1414
AppBuildInfo,
15+
DesktopStartupTimings,
1516
DesktopDistributionInfo,
1617
BrandIconApplyResult,
1718
BrandIconState,
@@ -643,6 +644,7 @@ const {
643644
engineStop,
644645
engineRestart,
645646
appBuildInfo,
647+
startupTimings,
646648
getDesktopBootstrapConfig,
647649
debugDesktopBootstrapConfig,
648650
clearDesktopBootstrapConfig,
@@ -683,6 +685,7 @@ export {
683685
engineStop,
684686
engineRestart,
685687
appBuildInfo,
688+
startupTimings,
686689
getDesktopBootstrapConfig,
687690
debugDesktopBootstrapConfig,
688691
clearDesktopBootstrapConfig,

0 commit comments

Comments
 (0)