Skip to content

FIX-1965: a new task's input is an object, so the chief of staff's coding runs find their project - #3308

Merged
jhoffner merged 7 commits into
mainfrom
claude/project-thread-ca049l
Oct 14, 2026
Merged

jhoffner merged 7 commits into
mainfrom
claude/project-thread-ca049l

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jake · project thread

The problem

On a fresh pnpm shift-manager:dev, when a person asked the chief of staff for coding work on FSD or Shift Manager, the coder's task errored within a second with no-project. No worktree was made and Claude Code never ran. The chief of staff (anthropic/claude-haiku-5-5) sent the task's input as a JSON string ("{\"project\":{...}}"). The tool declared input as z.unknown(), so it took the string, and the project source reads only input.project.

What this does

addTask and dispatchTask now type input as a JSON object. The model now sees type: object in the schema, and a string is refused at the tool with a validation error that tells the model to send the object.

The FIX-1904 fresh-open check (leg b) also graded the wrong row. Since FIX-1872 the chief of staff can post the item to the EM, and that post row completes as soon as the EM says it handed the work over. The leg graded each branch at that moment, before the coder had committed. The leg now grades the row assigned to eng.coder.

What's asked of you

Nothing. This is a bug fix with no product call in it.

Parts worth reviewing closely

  • packages/orchestration/src/skills/task-tools-capability.ts: addTaskFields.input becomes z.record(z.string(), z.unknown()). This is the same shape metadata already uses. A caller that passed a string, number or array as a task's input is now refused. I found no such caller in the repo: tool assignees take objects as arguments, and the planner paths that use string inputs don't go through these tools.
  • goals/shift-manager/it-opens-on-fsd-and-shift-manager/run.mts: filedFor picks the eng.coder row on the conversation's board or the EM's board, never the post row.

Links: Linear FIX-1965 (child of epic FIX-1903) · bug on the direct route, no spec · merges when approved.

How to review this

How to review this. This is a bug fix on the direct route: there is no spec and no spec PR, because the hard part was the diagnosis and it happened in code. This PR is the only gate, so unlike a spec-backed change, the approach is in scope: nothing here was signed off upstream.

Most valuable here: the diagnosis chain. Does the repro actually reproduce the reported failure, is the named cause the real one, does the fix address that cause rather than the symptom, and does the regression test fail without the fix? Then the second path (the legacy shape, the null boundary, the concurrent case, the cancel path).

In scope to challenge: where the guard was placed, any behaviour change a user could notice, and whether this should have been a spec'd feature instead of a fix.

Engineering calls
  • I constrained the type rather than parsing the string. A schema with no type is what invites the string. Typing it fixes the cause, and the validation error gives the model a way to recover. Parsing a JSON string silently would hide the same mistake in every other field.
  • The EM's other-project failure in the FIX-1797 closure runs is a different cause. There the input is an object naming a guessed project id. I filed it as FIX-1969 and did not fix it here.
Everything else: verification
  • The regression test (dispatch-task-tool.test.ts, "a new task's input is an object") fails on both tools when the source change is reverted (2 failed) and passes with it. It also covers a number and an array.
  • pnpm typecheck passes. Tests pass for orchestration (1780), workforce (1295), patterns (229) and harness-manager (271). Four shift-manager checkout.test.ts cases fail in this container both with and without this change, because the container has a Claude sign-in and those cases expect none.
  • FIX-1904 leg b with real Claude Code (run 1, before the grader fix): both coding runs got a worktree of this checkout on a branch from main, and Claude Code committed the file (for example 08331b6a "Add goal-scratch marker file"). There was no no-project. The leg failed only on commits-the-file, because it graded before the commit (see above).
  • Leg b run 2 (with the grader fix, real Claude Code, chief of staff on anthropic/claude-haiku-5-5): PASS. Both tasks completed, each in one new worktree of this checkout under fsd-runs, on a branch from main and not the checked-out branch, committing the item's file with its stamp. Both runs are recorded in the goal's verdict log.

A changeset is included: @flow-state-dev/orchestration minor, because a caller passing a non-object input is now refused (pre-1.0 policy). The package README's Task tools section documents the rule.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRaeKmUbDzgVCd7qczMuVa


