Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/retryable-monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ The Notion database should be configured with the following columns:
| `CreatedAt` | Date | Timestamp (ms) when the retryable was created |
| `Timeout` | Number | Expiration timestamp in milliseconds |
| `Status` | Select | Workflow status (`Untriaged`, `Investigating`, `Expired`, `Resolved`.) |
| `Priority` | Select | Optional manual priority (`High`, `Medium`, `Low`, `Unset`) |
| `TokensDeposited` | Text | Amount, symbol, and token address (e.g. `1.23 USDC ($1.23) (0xToken...)`) |
| `GasPriceProvided` | Text | Gas price submitted when the ticket was created |
| `GasPriceAtCreation` | Text | L2 gas price at the time of ticket creation |
Expand Down
1 change: 0 additions & 1 deletion packages/retryable-monitor/core/retryableChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export const checkRetryables = async (
createdAt: Date.now(), // fallback; won't overwrite real one
timeout: Date.now() + SEVEN_DAYS_IN_SECONDS * 1000,
status: 'Executed',
priority: 'Unset',
chainId: childChain.chainId,
chain: childChain.name,
metadata: {
Expand Down
1 change: 0 additions & 1 deletion packages/retryable-monitor/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export interface OnRetryableFoundParams {
createdAt: number
timeout?: number
status:string
priority?: 'High' | 'Medium' | 'Low' | 'Unset'
decision?: string
chainId: number
chain: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export const handleFailedRetryablesFound = async (
createdAt: Number(childChainRetryableReport.createdAtTimestamp) * 1000,
timeout: Number(childChainRetryableReport.timeoutTimestamp) * 1000,
status: childChainRetryableReport.status,
priority: 'Unset',
chainId: childChain.chainId,
chain: childChain.name,
metadata: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { notionClient, databaseId } from './createNotionClient'
import { postSlackMessage } from '../slack/postSlackMessage'
import { ChildNetwork} from '../../../utils'

import { ChildNetwork } from '../../../utils'

const formatDate = (iso: string | undefined) => {
if (!iso) return '(unknown)'
Expand All @@ -26,7 +25,9 @@ const isNearExpiry = (iso: string | undefined, hours = 24) => {
return timeLeftMs > 0 && timeLeftMs <= hours * 60 * 60 * 1000
}

export const alertUntriagedNotionRetryables = async (childChains: ChildNetwork[] = []) => {
export const alertUntriagedNotionRetryables = async (
childChains: ChildNetwork[] = []
) => {
const allowedChainIds = childChains.map(c => c.chainId)
const response = await notionClient.databases.query({
database_id: databaseId,
Expand Down Expand Up @@ -61,9 +62,20 @@ export const alertUntriagedNotionRetryables = async (childChains: ChildNetwork[]

const timeoutRaw = props?.timeoutTimestamp?.date?.start
const timeoutStr = formatDate(timeoutRaw)
const retryableUrl = props?.ChildTx?.title?.[0]?.text?.content || '(unknown)'
const parentTx = props?.ParentTx?.rich_text?.[0]?.text?.content || '(unknown)'
const deposit = props?.TotalRetryableDeposit?.rich_text?.[0]?.text?.content || '(unknown)'
const retryableUrl =
props?.ChildTx?.title?.[0]?.text?.content || '(unknown)'
const parentTx =
props?.ParentTx?.rich_text?.[0]?.text?.content || '(unknown)'

const ethDeposit =
props?.TotalRetryableDeposit?.rich_text?.[0]?.text?.content || ''
const tokenDeposit =
props?.TokensDeposited?.rich_text?.[0]?.text?.content || ''
const deposit =
[ethDeposit, tokenDeposit]
.filter(s => s && s !== '0.0 ETH ($0.00)')
.join(' and ') || '(unknown)'

const decision = props?.Decision?.select?.name || '(unknown)'

const now = Date.now()
Expand All @@ -74,17 +86,17 @@ export const alertUntriagedNotionRetryables = async (childChains: ChildNetwork[]

if (decision === 'Triage') {
if (hoursLeft <= 72) {
message = `🚨🚨 Retryable ticket needs IMMEDIATE triage (expires soon!):\n• Retryable: ${retryableUrl}\n• Timeout: ${timeoutStr}\n• Parent Tx: ${parentTx}\n• Deposit: ${deposit}\n→ Please triage urgently.`
message = `🚨🚨 Retryable ticket needs IMMEDIATE triage (expires soon!):\n• Retryable: ${retryableUrl}\n• Timeout: ${timeoutStr}\n• Parent Tx: ${parentTx}\n• Total value deposited: ${deposit}\n→ Please triage urgently.`
} else {
message = `⚠️ Retryable ticket needs triage:\n• Retryable: ${retryableUrl}\n• Timeout: ${timeoutStr}\n• Parent Tx: ${parentTx}\n• Deposit: ${deposit}\n→ Please review and decide whether to redeem or ignore.`
message = `⚠️ Retryable ticket needs triage:\n• Retryable: ${retryableUrl}\n• Timeout: ${timeoutStr}\n• Parent Tx: ${parentTx}\n• Total value deposited: ${deposit}\n→ Please review and decide whether to redeem or ignore.`
}
} else if (decision === 'Should Redeem') {
if (!isNearExpiry(timeoutRaw)) continue
message = `🚨 Retryable marked for redemption and nearing expiry:\n• Retryable: ${retryableUrl}\n• Timeout: ${timeoutStr}\n• Parent Tx: ${parentTx}\n• Deposit: ${deposit}\n→ Check why it hasn't been executed.`
message = `🚨 Retryable marked for redemption and nearing expiry:\n• Retryable: ${retryableUrl}\n• Timeout: ${timeoutStr}\n• Parent Tx: ${parentTx}\n• Total value deposited: ${deposit}\n→ Check why it hasn't been executed.`
} else {
continue
}

await postSlackMessage({ message })
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export async function syncRetryableToNotion(
ParentTx,
createdAt,
status,
priority = 'Unset',
metadata,
} = input

Expand Down Expand Up @@ -43,7 +42,6 @@ export async function syncRetryableToNotion(
const notionProps: Record<string, any> = {
ParentTx: { rich_text: [{ text: { content: ParentTx } }] },
CreatedAt: { date: { start: new Date(createdAtMs).toISOString() } },
Priority: { select: { name: priority } },
ChainID: { number: input.chainId },
Chain: { rich_text: [{ text: { content: input.chain } }] },
}
Expand Down