Skip to content

FIX-1701: one shared item-scope reader for the three harness emitters; Claude Code nests under its container - #2569

Merged
jhoffner merged 9 commits into
mainfrom
fix/FIX-1701-item-scope-reader
Oct 1, 2026
Merged

jhoffner merged 9 commits into
mainfrom
fix/FIX-1701-item-scope-reader

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

from: fsd-claude
session: refactor-desk-0930
kind: reply

A Claude Code run placed inside a container shows its steps outside that container. Codex and Cursor runs show theirs inside it, and the docs say all three should. The cause is that each of the three coding harnesses reads its task scope in its own way. That drift is also how Claude Code once shipped without the task id, which left a task's own screen empty (FIX-1692).

What this does. It adds one shared reader for "which task and which container is this step in". All three harnesses now call it instead of keeping their own copy. Claude Code also starts stamping the container on its top-level steps and on its sub-agent boxes. Steps inside a sub-agent still show inside that sub-agent. Codex and Cursor output does not change at all.

What's asked of you: nothing new. This implements the approved direction in specs/issues/FIX-1701 (D1 = A, D2 internal).

Parts worth reviewing closely

  • packages/claude-code/src/sdk/emit.ts → resolveOwnedBy: the owner precedence subAgentOwner ?? itemScope(ctx).ownedBy. A message, reasoning or tool item whose parentCallId names a sub-agent that is not open now falls back to the runtime owner. On main it got no owner at all. I read that as "not inside any known container, so it belongs to the enclosing one".
  • The same file → itemFields / buildBase: since the review round, the runtime owner rides here with the task id, spread as itemScope returns it. An owner is passed only when it replaces the runtime one: a sub-agent's id, or the owner an open stored so that its close keeps it. Every site, including closes, the orphan tool result, the error item and finalize, emits the same owner value as before; only the key's position in the object moves.
  • packages/core/src/types/block.ts → itemScope: marked @internal and exported only through @flow-state-dev/core/types, beside asRuntime. It is not exported from the package root (D2).

Spec: specs/issues/FIX-1701/ (merged in #2549) · Linear: FIX-1701 · no epic · this PR merges.

How to review this: altitude, what's in scope, what's deliberately unsettled

How to review this. This implements an approved spec. The approach and the numbered
decisions in its DECISIONS.md are already signed off by a human, so please review the
code against that direction, not the direction itself. The canonical set is retained
at specs/issues/<ISSUE-ID>/ on main; Linear links to it and the original merged spec
PR, which keeps review history. Follow-up amendment PRs explain later direction changes.
Current architecture docs remain the authority for shipped behavior (BP-037).

Most valuable here: correctness on the second path (the legacy shape, the null
boundary, the concurrent case, the cancel path), anything deriving an auth or routing
decision from caller-controllable input, and a behaviour the tests assert around
rather than on.

Already settled upstream: the approach and every decision in the spec's DECISIONS.md
(human-approved; if one is wrong, say so as a spec finding and it gets folded back; don't
re-argue it inline), and the conventions in docs/contributing/best-practices.md.

Engineering calls: decisions made while building, one line each
  • V0 uses a recording fake context in all three packages, not createTestContext. It asserts key presence on the raw item.added / item.done objects, so no harness normalisation can hide a key set to undefined. If this is wrong, a difference that only shows up through the real response store goes unpinned; V5 covers that path for Claude Code.
  • Commit seams follow PLAN: S0 tests only, S1 the only V0 edit (two helper bodies, topLevelOwner and containerOwner), and S2 to S5 touch no test assertion. Check with git diff 3841e8d2e..1f113a6dc -- '*.spec.ts' after S1. If this is wrong, a stamp moved during the extract. The review round's test commit (77d391a2c) changes test structure only: V5's expected rows are spelled out from the script, and V0's two identical owner helpers are inlined. No asserted value changes.
  • Claude Code's owner is stamped once, in itemFields. This follows Cursor's review and the POC: stamp Claude Code's item owner once in itemFields #2570 sketch, applied by hand; POC: stamp Claude Code's item owner once in itemFields #2570 is not merged. It differs from the sketch in one place: itemFields spreads itemScope(ctx) whole instead of re-spelling the taskId check, so the omission rule lives in core alone. If this is wrong, a close could lose the owner its open stored; V0's close-path rows pin that.
  • Changeset: patch on @flow-state-dev/claude-code only. Core gets none, because the reader is internal (D2), and Codex and Cursor get none because their output is unchanged (BP-022).
  • Docs re-checked at S1 (DOCS.md): the Claude Code README and apps/docs/docs/tools/claude-code-sdk.md say nothing about steps sitting outside an enclosing container. No doc edits.
Everything else: commits, the goal check red then green, controls, checks

Commits, in PLAN order

Commit Step
3841e8d2e S0: the V0 characterization, test-only, green on unmodified source
e0ffc6051 S1: the Claude Code nesting fix. Flips only V0's Claude Code top-level and sub-agent-box owner rows (BR-6, BR-8) and adds V5
e2f5ad8db S2: itemScope in core, plus V1
da546259e S3: Codex spreads itemScope(ctx) (private deriveScope and EmitScope removed)
488229221 S4: Cursor, the same
1f113a6dc S5: Claude Code reads task and owner through itemScope
77b08f75f S6: patch changeset naming FIX-1701
6770497b9 Review: Claude Code stamps task scope and owner once in itemFields (Cursor review, #2570 shape)
77d391a2c Review: V5's expected ownership spelled out from the script; V0 owner helpers inlined

V0, what it pins. It covers each identity (none · task only · owner only · task and owner · empty-string task) and every item version, on open and on close. For Claude Code that means streamed message and reasoning closed by the next item, by a turn-boundary flush, by a tool call, by a sub-agent opening, and at stream end. It also covers whole message and reasoning, a tool opened and settled, an orphan failed result, a tool left open, a sub-agent closed, closed failed, and left open, an error, and inside a sub-agent its streamed and whole text, a tool, an orphan result, and a tool left open. Codex and Cursor cover message, reasoning, a tool opened and settled, an orphan failed result, an error, and a tool finalized at stream end. It is asserted on the scope key list.

V5, the goal check, red on main. claudeCodeAgent runs as a step of a real sequencer({ container }) through testBlock. It now compares against an expectedOwnership list written out from the script. This is the current V5 run against origin/main's packages/claude-code/src/sdk/emit.ts, with the file restored afterwards:

 FAIL  test/sdk/agent.spec.ts > claudeCodeAgent — inside an owned container > stamps the container's owner on every top-level item and sub-agent box, and the sub-agent's on its own items
-     "ownedBy": "test_req_1790853946364_c5a7ec04373d7:root:0",
+     "ownedBy": undefined,
      "type": "reasoning",
-     "ownedBy": "test_req_1790853946364_c5a7ec04373d7:root:0",
+     "ownedBy": undefined,
      "type": "message",
      "callId": "toolu_1",
-     "ownedBy": "test_req_1790853946364_c5a7ec04373d7:root:0",
+     "ownedBy": undefined,
      "type": "tool_output",
-     "ownedBy": "test_req_1790853946364_c5a7ec04373d7:root:0",
+     "ownedBy": undefined,
      "type": "container",
      "callId": "toolu_inner",
      "ownedBy": "test_req_1790853946364_c5a7ec04373d7:root/step[0]:0:subagent:toolu_agent",
      "type": "tool_output",
-     "ownedBy": "test_req_1790853946364_c5a7ec04373d7:root:0",
+     "ownedBy": undefined,
      "type": "error",
 Tests  1 failed | 105 skipped (106)

On the current head it passes, along with the rest of the claude-code suite (271).

Control (a): the reader drops taskId. Re-run on 77d391a2c. I removed the taskId line from itemScope, ran vitest -t "scope characterization" in each package, then restored the line.

### claude-code   Tests  3 failed | 3 passed | 265 skipped (271)
   × … (identity: task only)   × … (identity: task and owner)   × … (identity: empty-string task)
### codex         Tests  3 failed | 3 passed | 81 skipped (87)
   × … (identity: task only)   × … (identity: task and owner)   × … (identity: empty-string task)
### cursor        Tests  3 failed | 3 passed | 88 skipped (94)
   × … (identity: task only)   × … (identity: task and owner)   × … (identity: empty-string task)

Control (b): Claude Code's stamp drops the runtime owner. Re-run on 77d391a2c. With the owner now stamped once, I stripped ownedBy from the itemScope(ctx) spread in itemFields and made resolveOwnedBy return subAgentOwner only, then restored both.

Tests  3 failed | 113 passed (116)
   × scope characterization > … (identity: owner only)
   × scope characterization > … (identity: task and owner)
   × claudeCodeAgent — inside an owned container > stamps the container's owner on every top-level item …
-- V0, first diff:
  "event": "item.added",
- "scope": { "ownedBy": "container_7" },
+ "scope": {},
  "type": "reasoning",
  "where": "top",

The tree was clean after both controls (git diff showed only the committed changes).

V3: the spec's checker.

$ AFTER=1 node specs/issues/FIX-1701/poc/scope-readers/check.mjs      # head 77d391a2c
readers outside core/engine: 6   …   PASS
$ AFTER=1 …check.mjs   # with the three emitters restored to origin/main (red state)
packages/claude-code/src/sdk/emit.ts: reads [taskId] want []
packages/codex/src/emit.ts: reads [taskId,ownedBy] want []
packages/cursor/src/emit.ts: reads [taskId,ownedBy] want []
exit 1

On fresh main, before S0, the plain check passed with the same six readers classified, so nothing new needed classifying. The head run classifies the same six readers as 77b08f75f did.

Checks run locally before push (head 77d391a2c)

  • pnpm typecheck: 74/74 tasks passed; package-boundary, updater-purity, side-chain-vocabulary and control-shape guards OK.
  • Tests: core 141 files and 2269 tests, claude-code 271, codex 87, cursor 94, all passing.
  • knip on the four workspaces (at 77b08f75f): nothing in the touched files. The listed findings, such as InferResourcesFromSchemas, are already on main.
  • validate-changeset-refs, validate-spec-folder, validate-publish-set, validate-no-nul-bytes, validate-model-strings, validate-reserved-names (at 77b08f75f): OK.
  • pnpm changeset status --since=origin/main: patch for @flow-state-dev/claude-code only.

Not here, per the spec's fences: the FIX-1668 task-run link, the provenance extract, FIX-1649, and core's own emit sites.

🤖 Generated with Claude Code

https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx


Generated by Claude Code


Note

Medium Risk
Changes how streamed items are attributed (ownedBy) in Claude Code UI nesting; Codex/Cursor behavior is refactored to a shared reader but intended to be unchanged.

Overview
Introduces a shared itemScope helper in core so Claude Code, Codex, and Cursor harness emitters read taskId and ownedBy from block identity the same way (replacing per-package deriveScope / inline casts).

The behavioral fix is in Claude Code emission: resolveOwnedBy now falls back to the runtime container owner when there is no open sub-agent (subAgentOwner ?? itemScope(ctx).ownedBy), and sub-agent container, error, and finalize paths stamp that outer ownedBy. Top-level steps and sub-agent boxes therefore nest inside an enclosing container like Codex/Cursor already did; work inside a sub-agent still nests under the sub-agent box.

Adds broad scope characterization tests plus an integration test for a Claude run inside a sequencer({ container }). Ships a patch changeset for @flow-state-dev/claude-code only (FIX-1701).

Reviewed by Cursor Bugbot for commit 77b08f7. Configure here.

claude added 7 commits October 1, 2026 11:06
…X-1701 S0)

Pins which of taskId and ownedBy each emitted item version carries, by key
presence and value, across the identity matrix (none, task only, owner only,
task and owner, empty-string task), on every item kind and close path of the
Claude Code, Codex and Cursor emitters. Test-only, green on unmodified source,
including Claude Code's current missing top-level and sub-agent-box owner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx
…iner (FIX-1701 S1)

Claude Code stamped no ownedBy on its top-level items or its sub-agent
container items, so a run inside a container showed its steps outside it,
breaking the documented Container Ownership contract that Codex and Cursor
keep. Every top-level item and sub-agent box now carries the runtime owner;
items inside a sub-agent keep the sub-agent's owner (subAgentOwner ??
runtimeOwner, decided at the call site). Presence is `!== undefined`.

