-
Notifications
You must be signed in to change notification settings - Fork 37
feat(beads): add FailureReason type and extend updateBeadStatus() with failure reasons #1271
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
6eca0da
1df9a61
1706409
8d88582
8b9ea51
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 |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ import type { | |
| BeadStatus, | ||
| BeadPriority, | ||
| BeadType, | ||
| FailureReason, | ||
| } from '../../types'; | ||
| import type { BeadEventType } from '../../db/tables/bead-events.table'; | ||
|
|
||
|
|
@@ -255,7 +256,8 @@ export function updateBeadStatus( | |
| sql: SqlStorage, | ||
| beadId: string, | ||
| status: string, | ||
| agentId: string | null | ||
| agentId: string | null, | ||
| failureReason?: FailureReason | ||
| ): Bead { | ||
| const bead = getBead(sql, beadId); | ||
| if (!bead) throw new Error(`Bead ${beadId} not found`); | ||
|
|
@@ -285,6 +287,7 @@ export function updateBeadStatus( | |
| eventType: 'status_changed', | ||
| oldValue: oldStatus, | ||
| newValue: status, | ||
| metadata: status === 'failed' && failureReason ? { failure_reason: failureReason } : {}, | ||
| }); | ||
|
|
||
| // If the bead reached a terminal status and is tracked by a convoy, | ||
|
|
@@ -1005,7 +1008,14 @@ export function addBeadToConvoy(sql: SqlStorage, beadId: string, convoyId: strin | |
| const metadataPatch: Record<string, unknown> = { convoy_id: convoyId }; | ||
| if (featureBranch) metadataPatch.feature_branch = featureBranch; | ||
|
|
||
| <<<<<<< convoy/bead-failure-reasons-1172/22d1b15b/gt/ember/184533ed | ||
|
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. CRITICAL: Unresolved merge conflict markers left in committed code This |
||
| const existingMetadata = z | ||
| .record(z.string(), z.unknown()) | ||
| .catch({}) | ||
| .parse(typeof bead.metadata === 'string' ? JSON.parse(bead.metadata) : (bead.metadata ?? {})); | ||
| ======= | ||
| const existingMetadata = cloneBeadMetadata(bead.metadata); | ||
| >>>>>>> gastown-staging | ||
| const merged = { ...existingMetadata, ...metadataPatch }; | ||
|
|
||
| query( | ||
|
|
@@ -1076,7 +1086,14 @@ export function removeBeadFromConvoy(sql: SqlStorage, beadId: string): string | | |
| // Strip convoy_id + feature_branch from metadata | ||
| const bead = getBead(sql, beadId); | ||
| if (bead) { | ||
| <<<<<<< convoy/bead-failure-reasons-1172/22d1b15b/gt/ember/184533ed | ||
|
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. CRITICAL: Second unresolved merge conflict block This conflict marker sequence has the same problem as the earlier block: the file cannot compile while these markers are present. |
||
| const existingMetadata = z | ||
| .record(z.string(), z.unknown()) | ||
| .catch({}) | ||
| .parse(typeof bead.metadata === 'string' ? JSON.parse(bead.metadata) : (bead.metadata ?? {})); | ||
| ======= | ||
| const existingMetadata = cloneBeadMetadata(bead.metadata); | ||
| >>>>>>> gastown-staging | ||
| delete existingMetadata.convoy_id; | ||
| delete existingMetadata.feature_branch; | ||
| const timestamp = now(); | ||
|
|
||
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.
WARNING: The new
failureReasonparameter is not exposed through the DO boundarycloudflare-gastown/src/dos/Town.do.ts:728still exposesupdateBeadStatus(beadId, status, agentId)and forwards only those three arguments intobeadOps.updateBeadStatus(...). Any caller that goes through the RPC/HTTP/TRPC path still has no way to persist aFailureReason, so this metadata is only reachable from code already running inside the DO.