fix: isolate malformed ProjectData message rows - #1695
Closed
simple-agent-manager[bot] wants to merge 3 commits into
Closed
fix: isolate malformed ProjectData message rows#1695simple-agent-manager[bot] wants to merge 3 commits into
simple-agent-manager[bot] wants to merge 3 commits into
Conversation
Contributor
|
30 tasks
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
ProjectData.getMessages()so one malformedchat_messagesrow is skipped and warn-logged instead of throwing the whole list read.{ messages, hasMore }response contract and existing ordering/pagination behavior.Validation
pnpm --filter @simple-agent-manager/api lint— PASS, existing warnings onlypnpm --filter @simple-agent-manager/api typecheck— PASSpnpm test— FAIL outside touched API area: unrelated monorepo failures/timeouts inpackages/shared,packages/providers,packages/ui,packages/terminal, andpackages/acp-clientpnpm --filter @simple-agent-manager/api exec vitest run tests/unit/durable-objects/project-data-messages.test.ts tests/unit/services/bootstrap.test.ts— PASS, 11 testspnpm build— PASSStaging Verification (REQUIRED for all code changes — merge-blocking)
Staging Verification Evidence
Not completed. This PR must not be merged until human review decides whether staging is required for this tightly-scoped backend fault-isolation fix.
UI Compliance Checklist (Required for UI changes)
End-to-End Verification (Required for multi-component changes)
Data Flow Trace
ProjectData.getMessages()querieschat_messages, applies the existing RPC size guard, orders rows, then now parses each row inside an isolatedtry/catchinapps/api/src/durable-objects/project-data/messages.ts. Malformed rows logmessages.list_row_skippedwith row/session context and are omitted; valid rows are returned in the samemessagesarray shape with unchangedhasMorecomputation.Untested Gaps
No live staging verification was completed. Automated coverage includes normal ordering, good/bad/good malformed rows, compact parser isolation, all-bad empty result, skip logging, and bootstrap TTL wording test updates.
Post-Mortem (Required for bug fix PRs)
What broke
A ProjectData Durable Object message list read could throw if any fetched message row no longer matched the current row schema, breaking retrieval for otherwise valid session history.
Root cause
getMessages()mapped every fetched row through throwing parsers without per-row fault isolation.Class of bug
Multi-row Durable Object SQLite list read where one malformed row poisons the entire collection response.
Why it wasn't caught
Existing tests covered ordering and pagination but did not seed malformed rows among valid rows for the message list path.
Process fix included in this PR
Regression tests in
apps/api/tests/unit/durable-objects/project-data-messages.test.tsnow cover good/bad/good, compact-mode bad row, and all-bad cases. Existing process rule.claude/rules/50-list-read-row-fault-isolation.mdalready documents this bug class.Post-mortem file
tasks/archive/2026-07-29-project-data-list-row-isolation.mdSpecialist Review Evidence (Required for agent-authored PRs)
needs-human-reviewlabel added and merge deferred to humanhasMorecalculation from raw fetched rows, avoids RPC contract change, and adds structured warn logs. Bootstrap KV TTL runtime behavior unchanged.Note: initial delegated reviewer subagents failed to inspect files because their sandbox read commands hit
bwrap: loopback: Failed RTM_NEWADDR; the table above reflects the completed in-session local reviews performed with the same skill checklists after that failure.Exceptions (If any)
Agent Preflight (Required)
Classification
External References
N/A: no external API/library behavior changed.
Codebase Impact Analysis
Affected code paths:
apps/api/src/durable-objects/project-data/messages.ts— ProjectData Durable Object message list read parsing.apps/api/tests/unit/durable-objects/project-data-messages.test.ts— targeted malformed row regression coverage.apps/api/src/services/bootstrap.tsandapps/api/tests/unit/services/bootstrap.test.ts— stale TTL wording only.Documentation & Specs
N/A: no public docs or API contract changes. Task record added at
tasks/active/2026-07-29-project-data-list-row-isolation.md.Constitution & Risk Check
Checked Principle XI: no new configurable business values, URLs, timeouts, or limits were introduced. Bootstrap TTL remains configurable through the existing environment override; wording now reflects that.