Flips only the characterization's Claude Code top-level and sub-agent-box
owner rows, and adds the owned-container test that drives claudeCodeAgent
through a real sequencer declaring a container (red on main, green now).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx
…cope (FIX-1701 S2)

itemScope(ctx) returns { taskId?, ownedBy? } off the runtime identity, each
key present only when the identity defines it (!== undefined). Marked
@internal and exported through @flow-state-dev/core/types beside asRuntime;
not re-exported from the package root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx
…701 S3)

Removes the private deriveScope reader and its EmitScope type; every former
use spreads itemScope(ctx). Stamped output unchanged (V0 untouched).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx
…1701 S4)

Removes the private deriveScope reader and its EmitScope type; every former
use spreads itemScope(ctx). Stamped output unchanged (V0 untouched).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx
…(FIX-1701 S5)

The shared item stamp reads the task id, and the owner precedence reads the
runtime owner, through itemScope(ctx) instead of casting the identity inline.
Pure refactor against S1's behaviour (V0 and V5 untouched).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx
…ting (FIX-1701 S6)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@vercel

vercel Bot commented Oct 1, 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 1, 2026 11:32am UTC
flow-state-dev-kitchen-sink Ignored Ignored Oct 1, 2026 11:32am UTC
flow-state-dev-ui Ignored Ignored Preview Oct 1, 2026 11:32am UTC

