feat: UI parser kinds, nodeSelector textarea, step-limit session clear, per-line path redaction
- ui-parser: add thinking kind + handler for standalone thinking events, thinking blocks in assistant content arrays, and user-turn tool_result blocks - job-manifest: parseKeyValueOrObject helper so nodeSelector (and labels) accept key=value textarea lines in addition to JSON objects - parse: isOpenCodeStepLimitResult detects step_finish with max_turns / max_steps / step_limit reason - execute: return clearSession:true when step limit reached so next run starts fresh; redactHomePathUserSegments moved to per-line to prevent paths split across chunks - tests: ui-parser.test.ts (new), extended parse.test.ts and job-manifest.test.ts Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { parseOpenCodeJsonl, isOpenCodeUnknownSessionError } from "./parse.js";
|
||||
import { parseOpenCodeJsonl, isOpenCodeUnknownSessionError, isOpenCodeStepLimitResult } from "./parse.js";
|
||||
|
||||
describe("parseOpenCodeJsonl", () => {
|
||||
it("parses text messages", () => {
|
||||
@@ -119,6 +119,37 @@ describe("parseOpenCodeJsonl", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("isOpenCodeStepLimitResult", () => {
|
||||
it("returns true for step_finish with reason max_turns", () => {
|
||||
const stdout = JSON.stringify({ type: "step_finish", part: { reason: "max_turns", tokens: {} } });
|
||||
expect(isOpenCodeStepLimitResult(stdout)).toBe(true);
|
||||
});
|
||||
|
||||
it("returns true for step_finish with reason max_steps", () => {
|
||||
const stdout = JSON.stringify({ type: "step_finish", part: { reason: "max_steps", tokens: {} } });
|
||||
expect(isOpenCodeStepLimitResult(stdout)).toBe(true);
|
||||
});
|
||||
|
||||
it("returns true for step_finish with reason step_limit", () => {
|
||||
const stdout = JSON.stringify({ type: "step_finish", part: { reason: "step_limit", tokens: {} } });
|
||||
expect(isOpenCodeStepLimitResult(stdout)).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false for step_finish with reason end_turn", () => {
|
||||
const stdout = JSON.stringify({ type: "step_finish", part: { reason: "end_turn", tokens: {} } });
|
||||
expect(isOpenCodeStepLimitResult(stdout)).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false with no step_finish events", () => {
|
||||
const stdout = JSON.stringify({ type: "text", part: { text: "Hello" } });
|
||||
expect(isOpenCodeStepLimitResult(stdout)).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false for empty stdout", () => {
|
||||
expect(isOpenCodeStepLimitResult("")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isOpenCodeUnknownSessionError", () => {
|
||||
it("detects 'unknown session' in stdout", () => {
|
||||
const stdout = "Error: unknown session";
|
||||
|
||||
Reference in New Issue
Block a user