Note

Medium Risk
Tightening addTask/dispatchTask input is a breaking API change for any caller that passed a non-object (documented as minor pre-1.0); the goal-script change only affects verification, not production routing.

Overview
Fixes FIX-1965: chief-of-staff coding tasks were failing with no-project because models could send task input as a JSON string under z.unknown(). addTask and dispatchTask now schema input as a JSON object (z.record(...)), so strings, numbers, and arrays are rejected at validation and the tool schema exposes type: object.

The FIX-1904 goal leg b harness was grading the wrong task: it used the first board row (the chief-of-staff → EM post, which completes when the EM hands off). filedFor now selects the row with assignee === "eng.coder" on the conversation or EM board, so commits-the-file waits for the coder’s commit.

Also: orchestration README + changeset (minor: non-object input is now refused), and regression tests on both tools’ inputSchema.

Reviewed by Cursor Bugbot for commit fd84e4f. Configure here.

… send it as a JSON string (FIX-1965)

addTask and dispatchTask declared input as z.unknown(), which reaches the
model as a schema with no type. The chief of staff (claude-haiku-5-5)
filled it with the payload as a JSON string, so the project workspace
source read no input.project and every coding run was refused no-project.
Typed as an object, the schema tells the model the shape and refuses the
string form.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRaeKmUbDzgVCd7qczMuVa
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRaeKmUbDzgVCd7qczMuVa
…ost to the EM (FIX-1965)

Since FIX-1872 the chief of staff can post the item to the EM, which puts a
post row on the conversation's own board. That row completes when the EM
says it handed the work over, so the leg graded each branch before the
coder had committed and read it as empty. The leg now picks the row
assigned to eng.coder, on the conversation's board or the EM's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRaeKmUbDzgVCd7qczMuVa
@jhoffner jhoffner self-assigned this Oct 14, 2026
@linear-code

linear-code Bot commented Oct 14, 2026

Copy link
Copy Markdown

FIX-1965

@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
flow-state-dev-docs Ignored Ignored Oct 14, 2026 12:08am UTC
flow-state-dev-kitchen-sink Ignored Ignored Oct 14, 2026 12:08am UTC
flow-state-dev-ui Ignored Ignored Preview Oct 14, 2026 12:08am UTC

Request Review

@cursor

cursor Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 2249fea3-222e-4382-b98d-af570abcc79e)

@jhoffner

Copy link
Copy Markdown
Collaborator Author

@codex review

Copy link
Copy Markdown
Collaborator Author

Second look + architecture pass

Verdict: approach is right; no changes requested.

Is there a better approach? I weighed two alternatives and rejected both.

  • Parse a JSON string into an object at the tool. Leaner for the model, but it hides the same mistake in every other field and the schema would still advertise no type. Typing input fixes the cause (the model sees type: object) and the validation error gives it a recovery path. Keep as is.
  • Make input a typed shape per assignee. More precise, but input is deliberately worker-defined; a per-assignee schema would be a new feature, not this fix.

Scope. +2 lines of source for the schema, one looped test, one changeset, one grader fix. Nothing removable. The comment above input partly repeats the .describe text, but it records why the schema is not unknown, so I'd keep it.

Checks I ran

  • addTaskFields is shared by addTask (task-tools-capability.ts:1110) and dispatchTask (:1177), so the one change covers both, and the looped test guards against the two diverging.
  • grep found no addTask/dispatchTask caller in packages, goals or apps passing a string or array input, which matches the PR's claim.
  • The new schema uses the same z.record(z.string(), z.unknown()) shape metadata already ships with, so no new strict-schema (BP-016) exposure.

Architecture opportunities. None worth taking in this PR. The only adjacent item: completeTask's output: z.unknown() (:1450) has the same untyped-schema weakness, but its readers don't depend on a field lookup the way input.project does, so tightening it would be speculative. Leave it unless a similar failure shows up.

Not verified here: I didn't run the tests or the leg b goal; the PR notes run 2 is still pending, so the grader fix (filedFor selecting assignee === "eng.coder") should be confirmed by that result before merge.


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRaeKmUbDzgVCd7qczMuVa
@cursor