Request Review

@linear-code

linear-code Bot commented Oct 1, 2026

Copy link
Copy Markdown

FIX-1701

@cursor

cursor Bot commented Oct 1, 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: serverGenReqId_718118dd-9f36-4b5c-b6bb-94128c70eed2)

jhoffner commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

Second look + architecture pass (read-only; for the implementing agent to triage)

Overall: the direction is sound and the scope is disciplined. One shared reader replacing two byte-identical private copies (deriveScope in Codex/Cursor) and one ad-hoc cast (Claude Code) is the right size of refactor for this bug. The goal check is red on main and green here, and the controls show the characterization tests can fail. Findings below, most important first.

1. Likely release/runtime hazard: Claude Code now needs a core that has itemScope, but core gets no changeset (verify).
itemScope is a runtime value import from @flow-state-dev/core/types, not a type import like before. All three packages depend on "@flow-state-dev/core": "workspace:*", and .changeset/config.json has updateInternalDependencies: patch with onlyUpdatePeerDependentsWhenOutOfRange. If core isn't bumped in the same release, the published claude-code patch resolves workspace:* to the currently published core, which doesn't export itemScope. Result: itemScope is not a function on the first emitted item, for every Claude Code run. The PR body justifies "core gets none" by D2 (internal), but @internal controls API visibility, not release coupling. Suggest a patch changeset for @flow-state-dev/core too (one line, "internal item-scope reader used by the harness packages"), or confirm that the publish flow always releases core with its dependents. Codex and Cursor have the same latent coupling the next time either releases.

2. Claude Code's emit.ts has kept the repeated shape the shared reader was meant to remove.
itemScope unified the read, but the stamp is still hand-written ~14 times in Claude Code: ...(ownedBy !== undefined ? { ownedBy } : {}), plus four separate const owner = itemScope(ctx).ownedBy sites (sub-agent open, close, finalize, error). Codex and Cursor get both keys from one ...itemScope(ctx) in buildBase, which is why they can't drift. The leaner shape here is for itemFields/buildBase to return taskId + the runtime ownedBy as the default, with the sub-agent override applied in one place (e.g. resolveOwnedBy returning the key fragment, or a one-line ownedByField(owner) helper). The sub-agent container/error/finalize items then need no per-site code, and the next item kind added to this file inherits nesting rather than needing someone to remember it. That is exactly the "forgot to stamp it" failure mode behind FIX-1692 and this bug. This is in the file the PR is already rewriting, so it's the natural moment; it can be left as a follow-up if D-decisions pin the current shape.

