fix: skills not bundled and resumeLastSession ignored (FAR-56, FAR-57)

Two bugs prevented skill content from reaching K8s Job prompts, and
resumeLastSession: false was silently ignored.

Skills fix (execute.ts, FAR-57):
- Add /paperclip/.claude/skills as additional candidate to
  readPaperclipRuntimeSkillEntries — the relative candidates in
  adapter-utils don't resolve to the PVC-mounted skills home
- Read entry.source/SKILL.md instead of entry.source (which is a
  directory path); fall back to source directly for file-based entries
- Mock readPaperclipRuntimeSkillEntries in execute.test.ts to prevent
  real SKILL.md reads from delaying fake-timer registration

Session fix (job-manifest.ts, FAR-56):
- Gate --session flag on asBoolean(config.resumeLastSession, true)
  so setting resumeLastSession: false actually stops session resumption
- Default true preserves existing behaviour for agents without config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 10:11:47 +00:00
parent 0e94e84e2c
commit 2bd8107f1d
4 changed files with 24 additions and 4 deletions
+13 -2
View File
@@ -2,6 +2,7 @@ import type { AdapterExecutionContext, AdapterExecutionResult } from "@paperclip
import { inferOpenAiCompatibleBiller, redactHomePathUserSegments } from "@paperclipai/adapter-utils";
import { asString, asNumber, asBoolean, parseObject, readPaperclipRuntimeSkillEntries, resolvePaperclipDesiredSkillNames } from "@paperclipai/adapter-utils/server-utils";
import { readFile } from "node:fs/promises";
import path from "node:path";
import {
parseOpenCodeJsonl,
isOpenCodeUnknownSessionError,
@@ -928,14 +929,24 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
let skillsBundleContent = "";
try {
const moduleDir = import.meta.dirname;
const availableEntries = await readPaperclipRuntimeSkillEntries(config, moduleDir);
// Add the standard Paperclip skills dir as an additional candidate — the relative
// candidates in adapter-utils don't resolve to the PVC-mounted skills home.
const paperclipSkillsHome = "/paperclip/.claude/skills";
const availableEntries = await readPaperclipRuntimeSkillEntries(config, moduleDir, [paperclipSkillsHome]);
const desiredSkillKeys = resolvePaperclipDesiredSkillNames(config, availableEntries);
const skillTexts: string[] = [];
for (const key of desiredSkillKeys) {
const entry = availableEntries.find((e) => e.key === key);
if (entry?.source) {
try {
const text = (await readFile(entry.source, "utf-8")).trim();
// entry.source from listPaperclipSkillEntries is a directory; read SKILL.md from it.
// Fall back to reading entry.source directly for file-based paperclipRuntimeSkills entries.
let text: string;
try {
text = (await readFile(path.join(entry.source, "SKILL.md"), "utf-8")).trim();
} catch {
text = (await readFile(entry.source, "utf-8")).trim();
}
if (text) skillTexts.push(text);
} catch {
// skip unreadable skill files — non-fatal