Skip to content

author_scene: keep its bookkeeping in pieces live collaboration accepts - #1178

Merged
wass08 merged 2 commits into
mainfrom
fix/author-scene-live-sync
Oct 27, 2026
Merged

wass08 merged 2 commits into
mainfrom
fix/author-scene-live-sync

Conversation

@wass08

@wass08 wass08 commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Hosted author_scene fails in production on collaborative (organization) projects with live_sync_failed: Field "metadata" is not a supported persisted value. The conversion wrote its bookkeeping into the building's metadata, and live collaboration carries at most 64 KB per change and only plain JSON:

  • the revision baseline (authorSceneState: every node written plus source ids): 0.5–1.4 MB on multi-storey houses, holding undefined values;
  • the stored conversion (authorScene.payload + report): 60–180 KB on large houses.

Fix

  • Baseline split so each piece rides with what it describes: building authorSceneState = { version: 2, buildingId, seed }; each authored level authorSceneWritten = { ids, keys }; each authored node authorSceneBase (itself as written, plain JSON), the base of the next revision's three-way merge.
  • The stored payload is a script of the scene (export default <payload>, the one script type project files take); the building keeps its hash, as it does for the module and adapter. The report is no longer stored (the tool answers it). Everything written to metadata is plain JSON.

Revisions keep the exact merge semantics (person edits survive, deletions stay deleted, conflicts refused). Scenes with a v1 state still load; their next revision starts from the current scene as base. Reference inventory rows updated.

