Skip to content

fix(web): fail closed on malformed persisted turn-change records #698

Closed

Description

@outlier27-cell

Confirmed defect

At latest origin/main 3cb2ecf, readTurnChangesDetail accepts persisted JSON with state: [complete] because its enum guard uses String(value). It returns the array as a WebTurnChanges state and bypasses the state === complete consistency checks. statsUnavailable has the same coercion pattern. The record byte budget also counts path and diff but excludes previousPath.

Production-function evidence

Imported the actual web/protocol/turn-changes.ts in isolated Node. Input {version:2,source:file-tools,sessionId:s,promptEntryId:p,state:[complete],fileCount:0,files:[],additions:0,deletions:0} is accepted and returned unchanged in the state field. No model, live runtime or private Session was involved.

Requirement

Require actual strings from the enum allowlists; reject malformed previous paths consistently; account for retained previousPath UTF-8 bytes in the existing record budget. Keep valid v1/v2 records and current full/partial/unavailable semantics. Add baseline-failing decoder regressions, run check/test and publish a standalone PR.

Deduplication and claim

All-state searches turn changes validation, turn changes malformed and readTurnChangesDetail found no equivalent fix. Claimed on independent fix/turn-change-record-validation, based on latest origin/main above.

Activity

  1. outlier27-cell commented on Oct 7, 2026

    @outlier27-cell
    ContributorAuthor

    Evidence record and validation boundary are in the branch docs/research record; targeted regression was red on origin/main and green after the fix. Full local Windows limitations are stated in the PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions