Repository navigation
fix: report lost agent edits through platform telemetry #20883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e82040d
8b6d484
2bfbf60
10f2a95
e1a7b74
a8f5f31
1ce3f0e
9cdea09
2baa01c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,8 @@ export const DEV_EVENT_KINDS = [ | |
| 'doc_ops_result', | ||
| 'doc_ops_result_dropped', | ||
| 'human_ops_settled', | ||
| 'mint_divergence', | ||
| 'host_rejected', | ||
| 'doc_reset', | ||
| 'doc_nodes_changed', | ||
| 'schema_error', | ||
|
|
@@ -96,6 +98,7 @@ const STRUCTURAL_STRING_KEYS = new Set([ | |
| 'doc_id', | ||
| 'failed', | ||
| 'frame_type', | ||
| 'graph_id', | ||
| 'id', | ||
| 'kind', | ||
| 'level', | ||
|
|
@@ -104,6 +107,7 @@ const STRUCTURAL_STRING_KEYS = new Set([ | |
| 'op', | ||
| 'op_id', | ||
| 'op_ids', | ||
| 'operations', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the mint_divergence context now carries Generated by Claude Code
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in e1a7b74ed0: added |
||
| 'outcome', | ||
| 'phase', | ||
| 'prompt_id', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ import { | |
| } from './agentCrdtDocLifecycle' | ||
| import type { GraphOperation } from './graphOperations' | ||
| import type { DocPromotedWidgets } from './agentSubgraphDefinitions' | ||
| import { reportLostEdit } from './reportLostEdit' | ||
|
|
||
| export interface DocOpMinterDeps { | ||
| /** Slice 00's product gate. */ | ||
|
|
@@ -446,12 +447,15 @@ export function attachDocOpMinter(deps: DocOpMinterDeps): DocOpMinter { | |
| if (node.graph !== graph) return null | ||
| const snapshot = wireNodeSnapshot(node) | ||
| if (!snapshot) { | ||
| reportOnce( | ||
| `snapshot:${nodeKey(graph.id, node.id)}`, | ||
| 'Agent node add has no snapshot', | ||
| 'agent_crdt_node_snapshot_missing', | ||
| { graphId: graph.id, nodeId: node.id } | ||
| ) | ||
| const key = `snapshot:${nodeKey(graph.id, node.id)}` | ||
| if (reported.has(key)) return null | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (non-blocking): the |
||
| reported.add(key) | ||
| reportLostEdit('mint_divergence', [{ op: 'add_node' }], { | ||
| code: 'missing_node_snapshot', | ||
| errorType: 'agent_crdt_node_snapshot_missing', | ||
| graphId: graph.id, | ||
| nodeId: node.id | ||
| }) | ||
| return null | ||
| } | ||
| return { | ||
|
|
@@ -537,7 +541,7 @@ export function attachDocOpMinter(deps: DocOpMinterDeps): DocOpMinter { | |
| const rootGraphId = deps.boundRootGraphId() ?? graph.id | ||
| const routed = routedWidgetOperation(graph, rootGraphId, event, owner, deps) | ||
| if ('unresolvedGraphId' in routed) { | ||
| reportUnresolvedOwner(routed.unresolvedGraphId, event) | ||
| reportUnresolvedWidgetOwner(routed.unresolvedGraphId, event) | ||
| return | ||
| } | ||
| if ('reason' in routed) { | ||
|
|
@@ -547,6 +551,21 @@ export function attachDocOpMinter(deps: DocOpMinterDeps): DocOpMinter { | |
| schedule({ kind: 'op', operation: routed }) | ||
| } | ||
|
|
||
| function reportUnresolvedWidgetOwner( | ||
| graphId: string, | ||
| event: IntentOf<'set_widget'> | ||
| ): void { | ||
| const key = `owner:${nodeKey(graphId, event.nodeId)}` | ||
| if (reportedRefusals.has(key)) return | ||
| reportedRefusals.add(key) | ||
| reportLostEdit('mint_divergence', [{ op: 'set_widget' }], { | ||
| code: 'unresolvable_widget_owner', | ||
| errorType: 'agent_crdt_widget_owner_unresolved', | ||
| graphId, | ||
| nodeId: event.nodeId | ||
| }) | ||
| } | ||
|
|
||
| function takeHeldWrite( | ||
| event: IntentOf<'set_widget'> | ||
| ): HeldPromotedWrite | null { | ||
|
|
@@ -556,19 +575,6 @@ export function attachDocOpMinter(deps: DocOpMinterDeps): DocOpMinter { | |
| return held | ||
| } | ||
|
|
||
| function reportUnresolvedOwner( | ||
| graphId: string, | ||
| event: IntentOf<'set_widget'> | ||
| ): void { | ||
| reportOnce( | ||
| `owner:${nodeKey(graphId, event.nodeId)}`, | ||
| 'Agent widget write has an unresolvable owner', | ||
| 'agent_crdt_widget_owner_unresolved', | ||
| { graphId, nodeId: event.nodeId }, | ||
| reportedRefusals | ||
| ) | ||
| } | ||
|
|
||
| function holdOrRefuseWidgetWrite( | ||
| rootGraphId: string, | ||
| event: IntentOf<'set_widget'>, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (non-blocking): the code caps platform reports at 3 per 60 s per sender (
mayReportLostEdit). The dev-panel entry is the only per-batch record.doc_resetdrains share that cap, so a reset of 3 or more batches can hide a real timeout or transport loss in the same window, and filtering outcode:doc_resetwon't bring it back. Worth stating the cap here, and either keepingdoc_resetout of it or saying it shares it.