Skip to content

Conversation

@fadeev
Copy link
Member

@fadeev fadeev commented Oct 28, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added --non-interactive option to the cctx command for customizable timeout behavior.
  • Bug Fixes

    • Enhanced timeout error messages to display the count of CCTXs found during timeout events, providing more detailed diagnostic information.

@fadeev fadeev requested review from a team as code owners October 28, 2025 08:40
@github-actions github-actions bot added the feat label Oct 28, 2025
@fadeev fadeev linked an issue Oct 28, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 28, 2025

📝 Walkthrough

Walkthrough

The changes introduce interactive/non-interactive mode support to the CCTX command. A new --non-interactive CLI option is added, with timeout behavior determined by an interactive flag: interactive mode uses the provided timeout value; non-interactive mode defaults to 5000ms. Timeout error messages are enhanced to include CCTX count information. Schema validation is updated to include the interactive field.

Changes

Cohort / File(s) Summary
Interactive Mode Support
packages/commands/src/query/cctx.ts
Added --non-interactive CLI option to command configuration. Modified timeout logic to derive effective timeout from interactive flag (uses provided value if interactive, defaults to 5000ms otherwise). Enhanced timeout error messages to include count of CCTXs found.
Schema Validation
src/schemas/commands/cctx.ts
Added interactive: z.coerce.boolean() field to cctxOptionsSchema for type validation and coercion of the interactive mode flag.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify the schema field interactive is correctly wired to the CLI option parsing
  • Confirm the timeout default value (5000ms) aligns with intended non-interactive behavior
  • Check that the interactive flag is properly threaded through the command call chain
  • Validate that enhanced timeout logging correctly captures and reports CCTX count

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat(cctx): non-interactive flag" directly and accurately reflects the main changes in the changeset. The primary objective is to introduce a new --non-interactive CLI option to the cctx command, which is precisely what the title conveys. The title is concise, specific, and follows conventional commit format, clearly communicating the feature being added without vague terminology. Supporting changes like schema updates and timeout behavior adjustments are implementation details that naturally follow from the core feature, and the title appropriately captures the essential nature of the work.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cctx-non-interactive

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 31170ea and f3f711e.

📒 Files selected for processing (2)
  • packages/commands/src/query/cctx.ts (3 hunks)
  • src/schemas/commands/cctx.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: fadeev
PR: zeta-chain/toolkit#346
File: packages/commands/src/ton/depositAndCall.ts:0-0
Timestamp: 2025-06-13T15:33:54.781Z
Learning: fadeev prefers responses in English.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
packages/commands/src/query/cctx.ts (1)

67-72: Good UX improvement with the enhanced timeout message.

Including the CCTX count in the timeout message provides useful feedback to users about the progress made before the timeout.

Comment on lines +318 to +319
const { hash, rpc, delay, interactive } = options;
const timeout = interactive ? options.timeout : 5000;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Property name mismatch prevents this logic from working.

This code attempts to destructure interactive from options, but the schema validation (line 8 in src/schemas/commands/cctx.ts) and CLI flag (line 337) create a property named nonInteractive instead. This will result in interactive being undefined.

After applying the fix suggested in src/schemas/commands/cctx.ts, update this code to:

-  const { hash, rpc, delay, interactive } = options;
-  const timeout = interactive ? options.timeout : 5000;
+  const { hash, rpc, delay, nonInteractive } = options;
+  const timeout = nonInteractive ? 5000 : options.timeout;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const { hash, rpc, delay, interactive } = options;
const timeout = interactive ? options.timeout : 5000;
const { hash, rpc, delay, nonInteractive } = options;
const timeout = nonInteractive ? 5000 : options.timeout;
🤖 Prompt for AI Agents
In packages/commands/src/query/cctx.ts around lines 318-319, the code
destructures an undefined 'interactive' property but the schema/CLI use
'nonInteractive'; replace the destructuring and logic to use the existing
property (e.g., derive interactive as !options.nonInteractive or directly use
options.nonInteractive in the conditional) so timeout is set to options.timeout
when interactive is true (nonInteractive is false) and defaults to 5000 when
nonInteractive is true.

export const cctxOptionsSchema = z.object({
delay: z.coerce.number().int().positive().default(DEFAULT_DELAY),
hash: z.string(),
interactive: z.coerce.boolean(),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Property name mismatch and missing default will cause validation failure.

The CLI flag is defined as --non-interactive (line 337 in packages/commands/src/query/cctx.ts), which Commander automatically converts to the camelCase property nonInteractive. However, the schema expects a field named interactive. This mismatch will cause cctxOptionsSchema.parse(opts) to fail at runtime.

Additionally, the field has no default value, meaning validation will fail when the flag is not provided.

Apply this diff to fix the issues:

-  interactive: z.coerce.boolean(),
+  nonInteractive: z.coerce.boolean().default(false),

Then update the logic in packages/commands/src/query/cctx.ts line 319 to:

const timeout = options.nonInteractive ? 5000 : options.timeout;

Alternatively, if you prefer to keep the schema property as interactive, change the CLI flag to:

.option("--interactive", "Run in interactive mode (default).", true)
🤖 Prompt for AI Agents
In src/schemas/commands/cctx.ts around line 8, the schema uses property name
"interactive" but the CLI flag produces "nonInteractive" (camelCase), and there
is no default, causing parse failures; update the schema to use nonInteractive:
z.coerce.boolean().default(false) (or rename to nonInteractive and add the
default) so the field matches the CLI flag and has a default; then update
packages/commands/src/query/cctx.ts at line 319 to use const timeout =
options.nonInteractive ? 5000 : options.timeout; ensuring the property names and
defaults are consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

query cctx: non-interactive flag

2 participants