Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

test: cover task policy gates, workflow envelopes, and thread fork schemas

open
Stack 2/2
#334 opened by cursor[bot]cursor/missing-test-coverage-f3be→main
Conversation0
cursor[bot]
Commits
0
Files changed…
opened this pull request
Author
· 2 weeks ago

Risky behavior now covered

  • Task policy (extracted from TaskCoordinator): terminal tasks cannot be mutated or grow new threads; pending terminal locks fail closed unless the caller opts in; revision conflicts name both sides; workspace mismatch is rejected; work-item graphs reject duplicates, unknown edges, self-edges, and cycles; only the owning or primary thread can mark an unclaimed item; claims and dependency-gated statuses require completed dependencies; incomplete dependencies cannot be removed.
  • Workflow structured output: extractResultEnvelope keeps the last <workflow_result> block, treats empty/missing bodies as absent, and still yields an unclosed final block. validateAgainstJsonSchema reports missing/invalid JSON and path-qualified schema issues without throwing, and throws for a malformed caller schema so a repair turn is not wasted.
  • Thread management request schemas: thread/fork trims ids and worktree refs, accepts local / worktree, and rejects blanks, extras, unknown environment types, and local extras. Pin/archive require a real boolean and reject blanks or extras.

Test files added

  • test/server/tasks/taskPolicy.test.ts
  • test/workflows/resultSchema.test.ts
  • test/jsonrpc.thread-management-schema-rejects.test.ts

Why these tests reduce regression risk

These are shared fail-closed gates with a large blast radius. The recent TaskCoordinator extraction left taskPolicy.ts as the authority for ownership, graph, and terminal-lock checks with no dedicated tests. Workflow envelope validation was only exercised through runner happy paths, so a parse/repair regression could accept invalid child output or burn repair turns. Thread fork/pin/archive schemas had integration happy paths only; a loosened environment union or optional boolean would let clients create or mutate threads with invalid params.

This run does not duplicate open coverage PRs #331, #332, or #333.

Validation

  • Targeted new files + platform-boundary: 29 tests green
  • Related existing task/workflow tests: 69 green
  • bun run typecheck, bun run check, bun run docs:check, and Biome on touched files: clean
  • Full bun run test: new files that reached the runner passed in-suite (taskPolicy, thread-management-schema-rejects). resultSchema passed isolated; the host suite truncated before test/workflows/* (same pattern as recent coverage runs). Reproduced the known ipc-files rewritten-mtime reauth failure; not introduced by this change.
Open in Web View Automation 
This branch can’t be merged automatically yet
Branch comparison failed — verify branches still exist in storage.
0 approving reviews
None yet
Checks
No checks recorded
Fast-forward
Source must contain the target branch tip
main ← cursor/missing-test-coverage-f3be

Sign in to comment.

Stack

2/2
1

Merge readiness

Checking mergeability after the indexing worker computes the current branch state.

Autopilot

Debug

Reviews

Approved0
ReviewersNone yet

Configure an OpenRouter key in repository settings.

Update README.md

#125 mobile-fixes ← main

Updated 4 months ago

merged
2

test: cover task policy gates, workflow envelopes, and thread fork schemas

#334 main ← cursor/missing-test-coverage-f3be

Updated 2 weeks ago

open