3. Behavior change worth one explicit test: item closes vs. the open's owner.
state.message.ownedBy / reasoning.ownedBy / openTools[].ownedBy now hold the runtime owner for top-level items, and closes reuse the open's value. That's right, but the only test that proves an open and its close agree is V0 on the fake context. If the runtime owner changes between open and close (it shouldn't within a run), the close silently keeps the stale value. Fine as designed; just noting that the comment change on EmitState ("the owner the open carried; the close keeps it") is the only place that invariant is written down.

4. Nested sub-agents: the box still takes the runtime owner, not the enclosing sub-agent.
subagent_open events carry no parentCallId (translate.ts:367, types.ts:238), so a sub-agent started inside another sub-agent is stamped with the outer runtime owner and appears beside its parent box rather than within it. Same as main for the sub-agent case (it had no owner at all), so not a regression and out of this PR's fences, but the new code comment ("a nested container's own item carries the OUTER owner") reads as if it handles nesting generally. Consider softening the comment, or a follow-up issue if nested boxes occur in practice.

5. Test duplication across packages (optional).
recordingContext, expectedScope, actualScope, and the IDENTITIES table are copied near-verbatim into the Codex and Cursor specs (and a third variant in Claude Code). CLAUDE.md asks for shared helpers over per-file copies. A recording-context helper in @flow-state-dev/testing would also serve the next harness package. Low priority; the copies are small and the PR body gives a defensible reason for not using createTestContext.

6. Minor: itemScope(ctx: Pick<BlockContext, "_blockIdentity">) is good for testability. The Claude Code agent.spec.ts new test builds an ownership array and compares it to a map of itself (ownership.map(...)), so it asserts a derived expectation. It's correct, but a reader has to work to see the rule; a direct expect(top.every(o => o.ownedBy === outerOwner)) / expect(inner.every(o => o.ownedBy === subagentOwner)) pair would state the intent more plainly.

Not raising: the !== undefined vs truthiness change (matches the spec's presence rule, and the PR calls it out), the not-open-sub-agent fallback to the runtime owner (reasonable reading of the Container Ownership doc), and the package-root export decision (D2).


Generated by Claude Code

@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.

Simplify review (FIX-1701)

Verdict: The production shape is the right local minimum for this problem. I’m approving; the notes below are simplification opportunities and follow-ups, not blockers.

Did the approach go too far?

Runtime code: no. Collapsing Codex/Cursor’s identical deriveScope into one itemScope in core/types, and having Claude compose nesting via resolveOwnedBy → subAgentOwner ?? itemScope(ctx).ownedBy, matches what the spec calls out as the smallest extract that still fixes container ownership. The alternatives that would look “simpler” in line count (engine stamping scope on every emit, a shared harness-emit package, or a full runtime-identity reader including provenance) are correctly deferred in DECISIONS.md and would widen blast radius or blur ownership rules.

Where the PR feels heavier than the runtime delta:

  1. Triplicated “scope characterization” suites in Codex, Cursor, and Claude emit.spec.ts (~same identity matrix, actualScope/expectedScope, and per-version loop). The spec intentionally wants per-package characterization (good), but the scaffolding does not need to be copy-pasted three times. A shared helper in @flow-state-dev/testing (identities table + assertScopeOnItemVersions, optional recordingHarnessCtx) would shrink ~200 lines and keep the three packages’ event scripts distinct.
  2. Retained spec + figures + POC add a large diff surface. That’s repo process, not accidental complexity—but if the goal is “smallest PR,” splitting spec merge from implementation is sometimes cleaner. Here the characterization-before-change story is tied to the spec, so bundling is defensible.
  3. Claude itemFields still partially re-implements itemScope (task id omission rules) while ownedBy goes through resolveOwnedBy. Not wrong (sub-agent owner must win), but const { taskId } = itemScope(ctx) (or a tiny itemTaskScope in core) would make “one reader” literally one place for omission semantics.
  4. deriveProvenance + unsafe _blockIdentity casts remain triplicated across harness emitters (pre-existing). The POC guards taskId/ownedBy reads; provenance is the obvious next extract if you want “no unclassified identity reads.”

Performance

No concerns for merge. Claude may call itemScope more than once per item-open path (micro-allocations). Optional follow-up: cache itemScope(ctx) once per emit function; not worth blocking.

Third-party / structure

No obvious off-the-shelf package for “spread optional keys from block identity.” Core helper is appropriate. Cross-import smell is low: harnesses only depend on core/types, not each other.

Skipped recommendations (larger than this PR)

  • Unifying generator.ts scope stamping with itemScope (different undefined-vs-omit behavior risk).
  • New internal package for shared buildHarnessItemBase / deriveProvenance.
  • CI wiring for AFTER=1 node specs/issues/FIX-1701/poc/scope-readers/check.mjs (nice guard; not required for approval).

Changeset nit (uncertain)

Changeset targets @flow-state-dev/claude-code only. If release notes policy treats any new core export as consumer-visible—even @internal—consider a patch fragment for @flow-state-dev/core as well. If @internal means “omit from changesets,” a one-line PR note is enough.

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

Comment thread packages/codex/test/emit.spec.ts Resolved
Comment thread packages/core/src/types/block.ts Resolved
Comment thread packages/claude-code/src/sdk/emit.ts Resolved

@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 exists, and it keeps the same contract.

itemFields stamps the task id, then every Claude Code emit site stamps ownedBy again (...(ownedBy !== undefined ? { ownedBy } : {}), fourteen times, plus four separate itemScope(ctx).ownedBy reads for the sub-agent box, its close, the error item, and finalize). That is the copy the shared reader was supposed to end. Codex and Cursor already spread the scope once inside buildBase.

Put the runtime owner on itemFields / buildBase with the task id. Pass an owner only when it replaces that one: a sub-agent id, or the owner the open stored so the close keeps it. Sub-agent boxes, errors, and their closes then need no extra line.

Sketch, already green: #2570 (−17 lines, packages/claude-code/src/sdk/emit.ts only). pnpm --filter @flow-state-dev/claude-code test — 271 passed, including the scope characterization and the owned-container check. Sub-agent owner still wins inside a sub-agent; everything else still carries the runtime owner; an absent owner is still omitted.

Fold that subtraction into this PR. After this PR lands, close the POC unmerged. It does not merge.

I left the per-package characterization copies alone. The spec asks each package to pin its own emitter, and a shared test helper would add surface rather than remove it.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

claude added 2 commits October 1, 2026 11:31
…temFields (FIX-1701 review)

The runtime owner now rides on itemFields/buildBase with the task id, spread
as itemScope returns it, so the omission rule lives in core alone. An owner is
passed only when it replaces the runtime one: a sub-agent's id, or the owner
an open stored so its close keeps it. Drops the per-site ownedBy spreads and
the four separate itemScope(ctx).ownedBy reads. No emitted value changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx
… trim V0 owner helpers (FIX-1701 review)

V5 compared ownership against rows rebuilt from the actual items, so a wrong
but self-consistent mapping could pass. It now lists the expected rows from
the scripted run. V0's two identical owner helpers are inlined and its
sub-agent owner is derived from the fake context's instance id. Asserted
values are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZDCzhKV2YFRy4LucoHjCx

jhoffner commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

from: fsd-claude
session: refactor-desk-0930
kind: reply

Re Code Snob's review (5378607923): the subtraction is folded in on this branch at 77d391a (commit 6770497), applied by hand. #2570 is not merged or cherry-picked; it stays open as the POC. Claude Code's itemFields/buildBase now carry the runtime owner together with the task id. An owner is passed only when it replaces that one: a sub-agent's id, or the owner the open stored so its close keeps it. The per-site ownedBy spreads and the four separate itemScope(ctx).ownedBy reads are gone.

One deviation from the sketch: it spreads itemScope(ctx) whole instead of re-spelling the taskId !== undefined check, so the omission rule stays in core alone. I checked every site, including closes, the orphan tool result, the error item and finalize, and no emitted owner value changes. V0 and V5 pass with no assertion edits, and controls (a) and (b) and V3 were re-run on the new shape (results are in the PR body).


Generated by Claude Code

@jhoffner
jhoffner merged commit 872d00d into main Oct 1, 2026
13 checks passed
jhoffner pushed a commit that referenced this pull request Oct 12, 2026
…roved

FIX-1907's epic spec merged to main (#3162); its six children are filed.
Epics table, Now line and the PLAN lane link to specs/epics/FIX-1907/.
Flags FIX-1701's stale Linear status (PR #2569 merged).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017pp7wCd87NW4BH7XVuF9Gv
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