mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-08 01:57:31 +01:00
## Thinking Path > - Paperclip manages agent work and human decisions. > - Onboarding can approve a plan, a hire, and an execution step in separate turns. > - Tests covered single approvals more closely than that full history. > - The repaired gate must retain valid plan approval through later decisions. > - Every consumer must recognize the saved confirmation kind and selected scope. > - This change tests that contract and registers a complete interview-to-execution journey. ## Linked Issues or Issue Description Refs #19043, #17914, #18283. The earlier tests admitted one accepted proposal at a time. Decomposition fixtures used standard confirmations. The direct-task E2E path forbids hiring. Those cases did not cover an accepted checkbox plan followed by hiring and a separate untargeted execution approval. ## What Changed - Add eight PostgreSQL contract cases for standard and checkbox plan approvals. Native tools create the cards. An authenticated human accepts them through HTTP. A later native run reads the approved revision and actual selected scope. - Exercise native task creation, generic REST creation, child REST creation, and accepted-plan decomposition. Check the assigned child and one creation audit event. Check durable replay on the three entry points that support it. A pending execution confirmation still prevents creation. - Register the explicit-only `onboarding-approval-history` suite for local native Codex and ACPX Claude. The browser chooses the interview, selects only drafting in the saved plan, approves one writer hire, and approves a separate Start drafting confirmation. The model must hire the writer and use that writer's own child execution to save the welcome document. - Grade each human decision, the unchanged plan revision and selection, approval timing, one assigned child and worker execution, the exact writer-authored saved revision, no pending requests, and persistence after reload. Calibrate the oracle against missing, forged, premature, duplicate, and changed outcomes. - Preserve synthetic option choices, document/run bindings, and saved revision authorship in the existing public first-task evidence projection. Keep private provider/account data excluded. Document the workflow, evidence, billing, and cleanup bounds. - Align the approval-history fixture with its completion oracle: the onboarding parent must be Done. Test both native profiles against graded completion evidence and reject a completed child whose parent remains In review. Count parent heartbeats separately from the writer: accept one to seven parent records while retaining the twelve-company-run cap and the independent three-approval/one-writer oracle. - Retain the existing 52-cell first-task suite. The new suite has one attempt, seven expected work turns, a twelve-run maximum, a fifteen-minute deadline, and the existing $5 company task budget. It is excluded from `--all`. - Update two stale cleanup assertions to include the existing thirty-second deletion timeout. ## Verification - Red control: temporarily restore the pre-fix admission module and run the new checkbox/native history case. It fails with the expected `First-task proposal requires human acceptance` error after plan, hiring, and execution acceptance. Restore the repaired module after the probe. - The final post-rebase history matrix and existing onboarding safety suite passed together: 74 tests, no skips. - Final focused Runner E2E support passed: 413 Vitest tests and all 370 Node support checks. This covers catalog discovery, journey controls, wrong-outcome calibration, public evidence, and existing first-task behavior. - Review controls: four authorship cases fail before the revision check. A delayed browser-response control fails before the approval-time fix. Both pass after repair. The final oracle requires the exact current document revision, writer ID, native child run ID, matching body, and readback after reload. - Credential-free discovery lists both new native cells. No provider call was made. `OPENAI_API_KEY` and `ANTHROPIC_API_KEY` are absent, so the real provider journey remains unqualified. - The earlier broad credential-free E2E support run reported 6,728 passing cases, three skipped cases, and nine failures in three unrelated files. All nine reproduce with the changed E2E source restored to the unchanged baseline: three expired overhead-fixture cases, one stale Pi profile-version assertion, and five workflow security assertions. This change does not alter those files, paid workflow policy, or provider pins. - Previous full workspace typecheck/build and [Linux CI](https://github.com/paperclipai/paperclip/actions/runs/41921754638) passed on `4f431f5aae99d072cc75027e90d7b847b4c342ca`, including the new eight-case PostgreSQL file. Ponytail subsequently found a fixture/oracle terminal-status mismatch. Both native-cell controls fail on that fixture (`done` observed versus `in_review` expected), while the parent-in-review negative control passes. A second comparison uses the actual `matchesRunCount` predicate: graded evidence with six parent runs and one writer run fails the old exact-seven-parent requirement. Both fixes pass these controls, all 413 focused support tests, all 370 Node checks, and the owning E2E project typecheck. [Fresh CI](https://github.com/paperclipai/paperclip/actions/runs/41936699686) passed on `91c980b110252da451b92eda597c168517de1276`: 48 successful jobs and one expected skip. Greptile reviewed this head at 5/5 with no unresolved findings. Ponytail's terminal-status finding is fixed and its thread is resolved; its current-head re-review remains queued. Live provider cells remain unqualified. ## Risks The production API and approval gate are unchanged. The new paid journey can expose model or product failures at an intermediate approval boundary. It retains those failures and uses the existing diagnostics and cleanup. Registration and deterministic tests do not establish a live provider pass. The unrelated baseline support failures remain explicit. ## Model Used OpenAI GPT-6 through Codex, with reasoning, repository tools, and code execution. The exact serving model ID and context-window size are not exposed in this session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass (focused tests; unrelated baseline failures are recorded above) - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
94 lines
4.5 KiB
TypeScript
94 lines
4.5 KiB
TypeScript
import type { RunnerTaskFixture } from "./types.js";
|
|
import { APPROVAL_HISTORY_CASE, approvalHistoryFacts } from "./first-task-approval-history.js";
|
|
|
|
export const FIRST_TASK_CASES = [
|
|
["interview-first-response", "Interview: first response", "interview", 1],
|
|
["clear-task-first-response", "Clear task: first response", "task", 1],
|
|
[
|
|
"ambiguous-task-first-response",
|
|
"Ambiguous task: first response",
|
|
"ambiguous",
|
|
1,
|
|
],
|
|
[
|
|
"plain-message-first-response",
|
|
"Opening card replaced by a message",
|
|
"message",
|
|
1,
|
|
],
|
|
["plan-first-response", "Explicit plan: first response", "plan", 1],
|
|
[
|
|
"ordinary-task-control",
|
|
"Other tasks do not inherit onboarding policy",
|
|
"ordinary",
|
|
1,
|
|
],
|
|
["interview-plan-accept", "Interview, plan, and acceptance", "interview", 3],
|
|
["task-card-accept", "Subtask accepted through a card", "task", 3],
|
|
["accept-while-running", "Accept a proposal while its agent is still running", "task", 3],
|
|
["task-reply-accept", "Subtask accepted in conversation", "task", 3],
|
|
[
|
|
"clarify-propose-accept",
|
|
"Clarification, proposal, and acceptance",
|
|
"ambiguous",
|
|
4,
|
|
],
|
|
["revise-accept", "Revise scope before accepting", "task", 4],
|
|
["reject-no-execution", "Decline proposed work", "task", 2],
|
|
] as const;
|
|
const approvalHistoryCase = [APPROVAL_HISTORY_CASE, "Interview, plan scope, hiring, and execution approval", "interview", 7] as const;
|
|
export type FirstTaskCaseId = (typeof FIRST_TASK_CASES)[number][0] | typeof APPROVAL_HISTORY_CASE;
|
|
export type FirstTaskOpening = (typeof FIRST_TASK_CASES)[number][2];
|
|
export const firstTaskMarker = (nonce: string) =>
|
|
`GARDEN${nonce.replace(/[^a-z0-9]/gi, "")}`;
|
|
export function firstTaskScenario(id: string, nonce: string) {
|
|
const entry = FIRST_TASK_CASES.find((row) => row[0] === id) ?? (id === APPROVAL_HISTORY_CASE ? approvalHistoryCase : undefined);
|
|
if (!entry) throw new Error(`Unknown first-task case ${id}`);
|
|
const marker = firstTaskMarker(nonce);
|
|
const originalMarker = id === "revise-accept" ? `DRAFT${marker}` : marker;
|
|
const task = `I need a two-sentence welcome note for our neighborhood garden club. It should invite beginners to our free Saturday meetup and include the phrase ${originalMarker}. Save the finished note as a document attached to the task.`;
|
|
const facts = `We run a neighborhood garden club for beginners. Our first goal is a two-sentence welcome note inviting people to our free Saturday meetup. We have no budget and need no outside tools. Done means the note is saved as a task document and includes ${marker}.`;
|
|
return {
|
|
id: entry[0],
|
|
opening: entry[2],
|
|
marker,
|
|
originalMarker,
|
|
facts: id === APPROVAL_HISTORY_CASE ? approvalHistoryFacts(marker) : facts,
|
|
firstResponseOnly:
|
|
id.endsWith("first-response") || id === "ordinary-task-control",
|
|
prompt:
|
|
entry[2] === "ambiguous"
|
|
? "Help me get my organization going."
|
|
: entry[2] === "plan"
|
|
? `Write a short plan for welcoming new members to our garden club. ${facts} Let me review the plan before any work starts.`
|
|
: entry[2] === "ordinary"
|
|
? `Write the welcome note now on this task; no interview or subtask is needed. ${task}`
|
|
: task,
|
|
revision: `Change the note: invite people to our Sunday meetup instead, and replace ${originalMarker} with ${marker}. Please revise your proposal; I have not accepted it yet.`,
|
|
acceptance: "Yes, I accept that proposal. Please do it.",
|
|
rejection:
|
|
"No, do not proceed. I do not want this work done. Please acknowledge that and stop.",
|
|
};
|
|
}
|
|
const buildFirstTaskFixture = ([id, label, , expectedRunCount]: readonly [string, string, string, number]): RunnerTaskFixture => ({
|
|
id,
|
|
label,
|
|
groups: ["onboarding"],
|
|
flow: "first_task",
|
|
workMode: "standard",
|
|
expectedRunCount,
|
|
attemptTimeoutMs: { local: 15 * 60_000, daytona: 15 * 60_000 },
|
|
expectedTerminalState: { issue: "in_review", run: "succeeded" },
|
|
buildTitle: (nonce) => `First task ${id} ${nonce}`,
|
|
buildPrompt: (nonce) => firstTaskScenario(id, nonce).prompt,
|
|
buildVisibleMarker: firstTaskMarker,
|
|
buildMatchers: () => [], // Checkpoints and state effects are graded by first-task-scoring.
|
|
});
|
|
export const firstTaskTasks: readonly RunnerTaskFixture[] = FIRST_TASK_CASES.map(buildFirstTaskFixture);
|
|
export const onboardingApprovalHistoryTask = {
|
|
...buildFirstTaskFixture(approvalHistoryCase),
|
|
expectedTerminalState: { issue: "done", run: "succeeded" } as const,
|
|
minimumExpectedRunCount: 1,
|
|
automaticRetryPolicy: "single_attempt" as const,
|
|
};
|