feat(mobile): notify when agent sessions need input#4545
Conversation
Code Review SummaryStatus: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (19 files)
Fix these issues in Kilo Cloud Previous Review Summary (commit 98be1fc)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 98be1fc)Status: 6 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (50 files)
Reviewed by gpt-5.6-sol · Input: 142.7K · Output: 16.3K · Cached: 1M Review guidance: REVIEW.md from base branch |
|
Duplicate of #4445 |
| // action, so the producer ignores it. | ||
| export const attentionIntentSchema = z.discriminatedUnion('kind', [ | ||
| z.object({ kind: z.literal('raise'), reason: attentionReasonSchema }), | ||
| z.object({ kind: z.literal('resolve'), reason: attentionReasonSchema }), |
There was a problem hiding this comment.
WARNING: Remote CLI resolves are rejected by the tightened schema
UserConnectionDO.recordAttentionEvent still maps every resolve to { kind: 'resolve' } without forwarding intent.reason. This schema now rejects those calls as invalid_input, and the caller ignores that result, so remote-CLI questions, permissions, and suggestions remain pending after the user responds and can still send stale pushes. Update that producer in the same rollout or accept the previous shape at this boundary.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| const cloudAgentAttentionReasonSchema = z.enum(['question', 'permission']); | ||
| export const cloudAgentAttentionIntentSchema = z.discriminatedUnion('kind', [ | ||
| z.object({ kind: z.literal('raise'), reason: cloudAgentAttentionReasonSchema }), | ||
| z.object({ kind: z.literal('resolve'), reason: cloudAgentAttentionReasonSchema }), |
There was a problem hiding this comment.
WARNING: Requiring reason breaks rolling deployment compatibility
The currently deployed Cloud Agent producer from the previous revision sends { kind: 'resolve' }. If session-ingest is deployed before the updated producer, this boundary rejects every resolve as invalid_input, leaving raised notifications pending until the producer rollout completes. Preserve the old resolve shape during the rollout or enforce producer-first deployment before tightening the shared RPC contract.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| // but accept the boolean `true` as well so a future refactor that | ||
| // passes the parsed value through stays safe. | ||
| if (metricsEmitted === 'true' || metricsEmitted === true) return false; | ||
| if (metricsAlarmAt === null || metricsAlarmAt === undefined) return false; |
There was a problem hiding this comment.
WARNING: Existing metrics alarms are discarded after deployment
DOs whose alarms were scheduled by the pre-PR code have a platform alarm but no persisted metricsAlarmAt. Returning false here makes that already-fired alarm skip emission, and the final rescheduleAlarm() then finds no persisted work and deletes it, permanently losing those session metrics. The missing-deadline case needs to preserve the legacy behavior for alarms that span deployment.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| ) | ||
| ) | ||
| .orderBy(asc(attentionOutbox.next_attempt_at)) | ||
| .all(); |
There was a problem hiding this comment.
WARNING: Each claim materializes the entire due queue
This replaces the indexed LIMIT 1 claim with .all(), even though the function leases only one row. dispatchOutboxBatch calls it up to 25 times, so a large per-session backlog repeatedly allocates and scans the remaining queue and can exhaust Durable Object CPU or memory before it drains. Keep the deadline predicate in the query and select a bounded candidate instead of materializing every due row on each claim.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Summary
Verification
scripts/typecheck-all.sh --changes-onlypnpm lintE2E limitation