fix(skills): pull upstream skill runtime resolution to stop event-loop starvation
Build: Production / build (push) Failing after 12m39s
Build: Production / build (push) Failing after 12m39s
The fork's listRuntimeSkillEntries rematerialized every skill's files from the DB on every heartbeat run dispatch — fs.rm + fs.mkdir + per-file readFile/writeFile, sequentially per skill. With 24 configured skills and 5 concurrent agents, this saturated the Node event loop badly enough that executeRun continuations couldn't reach activeRunExecutions.add() within the orphan-reaper's 5-min threshold, causing reaper to false-positive runs as "process_lost". Upstream's listRuntimeSkillEntries calls resolveRuntimeSkillSource, which checks if the materialized directory already exists on disk and short- circuits when it does. Fixes the symptom at the root. Replaces these files with upstream/master content: - server/src/services/company-skills.ts - server/src/services/heartbeat.ts - server/src/services/workspace-runtime.ts - server/src/services/company-portability.ts - server/src/routes/company-skills.ts - server/src/routes/agents.ts - packages/adapter-utils/src/server-utils.ts Pulls in supporting upstream files: - server/src/services/catalog-provenance.ts - server/src/services/skills-catalog.ts - server/src/services/github-fetch.ts - server/src/services/portable-path.ts - packages/skills-catalog/ (new package) - packages/db document_annotation_* schema + migration 0091 - packages/shared document-annotation types/validators Drops fork features (to be re-evaluated later): - Gitea/Forgejo git skill sources (server/src/services/git-source.ts deleted) - PAT support for private skill repos - Fork-specific secret-export portability extensions Adds agentId: null to acquireRunLease test-probe call in routes/agents.ts to satisfy the fork's environment-runtime agentId requirement (kept). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
import { z } from "zod";
|
||||
import {
|
||||
DOCUMENT_ANNOTATION_ANCHOR_CONFIDENCES,
|
||||
DOCUMENT_ANNOTATION_ANCHOR_STATES,
|
||||
DOCUMENT_ANNOTATION_THREAD_STATUSES,
|
||||
} from "../constants.js";
|
||||
import { multilineTextSchema } from "./text.js";
|
||||
|
||||
export const documentAnnotationThreadStatusSchema = z.enum(DOCUMENT_ANNOTATION_THREAD_STATUSES);
|
||||
export const documentAnnotationAnchorStateSchema = z.enum(DOCUMENT_ANNOTATION_ANCHOR_STATES);
|
||||
export const documentAnnotationAnchorConfidenceSchema = z.enum(DOCUMENT_ANNOTATION_ANCHOR_CONFIDENCES);
|
||||
|
||||
export const documentAnnotationTextQuoteSelectorSchema = z.object({
|
||||
exact: z.string().min(1).max(10_000),
|
||||
prefix: z.string().max(1_000).default(""),
|
||||
suffix: z.string().max(1_000).default(""),
|
||||
}).strict();
|
||||
|
||||
export const documentAnnotationTextPositionSelectorSchema = z.object({
|
||||
normalizedStart: z.number().int().nonnegative(),
|
||||
normalizedEnd: z.number().int().nonnegative(),
|
||||
markdownStart: z.number().int().nonnegative(),
|
||||
markdownEnd: z.number().int().nonnegative(),
|
||||
}).strict().superRefine((value, ctx) => {
|
||||
if (value.normalizedEnd <= value.normalizedStart) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "normalizedEnd must be greater than normalizedStart",
|
||||
path: ["normalizedEnd"],
|
||||
});
|
||||
}
|
||||
if (value.markdownEnd <= value.markdownStart) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: "markdownEnd must be greater than markdownStart",
|
||||
path: ["markdownEnd"],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const documentAnnotationAnchorSelectorSchema = z.object({
|
||||
quote: documentAnnotationTextQuoteSelectorSchema,
|
||||
position: documentAnnotationTextPositionSelectorSchema,
|
||||
}).strict();
|
||||
|
||||
export const createDocumentAnnotationThreadSchema = z.object({
|
||||
baseRevisionId: z.string().uuid(),
|
||||
baseRevisionNumber: z.number().int().positive(),
|
||||
selector: documentAnnotationAnchorSelectorSchema,
|
||||
body: multilineTextSchema.pipe(z.string().min(1).max(20_000)),
|
||||
}).strict();
|
||||
|
||||
export const createDocumentAnnotationCommentSchema = z.object({
|
||||
body: multilineTextSchema.pipe(z.string().min(1).max(20_000)),
|
||||
}).strict();
|
||||
|
||||
export const updateDocumentAnnotationThreadSchema = z.object({
|
||||
status: documentAnnotationThreadStatusSchema.optional(),
|
||||
}).strict().refine((value) => value.status != null, {
|
||||
message: "At least one field must be provided",
|
||||
});
|
||||
|
||||
export type CreateDocumentAnnotationThread = z.infer<typeof createDocumentAnnotationThreadSchema>;
|
||||
export type CreateDocumentAnnotationComment = z.infer<typeof createDocumentAnnotationCommentSchema>;
|
||||
export type UpdateDocumentAnnotationThread = z.infer<typeof updateDocumentAnnotationThreadSchema>;
|
||||
Reference in New Issue
Block a user