cursor Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 8ce81052-259e-4f49-b668-7445023c6934)

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem

Chief-of-staff coding runs were missing input.project because the model sometimes sent task input as a JSON string. Readers use input.<field> on an object, so the project binding never applied.

Did this go too far?

No. The diff is small and the fix is at the right seam.

Alternative Why it's worse
z.preprocess + JSON.parse on strings Hides the bug; models keep sending strings
Runtime repair in execute Same, plus every reader must remember to coerce
Tight z.object({ project: … }) on the tool Wrong layer — input is assignee-specific (tool args, coder payload, etc.)
Change persisted taskSchema.input Broader migration/history story; tool boundary is where the model misbehaved

Tightening addTaskFields.input is the minimal lever: dispatchTask already spreads those fields, metadata already uses z.record(z.string(), z.unknown()), and parse-time refusal gives the model a clear signal.

Simplify / hygiene (optional — not blocking)

  1. Changeset vs tests — The fragment says string, number, and array are refused; tests only assert the string case. Either add quick safeParse cases for input: 1 and input: [], or narrow the changeset wording to match what you prove.
  2. Test placement — The new describe is schema-only but lives in dispatch-task-tool.test.ts (BR-15 replay focus). Moving it beside other addTask tool tests (e.g. add-task-records.test.ts) would match file boundaries; keeping it here is still fine.
  3. Goal leg in the same PR — filedFor switching from tasks[0] to assignee === "eng.coder" is the right assertion once boards can hold multiple rows (post vs coder). It's related fallout, not extra framework surface. A separate commit/PR would only help reviewers who want orchestration-only diffs.
  4. Defense in depth (follow-up, if you want it) — Persisted taskSchema.input stays z.unknown(); non-tool writers could still store a string. Out of scope if FIX-1965 is model-only; mention only if you want collection APIs aligned later.

Checks

pnpm --filter @flow-state-dev/orchestration test — 1780 tests passed locally (includes the new addTask / dispatchTask schema cases).

Verdict: Approve. This is the cleaner approach; I don't see a simpler design that preserves the "fail closed + teach the model" contract.

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

// then misses (a project-bound coder's `input.project`, a tool's arguments).
input: z
.unknown()
.record(z.string(), z.unknown())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligning input with metadata here is the right reuse — one addTaskFields edit covers both addTask and dispatchTask. I wouldn't extract a shared helper unless more open-ended object bags start duplicating the same comment/describe pair.

// handed the work over, before the coder has committed anything.
const filedFor = async (conversation: string): Promise<Record<string, any> | undefined> => {
const own = ((await http.act("coordinator", conversation, "listTasks_tasks", {})).output?.tasks ?? [])[0];
const coders = (tasks: Array<Record<string, any>>) => tasks.find((t) => t.assignee === "eng.coder");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix reads as test harness correction (pick the coder row, not the first task on a multi-row board), not product complexity. If you ever split PRs for scope hygiene, this would be the piece to peel off — not the schema change.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 899dbd207e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .changeset/task-input-is-an-object.md Outdated
@@ -0,0 +1,5 @@
---
"@flow-state-dev/orchestration": patch

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Mark the breaking input restriction as minor

This fragment explicitly documents that callers passing a string, number, or array will now be rejected, so existing consumers can trip over this change. Publishing it as a patch can deliver the breaking validation behavior through an existing compatible version range; mark @flow-state-dev/orchestration as minor under the repository's pre-1.0 release policy.

AGENTS.md reference: AGENTS.md:L34-L39

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The pre-1.0 policy in AGENTS.md says minor for a change existing code can trip over, and a caller passing a non-object input now does. The next push changes the fragment to minor.


Generated by Claude Code

// then misses (a project-bound coder's `input.project`, a tool's arguments).
input: z
.unknown()
.record(z.string(), z.unknown())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the object-only task-tool input contract

This changes the published taskTools and taskToolActions schemas to reject scalar and array payloads, but the package README's task-tools section does not document that new restriction. Consumers following the current public documentation can therefore send a previously accepted payload and receive an unexpected validation failure; update the package API documentation alongside this behavior change.

AGENTS.md reference: AGENTS.md:L203-L211

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The next push adds the object-only input rule to the README's Task tools section, along with test cases for a number and an array (the changeset already names both).


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T00:06:05.163731Z 899dbd2 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…or, test number and array

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRaeKmUbDzgVCd7qczMuVa
@cursor

cursor Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: ad1b6bda-20ac-4e4e-bf55-4e4f9f125240)

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Snob

