Skip to content

claude-code agent fails with nested session error in devcontainers #270

@martintburgess

Description

@martintburgess

Environment

  • roborev version: v0.31.1
  • Claude Code version: 2.1.42
  • OS: Linux (devcontainer)
  • Agent: claude-code
  • Command: roborev review

Problem

When running roborev review with the claude-code agent configured, all review jobs fail with:

agent: claude failed: exit status 1 (parse error: no valid stream-json events parsed from output)
stderr: Error: Claude Code cannot be launched inside another Claude Code session.
Nested sessions share runtime resources and will crash all active sessions.
To bypass this check, unset the CLAUDECODE environment variable.

This happens when roborev is run from a regular terminal (not within an active Claude Code session).

Verified:

  • The CLAUDECODE environment variable is not set (echo $CLAUDECODE returns empty)
  • No Claude Code process is running (ps aux | grep claude shows no active sessions)
  • Running from a standard terminal in a devcontainer

Suspected root cause

roborev appears to be spawning Claude Code in a way that causes it to detect a nested session. This might be:

  • Spawning claude multiple times in sequence
  • Not properly cleaning up environment state between calls
  • Some interaction with how roborev's worker pool manages Claude Code processes

Claude Code has guards against nested sessions that check more than just the CLAUDECODE variable - they may detect process hierarchy, sockets, or other runtime state.

Expected behaviour

roborev should be able to use the claude-code agent without triggering nested session errors, or should provide clear guidance on how to configure it properly for environments where the CLI approach won't work.

Suggested fix

This is my first time using roborev. Not sure if I have missed something but I wonder if something in roborev needs to be adjusted to avoid nesting sessions.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions