Skip to content

Split bot runtime and tooling#62

Open
phroi wants to merge 8 commits into
masterfrom
review/bot-split
Open

Split bot runtime and tooling#62
phroi wants to merge 8 commits into
masterfrom
review/bot-split

Conversation

@phroi

@phroi phroi commented Jul 8, 2026

Copy link
Copy Markdown
Member

Why

The bot slice now depends on the split SDK and protocol packages. Moving bot runtime policy, transaction planning, and observability into a private package keeps apps/bot as a small CLI adapter and makes the production launcher and incident tools match the source-run deployment model. This PR also carries forward the remaining lower-level package fixes from earlier slices so the bot work lands on the same package contracts as the live migration candidate.

Changes

  • Adds private @ickb/bot with bot loop, state reads, rebalancing policy, transaction planning, observability, artifact output, and focused package tests.
  • Converts apps/bot into private @ickb/bot-cli source-run wiring around the bot package.
  • Replaces bot launcher and incident .mjs scripts with typed scripts/bot/** modules plus Node test coverage under scripts/test/bot/**.
  • Wires bot script typechecking into pnpm lint and pnpm bot:check, while preserving the existing root test path for legacy .mjs script tests.
  • Updates systemd helpers and bot docs for encrypted config credentials, source-run launcher units, per-network deploy checkouts, file logs, and incident bundles.
  • Carries forward lower-level package fixes that should have landed with earlier slices: node-utils malformed transaction balance validation and source-only packaging cleanup, SDK error and selection invariant cleanup, public confirmation error docs/export alignment, and testkit fixture API cleanup.
  • Extends node-utils retryable transport classification to wrapped fetch failures and source-exports node-utils for source-run bot resolution.
  • Removes Node obsolete --experimental-default-type=module launch flag from bot scripts, docs, systemd units, and tests for Node 24 CI.

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

Copy link
Copy Markdown

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 refactors the iCKB bot by modularizing its core logic into a private @ickb/bot package and transitioning the apps/bot package into a CLI adapter. It introduces a new production launcher and an incident collector script, while updating the rebalancing policy to use a 180-epoch ring model for pool inventory management, excess withdrawals, and reserve recovery. Feedback on the changes suggests preventing precision loss in the incident collector's time-bound parsing by validating safe integers using BigInt first, and using the in operator for cleaner type narrowing when extracting custom properties from Error objects.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/bot/incident/args.ts Outdated
Comment thread packages/bot/src/observability/error.ts
@phroi

phroi commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

/gemini review

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

Copy link
Copy Markdown

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 refactors the iCKB bot by extracting its core runtime, rebalancing policy, and observability logic into a new private packages/bot package, leaving apps/bot as a CLI adapter. It also introduces a production launcher with run-slot retention, an incident collector script, and updates to packages/node-utils for better transaction validation and error handling. Feedback on the changes suggests restoring Date object serialization in the stringifyBigInt helper within packages/sdk to prevent potential runtime errors and maintain compatibility with previous behavior.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/sdk/src/client/sdk_error.ts
@phroi

phroi commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

/gemini review

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

Copy link
Copy Markdown

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 restructures the repository by moving the core bot implementation into a private packages/bot package and refactoring apps/bot as a CLI adapter. It also updates documentation, introduces new launcher and incident collection scripts, and refines the rebalancing policy to use a ring-based model. The code review feedback focuses on improving robustness and efficiency: making temporary file cleanup and log pruning deletions best-effort to prevent critical failures, replacing manual timestamp scanning with a regular expression, and explicitly handling Date objects in the custom JSON serialization helper to avoid data loss.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/bot/src/observability/artifacts.ts
Comment thread scripts/bot/incident/source/filter.ts Outdated
Comment thread packages/sdk/src/client/sdk_error.ts
Comment thread scripts/bot/launcher/storage/retention.ts
@phroi

phroi commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

/gemini review

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

Copy link
Copy Markdown

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 refactors the iCKB bot architecture by extracting the core bot runtime, rebalancing policy, and observability logic from apps/bot into a new private workspace package packages/bot. The apps/bot package is renamed to @ickb/bot-cli and updated to run directly from TypeScript source (Node 22.19+) as a CLI adapter. The rebalancing policy has been updated to replace the future inventory and non-standard cleanup logic with a ring bucket seeding model, excess withdrawals, and reserve recovery. Additionally, the launcher now manages log retention across 16 fixed run slots with best-effort quota pruning, and ring segment diagnostics are written as content-addressed artifacts. The changes are well-structured, successfully modularizing the bot's core logic into a reusable package while simplifying the CLI adapter to run directly from source. Since there are no review comments, no feedback on reviewer comments is provided.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@phroi

phroi commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/gemini review

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

Copy link
Copy Markdown

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 restructures the iCKB bot by extracting its core logic, rebalancing policy, and harness into a private @ickb/bot package, leaving apps/bot as a CLI adapter (@ickb/bot-cli). The rebalancing policy is updated to use a ring bucket model and enhanced reserve recovery logic. Additionally, minor refactorings and safety checks are introduced across packages/node-utils and packages/sdk. A review comment identifies an issue in packages/sdk/src/client/sdk_error.ts where the removal of explicit Date handling in the custom JSON serialization helper could lead to data loss or serialization errors.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/sdk/src/client/sdk_error.ts
@phroi

phroi commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/gemini review

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

Copy link
Copy Markdown

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 restructures the bot architecture by moving the core bot logic, loop, state, policy, and observability features from apps/bot into a new private package @ickb/bot under packages/bot, while renaming the CLI app to @ickb/bot-cli. It also refactors transient RPC/transport error retry logic and updates TypeScript configurations. In packages/sdk, several explicit error-throwing checks were replaced with non-null assertions (!). The review feedback advises against using these non-null assertions, recommending instead that explicit errors be thrown to ensure that any invariant breaks are made visible rather than failing silently at runtime.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/sdk/src/withdrawal/withdrawal_best_fit_support.ts Outdated
Comment thread packages/sdk/src/withdrawal/withdrawal_selection.ts Outdated
Comment thread packages/sdk/src/estimate/sdk_maturity.ts Outdated
Comment thread packages/sdk/src/estimate/sdk_maturity.ts Outdated
Comment thread packages/sdk/src/withdrawal/withdrawal_ring_core.ts Outdated
@phroi

phroi commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/gemini review

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

Copy link
Copy Markdown

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 refactors the bot application into a CLI-focused structure, introducing a new @ickb/bot package for core runtime logic, updating deployment scripts to use systemd with encrypted credentials, and improving observability with content-addressed artifacts. My feedback highlights a critical issue in the canonicalJson implementation where the JSON.stringify replacer is misused for deep sorting and serialization, and provides a corrected implementation to ensure consistent, recursive sorting and proper handling of Date and BigInt types.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/bot/src/observability/artifacts.ts
@phroi

phroi commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

/gemini review

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

Copy link
Copy Markdown

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 restructures the iCKB bot by extracting its core logic into a new private package, @ickb/bot, and refactoring the bot application as a CLI adapter, @ickb/bot-cli. The rebalancing policy has been updated to support ring bucket seeding, excess withdrawals, and reserve recovery. The update also refactors the logging, launcher, and incident collection scripts, improves error handling and transaction validation in the SDK and node utilities, and updates the systemd deployment configuration and documentation. No review comments were provided, so there is no feedback to address.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@phroi

phroi commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

LGTM

Phroi %364

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