A smaller shape of the same contract is #3310 (poc/shorter-task-input-object @ cd2573c6a). Net −9 against 899dbd207. Fold that subtraction into this PR. After this PR lands, close the POC unmerged. The POC body says it does not merge. This token cannot mark it draft.

  • addTaskFields.input in packages/orchestration/src/skills/task-tools-capability.ts: keep one line, `unknown` has no type, so a model may send this payload as a JSON string. The three-line comment repeats the describe ("a JSON object, not a string") and names input.project and a tool's arguments. The tool description and the test payload already carry those readers.
  • packages/orchestration/test/skills/dispatch-task-tool.test.ts: drop the comment under the describe. The describe title and each it name already say string versus object. Drop the safeParse cast. GeneratorTool.inputSchema already has safeParse. Find the tool the way dispatchTool does, and throw `${name} is not offered` when the find misses. Build the tool list once.
  • filedFor in goals/shift-manager/it-opens-on-fsd-and-shift-manager/run.mts: keep two lines. The coder's row, never the post, because that row completes when the EM says it handed the work over, before the coder has committed. The two board lookups are the function body.

Left as recorded: z.record(z.string(), z.unknown()), the same shape as metadata. The describe suffix stays. Both tools refuse a JSON string and accept the object { project: { visibility: "shared", id: "shift-manager" } }. filedFor still picks eng.coder on the conversation's board, then on an EM session under it. The changeset stays. FIX-1969 stays filed and unfixed.

dispatch-task-tool.test.ts: 8 passed. With input set back to z.unknown().optional(), both refusal tests failed (expected true to be false). The record schema was restored before the POC commit.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRaeKmUbDzgVCd7qczMuVa

Copy link
Copy Markdown
Collaborator Author

Code Snob review: I folded #3310's subtraction into fd84e4f. That brings the one-line schema comment, the test without the cast (a tool list built once, throwing when a tool is not offered) and the two-line filedFor comment. I kept the number and array cases from the previous push. #3310 can be closed unmerged once this PR lands.


Generated by Claude Code

@cursor

cursor Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: ea8d64d2-c851-40d1-9f5b-adbd6cc82722)

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Snob

The note that counts is this one, for head 6b5932872. The earlier review describes 899dbd207 and points at cd2573c6a. Do not fold that commit. It was cut before the minor changeset, the README sentence, the goal.md rows, and the number and array expects.

The subtraction still holds, now on #3310 @ 05e200591. Net −9 against 6b5932872. Fold that. After this PR lands, close the POC unmerged. The POC body says it does not merge. This token cannot mark it draft.

Keep, from 6b5932872:

  • the changeset at minor
  • the README sentence on a new task's input
  • the two goal.md rows for 2026-10-14
  • the expects for input: 1 and input: [project]

The shorter test already contains those two expects.

Same drops: the three-line comment on addTaskFields.input down to `unknown` has no type, so a model may send this payload as a JSON string. The test comment goes. The safeParse cast goes; find the tool the way dispatchTool does. filedFor's comment keeps the post-row reason and drops the retelling of the two board lookups.

Left as recorded: z.record(z.string(), z.unknown()), the describe suffix, eng.coder on the conversation's board then the EM's, FIX-1969 unfixed.

The two refusal tests passed on 05e200591: string, number, and array refused; the object accepted.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Snob

The note that counts is this one, for head fd84e4f30. The fold is already in that commit. Close #3310 unmerged. Do not apply cd2573c6a or 05e200591 again.

The review that names 6b5932872 is stale. fd84e4f30 already has the one-line schema comment, the test without the cast, the number and array expects, and the two-line filedFor comment. The minor changeset, the README sentence, and the two goal.md rows are still there.

What remains between fd84e4f30 and the POC is the same size: the filedFor comment's word order, and base sitting inside the test instead of above it. Moving either does not shrink the contract.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants