Skip to content

Conversation

@jhaynie
Copy link
Member

@jhaynie jhaynie commented Aug 12, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of package installation by trying alternative install methods when interrupted.
    • Error messages now include trimmed command output, report exit codes and elapsed time, and avoid redundant stdout logging.
  • Chores

    • Increased command execution timeout to reduce premature failures; enhanced debug logging for durations and error details.
    • Tooling updated: Go version bumped to 1.25 and a dependency was updated/added.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Increase command execution timeout to 2 minutes; trim and conditionally log command stdout; log exit code and elapsed duration when available; detect deadline exceeded and log timeout with elapsed; on errors log concrete error type; for uv add exit code 130 attempt uv pip install then pip install fallbacks and aggregate errors; update Go toolchain and module deps to 1.25.

Changes

Cohort / File(s) Summary of Changes
Command execution, logging, and fallback install behavior
internal/templates/steps.go
- Added commandExecTimeout = 2m and record start time
- Use buf = strings.TrimSpace(string(out)); log command output only if non-empty
- Log process exit code and elapsed when cmd.ProcessState present
- Detect context.DeadlineExceeded and log timeout with elapsed
- On error log concrete error value and type
- For uv add with exit code 130: try uv pip install then pip install (each with new timeout contexts and Stdin = nil), returning early on success or an aggregated error if all fail
- Use trimmed buf in error messages and removed redundant post-success stdout re-log
CI workflow Go version bumps
.github/workflows/go.yml, .github/workflows/upgrade-test.yml
- Update Go setup steps from 1.241.25 (no other workflow logic changes)
Go module and dependencies
go.mod
- Bump go directive from 1.24.41.25
- Update github.com/agentuity/go-common v1.0.67 → v1.0.71
- Add indirect dependency filippo.io/edwards25519 v1.1.0

Sequence Diagram(s)

sequenceDiagram
  participant Caller as TemplateStep
  participant Runner as steps.go
  participant OS as OS/Process

  Caller->>Runner: Execute command (timeout = 2m)
  Runner->>Runner: record startTime
  Runner->>OS: start process
  OS-->>Runner: stdout, exit status, process state
  Runner->>Runner: buf = trim(stdout)
  alt ProcessState present
    Runner->>Runner: log exit code and elapsed
  end
  alt buf non-empty
    Runner->>Caller: log "Command output: <buf>"
  end
  alt success
    Runner->>Caller: return success
  else timeout
    Runner->>Caller: log timeout with elapsed, return error (uses buf)
  else error
    Runner->>Caller: log error value and concrete type
    alt command == "uv add" and exit code == 130
      Runner->>OS: run "uv pip install" (Stdin=nil, timeout)
      OS-->>Runner: result
      alt failed
        Runner->>OS: run "pip install" (Stdin=nil, timeout)
        OS-->>Runner: result
      end
    end
    Runner->>Caller: return error (trimmed buf or aggregated error)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

I hopped and timed each tiny race,
Two minutes now to finish pace.
I trim the tales the stdout told,
If uv quits, to pip I toddle.
A rabbit logs and bounces bold. 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c037f35 and fd0fdef.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • .github/workflows/go.yml (1 hunks)
  • .github/workflows/upgrade-test.yml (1 hunks)
  • go.mod (2 hunks)
  • internal/templates/steps.go (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch project-install-debug

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 1

🧹 Nitpick comments (3)
internal/templates/steps.go (3)

46-46: Make timeout configurable; avoid hard-coded magic number

Bumping to 2 minutes is reasonable for debugging, but encode this as a constant or a configurable value to avoid scattered magic numbers and to tune without code changes.

Apply within the selected line range:

-timeoutCtx, cancel := context.WithTimeout(ctx.Context, 2*time.Minute)
+timeoutCtx, cancel := context.WithTimeout(ctx.Context, stepCmdTimeout)

Add this near the top of the file (outside the selected range):

const stepCmdTimeout = 2 * time.Minute

54-60: Cap and sanitize logged command output to prevent excessive logs and accidental secret leakage

Logging the full CombinedOutput can flood logs for verbose commands. Truncate to a safe upper bound.

Apply this diff inside the block:

 buf := strings.TrimSpace(string(out))
 if buf != "" {
+  const maxLogBytes = 32 * 1024
+  if len(buf) > maxLogBytes {
+    buf = buf[:maxLogBytes] + fmt.Sprintf("... [truncated %d bytes]", len(buf)-maxLogBytes)
+  }
   ctx.Logger.Debug("Command output: %s", buf)
   if cmd.ProcessState != nil {
     ctx.Logger.Debug("command exit code %d", cmd.ProcessState.ExitCode())
   }
 }

98-98: Include exit code in returned error for quicker diagnosis

You already log exit code in debug; include it in the returned error to surface the signal/status in upstream logs and UIs.

-        return fmt.Errorf("failed to run command: %s with args: %s: %w (%s)", s.Command, strings.Join(s.Args, " "), err, buf)
+        exitCode := -1
+        if cmd.ProcessState != nil {
+          exitCode = cmd.ProcessState.ExitCode()
+        }
+        return fmt.Errorf("failed to run command: %s with args: %s: %w (exit=%d, out=%s)",
+          s.Command, strings.Join(s.Args, " "), err, exitCode, buf)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 05c02c2 and cde5245.

📒 Files selected for processing (1)
  • internal/templates/steps.go (4 hunks)
⏰ 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). (2)
  • GitHub Check: Build and Test (macos-latest)
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
internal/templates/steps.go (1)

63-63: Nice: log error type alongside value

Including the concrete error type greatly aids debugging. Good addition.

@jhaynie jhaynie merged commit f29818f into main Aug 12, 2025
13 checks passed
@jhaynie jhaynie deleted the project-install-debug branch August 12, 2025 22:58
@devin-ai-integration devin-ai-integration bot mentioned this pull request Aug 12, 2025
5 tasks
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.

2 participants