fix: resolve 25 pre-publish blockers

- postinstall.mjs: fix alias package detection
- migrate-legacy-plugin-entry: dedupe + regression tests
- task_system: default consistency across runtime paths
- task() contract: consistent tool behavior
- runtime model selection, tool cap, stale-task cancellation
- recovery sanitization, context-limit gating
- Ralph semantic DONE hardening, Atlas fallback persistence
- native-skill description/content, skill path traversal guard
- publish workflow: platform awaited via reusable workflow job
- release: version edits reapplied before commit/tag
- JSONC plugin migration: top-level plugin key safety
- cold-cache: user fallback models skip disconnected providers
- docs/version/release framing updates

Verified: bun test (4599 pass), tsc --noEmit clean, bun run build clean
This commit is contained in:
YeonGyu-Kim
2026-03-28 15:24:18 +09:00
parent 44b039bef6
commit d2c576c510
62 changed files with 1264 additions and 292 deletions
@@ -186,7 +186,7 @@ describe("detectCompletionInSessionMessages", () => {
})
describe("#given semantic completion patterns", () => {
test("#when agent says 'task is complete' #then should detect semantic completion", async () => {
test("#when agent says 'task is complete' without explicit promise #then should NOT detect completion", async () => {
// #given
const messages: SessionMessage[] = [
{
@@ -205,10 +205,10 @@ describe("detectCompletionInSessionMessages", () => {
})
// #then
expect(detected).toBe(true)
expect(detected).toBe(false)
})
test("#when agent says 'all items are done' #then should detect semantic completion", async () => {
test("#when agent says 'all items are done' without explicit promise #then should NOT detect completion", async () => {
// #given
const messages: SessionMessage[] = [
{
@@ -227,10 +227,10 @@ describe("detectCompletionInSessionMessages", () => {
})
// #then
expect(detected).toBe(true)
expect(detected).toBe(false)
})
test("#when agent says 'nothing left to do' #then should detect semantic completion", async () => {
test("#when agent says 'nothing left to do' without explicit promise #then should NOT detect completion", async () => {
// #given
const messages: SessionMessage[] = [
{
@@ -249,10 +249,10 @@ describe("detectCompletionInSessionMessages", () => {
})
// #then
expect(detected).toBe(true)
expect(detected).toBe(false)
})
test("#when agent says 'successfully completed all' #then should detect semantic completion", async () => {
test("#when agent says 'successfully completed all' without explicit promise #then should NOT detect completion", async () => {
// #given
const messages: SessionMessage[] = [
{
@@ -271,7 +271,7 @@ describe("detectCompletionInSessionMessages", () => {
})
// #then
expect(detected).toBe(true)
expect(detected).toBe(false)
})
test("#when promise is VERIFIED #then semantic completion should NOT trigger", async () => {
@@ -295,6 +295,75 @@ describe("detectCompletionInSessionMessages", () => {
// #then
expect(detected).toBe(false)
})
test("#when completion text appears inside a quote #then should NOT detect completion", async () => {
// #given
const messages: SessionMessage[] = [
{
info: { role: "assistant" },
parts: [{ type: "text", text: 'The user wrote: "the task is complete". I am still working.' }],
},
]
const ctx = createPluginInput(messages)
// #when
const detected = await detectCompletionInSessionMessages(ctx, {
sessionID: "session-quoted",
promise: "DONE",
apiTimeoutMs: 1000,
directory: "/tmp",
})
// #then
expect(detected).toBe(false)
})
test("#when tool_result says all items are complete #then should NOT detect completion", async () => {
// #given
const messages: SessionMessage[] = [
{
info: { role: "assistant" },
parts: [
{ type: "tool_result", text: "Background agent report: all items are complete." },
{ type: "text", text: "Still validating the final behavior." },
],
},
]
const ctx = createPluginInput(messages)
// #when
const detected = await detectCompletionInSessionMessages(ctx, {
sessionID: "session-tool-result-semantic",
promise: "DONE",
apiTimeoutMs: 1000,
directory: "/tmp",
})
// #then
expect(detected).toBe(false)
})
test("#when assistant says complete but not actually done #then should NOT detect completion", async () => {
// #given
const messages: SessionMessage[] = [
{
info: { role: "assistant" },
parts: [{ type: "text", text: "The implementation looks complete, but I still need to run the tests." }],
},
]
const ctx = createPluginInput(messages)
// #when
const detected = await detectCompletionInSessionMessages(ctx, {
sessionID: "session-not-actually-done",
promise: "DONE",
apiTimeoutMs: 1000,
directory: "/tmp",
})
// #then
expect(detected).toBe(false)
})
})
})
@@ -39,6 +39,8 @@ const SEMANTIC_COMPLETION_PATTERNS = [
/\bnothing\s+(?:left|more|remaining)\s+to\s+(?:do|implement|fix)\b/i,
]
const SEMANTIC_DONE_FALLBACK_ENABLED = false
export function detectSemanticCompletion(text: string): boolean {
return SEMANTIC_COMPLETION_PATTERNS.some((pattern) => pattern.test(text))
}
@@ -65,9 +67,8 @@ export function detectCompletionInTranscript(
const entryText = extractTranscriptEntryText(entry)
if (!entryText) continue
if (pattern.test(entryText)) return true
// Fallback: semantic completion only for DONE promise and assistant entries
const isAssistantEntry = entry.type === "assistant" || entry.type === "text"
if (promise === "DONE" && isAssistantEntry && detectSemanticCompletion(entryText)) {
if (SEMANTIC_DONE_FALLBACK_ENABLED && promise === "DONE" && isAssistantEntry && detectSemanticCompletion(entryText)) {
log("[ralph-loop] WARNING: Semantic completion detected in transcript (agent used natural language instead of <promise>DONE</promise>)")
return true
}
@@ -135,8 +136,7 @@ export async function detectCompletionInSessionMessages(
return true
}
// Fallback: semantic completion only for DONE promise
if (options.promise === "DONE" && detectSemanticCompletion(responseText)) {
if (SEMANTIC_DONE_FALLBACK_ENABLED && options.promise === "DONE" && detectSemanticCompletion(responseText)) {
log("[ralph-loop] WARNING: Semantic completion detected (agent used natural language instead of <promise>DONE</promise>)", {
sessionID: options.sessionID,
})