Skip to content

Harden live actor diagnostics and retries#40

Merged
phroi merged 9 commits into
masterfrom
review/live-ops-hardening
May 21, 2026
Merged

Harden live actor diagnostics and retries#40
phroi merged 9 commits into
masterfrom
review/live-ops-hardening

Conversation

@phroi
Copy link
Copy Markdown
Member

@phroi phroi commented May 21, 2026

Why

Live iCKB actor runs need public evidence that explains why matching did or did not progress, and transient chain/RPC races should not prematurely consume bounded iterations or stop the bot.

Changes

  • Add exported match-search diagnostics to @ickb/order and include them in bot decision transcripts.
  • Mark bot iteration failures as retryable or terminal, including retryable fetch transport failures.
  • Make tester fresh-order skips depend on actionable live-fee matching, with a shorter fresh window and safer estimate handling.
  • Carry matchability/candidate counts into supervisor public summaries without leaking full transaction shapes.
  • Stop the supervisor loop on incidents before generic nonzero exits.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive match-search diagnostics across the bot, supervisor, and order packages, providing better visibility into order matching and rejection reasons. It refines error handling by categorizing fetch failures as retryable and improves the tester's logic for skipping fresh orders based on their actionability. Additionally, the supervisor now tracks matchable order and candidate counts in its public state. Feedback for this PR suggests using shared BigInt comparison utilities in the order package instead of redefining local helper functions to ensure consistency and avoid potential precision issues.

Comment thread packages/order/src/order.ts Outdated
@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 21, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the bot's monitoring and diagnostic capabilities by introducing detailed match-search statistics and structured error reporting. It updates the order matching engine to track candidate viability and rejection reasons, which are now surfaced through bot events and captured by the supervisor. Additionally, the tester's logic for skipping fresh orders was refined to account for current fee rates and marketability. Feedback was provided to ensure that the new diagnostic counters for insufficient allowances are mutually exclusive to prevent double-counting in the reported statistics.

Comment thread packages/order/src/order.ts
@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 21, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive match-search diagnostics to the OrderManager.bestMatch function and propagates these diagnostics through the bot and supervisor applications. It also refines error handling for bot iterations by distinguishing between retryable and terminal failures, and updates the tester application to include fee-aware actionability checks for orders. Feedback focuses on optimizing the bestMatch implementation to reduce redundant iterations and leveraging the OrderMatcher directly for single-order checks in the tester to improve efficiency and simplify the API surface.

Comment thread packages/order/src/index.ts
Comment thread packages/order/src/order.ts
Comment thread apps/tester/src/freshMatchableOrderSkip.ts
Comment thread apps/tester/src/freshMatchableOrderSkip.ts
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive match-search diagnostics within the OrderManager, enabling the bot and supervisor to track detailed order matching metrics and rejection reasons. It refines error handling by identifying retryable fetch failures and managing unrepresentable tester estimates. Additionally, the tester's logic for skipping fresh orders was updated with a more precise actionability check, and the block threshold for these skips was significantly reduced. Feedback was provided to optimize the isActionableOrder function in the tester by utilizing OrderMatcher directly for single-order evaluations instead of the more resource-intensive bestMatch search.

Comment thread apps/tester/src/freshMatchableOrderSkip.ts
@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 21, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive match diagnostics across the bot, supervisor, and order packages, providing detailed insights into order matching and rejection reasons. It refactors the bestMatch logic to collect these diagnostics and updates the bot's error handling to better manage retryable failures, such as fetch transport errors. Additionally, the PR adjusts tester parameters, including a significant reduction in MAX_ELAPSED_BLOCKS, and reorders supervisor loop logic to prioritize incident reporting. Feedback was provided to use a more idiomatic approach for counting matchable orders in the order package.

Comment thread packages/order/src/order.ts Outdated
@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 21, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive diagnostic tracking for order matching across the bot, supervisor, and order packages, refactoring the bestMatch logic to collect detailed statistics on match candidates and rejection reasons. It also improves error handling by identifying retryable "fetch failed" errors, updates the tester's order skipping logic to be fee-aware, and adjusts the supervisor loop to prioritize incident reporting. Feedback was provided to ensure that transient network errors are treated as unconfirmed statuses rather than fatal errors, adhering to repository polling guidelines.

Comment thread apps/bot/src/index.ts
@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 21, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive match-search diagnostics and improves error handling for retryable bot iterations. Key changes include the addition of detailed diagnostic tracking in the OrderManager to report candidate counts and rejection reasons, and the expansion of retryable errors to include fetch failures. The supervisor and tester apps were updated to utilize these new diagnostics and handle unrepresentable estimate errors. Additionally, the tester's logic for skipping fresh matchable orders was refined to consider actual actionability and current fee rates. I have no feedback to provide as there were no review comments to assess.

@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 21, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive match-search diagnostics within the OrderManager and propagates this data through the bot and supervisor applications. It refactors the bestMatch logic to collect detailed statistics on candidate evaluation, including reasons for rejection such as insufficient allowance or non-positive gain. Additionally, it improves error handling by identifying retryable fetch failures and unrepresentable tester estimates, updates the tester's fresh order skip logic to use actionable criteria, and adjusts constants and documentation related to bot iteration behavior. I have no feedback to provide as there were no review comments to assess.

@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 21, 2026

LGTM

Phroi %163

@phroi phroi merged commit 3147539 into master May 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant