Repository navigation
Internal cleanup - #33821
Internal cleanup#33821
Conversation
…pshot turn ids in the contract
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5715f736-e29c-47a5-acae-114754fc6cbf
Files selected for processing: 12-
cloud/apps/connector/src/connector-events.test.tscloud/apps/connector/src/connector-hosts.tscloud/apps/connector/src/connector-inbox.test.tscloud/apps/connector/src/connector-server-harness.test-fixture.tscloud/apps/connector/src/connector-server.tscloud/apps/connector/src/connector-threads.tscloud/apps/connector/src/machine-routes.tscloud/packages/connector-contract/src/connector-endpoints.tscloud/packages/connector-contract/src/connector-limits.tscloud/packages/connector-contract/src/contract.test.tscloud/packages/connector-contract/src/event-messages.tscloud/packages/connector-contract/src/hello-messages.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
-
…shot restores the same turn to working
There was a problem hiding this comment.
Actionable comments posted: 3

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2418949c-1f11-43a6-bb41-bcf149a6516d
Files selected for processing: 10-
cloud/apps/connector/src/connector-events.test.tscloud/apps/connector/src/connector-hosts.tscloud/apps/connector/src/connector-inbox.test.tscloud/apps/connector/src/connector-threads.tscloud/apps/connector/src/machine-routes.tscloud/packages/connector-contract/src/connector-limits.tscloud/packages/connector-contract/src/contract.test.tscloud/packages/connector-contract/src/delivery-messages.tscloud/packages/connector-contract/src/event-messages.tscloud/packages/connector-contract/src/hello-messages.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
| const entry = { conversation, paneKey: 'pane-1', agent: 'claude', turnId: 100 } | ||
| await events([{ conversation, paneKey: 'pane-1', kind: 'turn-started', at: 100 }]) | ||
| await events([{ kind: 'snapshot', conversations: [{ ...entry, working: false, prompt }] }]) | ||
| expect(await thread()).toMatchObject({ open_turn_id: 100, turn_state: 'unverifiable' }) |
There was a problem hiding this comment.
Normalize open_turn_id in this snapshot test too.
The database returns "100", so the numeric assertion at Line 224 fails in the reported pipeline run. Line 231 has the same mismatch and will fail when reached. Convert open_turn_id with Number(...) for these assertions. The earlier review comment at Line 211 identifies the same issue in the other snapshot test.
Proposed fix
-
- expect(await thread()).toMatchObject({ open_turn_id: 100, turn_state: 'unverifiable' }) + const unverifiable = await thread() + expect(Number(unverifiable?.open_turn_id)).toBe(100) + expect(unverifiable).toMatchObject({ turn_state: 'unverifiable' }) ... - expect(await thread()).toMatchObject({ open_turn_id: 100, turn_state: 'ended' }) + const ended = await thread() + expect(Number(ended?.open_turn_id)).toBe(100) + expect(ended).toMatchObject({ turn_state: 'ended' })
Also applies to: 231-231
🧰 Tools
-
🪛 GitHub Actions: Cloud Verify / 4_test.txt
-
[error] 224-224: The
pnpm testpipeline failed in the connector test suite. Inrestores the same turn to working once a snapshot sees it working again, never an ended one, the assertion expectedopen_turn_id: 100but received the string"100";turn_statewas alsounverifiable.
🪛 GitHub Actions: Cloud Verify / test
-
[error] 224-224: The
pnpm teststep failed in the connector test suite. Test “restores the same turn to working once a snapshot sees it working again, never an ended one” expectedopen_turn_id: 100but received the string"100"; the actualturn_statewasunverifiable.
-
Source: Pipeline failures
| if (event.kind === 'snapshot') { | ||
| // Not working never means done: an open turn the snapshot doesn't show working (or doesn't | ||
| // list; it lists every linked conversation) is unverifiable, and an unlisted one has no prompt. | ||
| // list; it lists recently active linked conversations) is unverifiable, and an unlisted one has no prompt. |
There was a problem hiding this comment.
Preserve prompts for conversations omitted by the snapshot limit.
If a host has 201 eligible conversations, the 200-entry cap omits at least one. Lines 71-79 then mark an omitted working thread unverifiable and clear its pending_prompt, even if that thread still has an approval awaiting an answer. Do not treat omission from a capped snapshot as evidence that the prompt is gone. Limit this cleanup to conversations the host explicitly reports as inactive, or run it only when the snapshot is complete.
| maxSnapshotConversations: 200, | ||
| snapshotActiveWindowMs: 7 * 24 * 60 * 60 * 1000, | ||
| // A hello lists the most recently used projects, up to this many, and always fits maxRequestBytes. | ||
| maxHelloProjects: 500, |
There was a problem hiding this comment.
Correct the hello size guarantee.
If 500 projects each have a 200-character name, remote, and label, those strings alone can exceed 256 KiB. The server will reject that hello with 413, despite the adjacent claim that the project cap always fits maxRequestBytes. State that the desktop must trim the serialized request by bytes; do not present maxHelloProjects as a size guarantee.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · Require turnId for prompt-bearing snapshots. · connector-threads.ts:82-110
cloud/apps/connector/src/connector-threads.ts:82-110
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winRequire
turnIdfor prompt-bearing snapshots.A snapshot entry may omit
turnId, butapplyEventsstill persists itspending_promptand skips the turn-order update. A later accepted olderturn-endedevent can then clear the prompt and mark the conversationended.Require
turnIdwhenpromptis non-null before persisting the prompt. The server cannot distinguish an older end from the current turn without that identity.This is independent of the capped-snapshot omission cleanup. The failure occurs for a listed conversation in the per-entry update.

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d402b65c-3088-4b8d-b802-0c16e137749e
Files selected for processing: 1-
cloud/apps/connector/src/connector-events.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
…d-hello-rev # Conflicts: # cloud/apps/connector/src/connector-inbox.test.ts
…ts 200, as the cloud now assigns it
No description provided.