Two more limits on the community side are fixed in the private PR (more new materials than one change carries; the authority repairing a commit's half-built steps).

Verification

  • core 6160 tests, mcp 1338 tests pass; tsgo clean; Biome clean.
  • New core test: a four-storey conversion writes only plain JSON values, none past 62 KB.
  • Live, on a local collaborative organization project over hosted MCP (with the private PR): the 140-item two-storey villa bench payload converts (complete, green, 32 live changes, 236 nodes); after deleting the sofa, author_scene {replace: true} with no payload re-runs from the stored payload file, saves as one change, and the sofa stays deleted.

🤖 Generated with Claude Code


Note

Medium Risk
Changes how conversion state is persisted and merged across revisions; behavior is covered by tests but affects collaboration saves and MCP re-convert flows.

Overview
Fixes hosted author_scene failing live sync when conversion metadata exceeded the ~64 KB collaboration limit (whole-house baselines were 0.5–1.4 MB and could include values the sync layer rejects).

Conversion bookkeeping is sharded across the scene graph instead of one blob on the building: the building keeps a small v2 authorSceneState (seed + buildingId only); each authored level gets authorSceneWritten (node ids + source-key map); each authored node gets authorSceneBase for the next revision’s three-way merge. finalizeAuthorScene attaches this metadata on creates/updates, strips bookkeeping when merging, and serializes values with plain() so every persisted chunk is JSON-safe. Prior revisions are reloaded via authoredBaseline() (v1 monolith is no longer read—first revision after upgrade uses the live scene as base).

MCP author_scene stops embedding the full payload and report in building metadata: the payload is stored as a geometry script artifact (export default …) and referenced by hash; stored conversions rehydrate through readStoredPayload.

Reference inventory documents the new metadata keys (authorSceneWritten, authorSceneBase) and drops authorScene.report from non-reference provenance.

A new four-storey core test asserts each create/update payload is plain JSON and under 62 KB, with building state minimal.

Reviewed by Cursor Bugbot for commit ce3dd18. Bugbot is set up for automated code reviews on this repo. Configure here.

The conversion stored its whole baseline (every node it wrote, plus the
source-to-node ids) in one building metadata field. Past a single storey
that field outgrew the 64 KB live operation limit, and its undefined
values were not persistable, so hosted author_scene failed with
live_sync_failed on metadata.

The building now keeps only {version, buildingId, seed}; each authored
level lists the nodes it holds and their source keys; each node carries
its own as-written snapshot as the merge base.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Aymericr Aymericr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice approach, sharding the baseline onto the nodes it describes is the right shape for the 64 KB live-op limit, and the new four-storey test is a good guard. One blocker before this goes in, plus a smaller note.

Blocker: v1 scenes can no longer be revised. The description says scenes with a v1 state still load and their next revision starts from the current scene as base, but authorScene doesn't do that. authoredBaseline returns undefined for anything that isn't version: 2, so for a v1 scene previous is undefined while converted is still true (every authored level carries metadata.authorScene). The !previous && converted guard just below then refuses with existing_design, even with replace: true. So any building converted before this lands is stuck. Could you either fall back to the current scene as base for v1 (as finalizeAuthorScene already does) and seed from state.seed/state.ids when present, or make the refusal explicit with a clear message? A test that runs a v1-state scene through replace: true would pin it down.

Non-blocking: per-node size. Each create/update now carries the node plus authorSceneBase, a full copy of itself, so a node's change is roughly twice its size. The test only exercises the bed item, so a heavy node (a large geometry script item or a big slab/roof polygon) could still cross 62 KB. Worth either a size check in the test with the largest node kind you emit, or storing the base without fields a revision never merges.

CI is still running; I'll take another look once this is pushed.

@Aymericr Aymericr added the bug Something isn't working label Oct 27, 2026 — with Cursor

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

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 80ee6d3. Configure here.

function authoredBaseline(scene: SceneNodes, building: AnyNode) {
const state = building.metadata?.authorSceneState as AuthorSceneState | undefined
if (!(state?.version === 2 && state.buildingId === building.id && typeof state.seed === 'string'))
return undefined

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

v1 conversions cannot be revised

High Severity

authoredBaseline accepts only v2 authorSceneState, so a v1 building blob yields no previous. Levels still carry authorScene, which makes converted true and the existing_design gate refuse every replace: true revision. The merge fallback is also only existing levels, not the current scene the PR describes as the v1 base, so seed, ids, and person edits from the v1 snapshot are discarded.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 80ee6d3. Configure here.

const node = scene[id as keyof typeof scene] as AnyNode | undefined
nodes[id] = (node?.metadata?.authorSceneBase as AnyNode | undefined) ?? DELETED
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Deleted levels lose conversion baseline

Medium Severity

The reconstructed baseline only walks levels that still exist and still have authorSceneWritten. Deleting a level cascade-removes that list and every child’s authorSceneBase. A later revision therefore has no record those nodes were authored and deleted, so the same seed remints the same ids and the merge recreates the storey.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 80ee6d3. Configure here.

The stored conversion (the payload author_scene re-runs with no input)
lived in building.metadata.authorScene: 60-180 KB on a large house, past
what one live collaboration change carries. It is now a stored script of
the scene (export default <payload>), the building keeping its hash; the
report it duplicated from the tool's answer is no longer stored, and the
metadata written is plain JSON.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wass08 wass08 changed the title author_scene: keep its baseline in pieces live sync accepts author_scene: keep its bookkeeping in pieces live collaboration accepts Oct 27, 2026
@wass08
wass08 merged commit 984646b into main Oct 27, 2026
5 checks passed
@wass08
wass08 deleted the fix/author-scene-live-sync branch October 27, 2026 16:54
wass08 added a commit that referenced this pull request Oct 27, 2026
…ion removes one the payload drops

Since #1178 the conversion's baseline is read from each level's authorSceneWritten; a unit is a
child of the building, so a renamed unit stayed behind on a revision. The building now lists what
it holds itself, and the baseline reads it back.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
wass08 added a commit that referenced this pull request Oct 27, 2026
…ion removes one the payload drops

Since #1178 the conversion's baseline is read from each level's authorSceneWritten; a unit is a
child of the building, so a renamed unit stayed behind on a revision. The building now lists what
it holds itself, and the baseline reads it back.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
wass08 added a commit that referenced this pull request Oct 27, 2026
…ion removes one the payload drops

Since #1178 the conversion's baseline is read from each level's authorSceneWritten; a unit is a
child of the building, so a renamed unit stayed behind on a revision. The building now lists what
it holds itself, and the baseline reads it back.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
wass08 added a commit that referenced this pull request Oct 27, 2026
…ollow the wall (#1186)

* Units for agents: author_scene names them, create_unit / set_unit_members / list_units shared by both surfaces

A person asking for a condo, an apartment building or a hotel got rooms and no units: author_scene
had no unit field, and the unit tools lived on the MCP only, so the chat and Pro could not group
rooms into dwellings.

- author_scene: a room names its `unit`; the payload's `units` types or colours them. The operation
  makes one UnitNode per distinct name under the building, holding the zones of the rooms that name
  it (after open-plan joining; seeds of one enclosure naming different units are the defect
  `unit_split_room` and the room is in none), reports `units` and `ids['unit/<name>']`, and mints
  through the conversion's seed so a revision keeps an unchanged unit's id and drops one no longer
  named. `authorSceneChecks` gains `rooms_in_units`: where units are named, every room on a level
  with units is in one or is common area by name.
- create_unit, set_unit_members and list_units are shared contracts (`agent-tools/units.ts`) and
  pure operations (`agent-operations/units.ts`): buildingId optional (the viewed floor's building),
  refusals building_not_found / zone_not_found / zone_outside_building / unit_not_found /
  zone_in_other_unit (naming the unit; `move: true` moves the zone). Their edge cases are a case
  table (`__fixtures__/unit-cases.ts`) the core, MCP and chat runners read; the MCP registers them
  through SHARED_TOOLS with its previous output schemas and loses its one-off handlers and test.
- get_zones answers each zone's unitId and unit name (null: common area).
- The pascal-3d skill says what a unit is, top-down (author_scene) and bottom-up (the three tools).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Opening frame depth follows the wall by default

A door's or window's `frameDepth` was a fixed 0.07 m schema default while
walls are 0.1 m by default and often thicker, so the wall's cut faces
showed around every frame the AI or the tools created. `frameDepth` is now
optional: left out, the frame is the host wall's thickness plus a 1 cm lip
on each face (`resolveOpeningFrameDepth` in core); a stored number stays
what it was, so old scenes render unchanged.

Every reader goes through the resolver with the host wall's thickness: the
door and window systems (hit box, frame, leaf offsets, sill, glass and
dividers), the move tools' ghosts and facing pose, the plan symbol's
offset plane, the schedules and the door documentation. The placement
tools stop writing `frameDepth`, so new openings are auto; the panels show
the resolved value as "Depth (auto)" and an Auto pill clears an explicit
one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* MCP templates leave the frame depth to the wall; the auto rule in the schema page

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Catalogs: the auto frame-depth panel copy, drafts awaiting review

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* author_scene: units ride the building's own baseline list, so a revision removes one the payload drops

Since #1178 the conversion's baseline is read from each level's authorSceneWritten; a unit is a
child of the building, so a renamed unit stayed behind on a revision. The building now lists what
it holds itself, and the baseline reads it back.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* author_scene checks: a split-room unit defect is the units check's alone; common area is named by common-area words only

Review of #1186: unit_split_room was recorded on a room id, so the floors check counted it as a
failed floor cover (Bugbot). And the common-area test matched substrings, so "Hall bedroom" or
"Storage loft" inside an apartment slipped past rooms_in_units (Aymeric); a room is common area
when every word of its name is a common-area word or a qualifier (Entry hall, Stair landing 2).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants