Skip to content

Session ID not consistent when requerying same server_client instance #238

Open

Description

@cwing-nvidia

Describe the bug

When trying to requery the same server_client instance in multi-turn scenarios, the session_id isn't always consistent. This makes it difficult to maintain environment state across multiple turns.

User's workaround: Currently passing session_id manually with each step command.

# 1. Create server_client and get initial session_id from seed_session
server_client = ServerClient.load_from_global_config()
reset_task = await server_client.post(
    server_name="tales",
    url_path="/seed_session",
    json={
        "framework": framework,
        "task_no": task_no,
        "max_episode_steps": max_steps,
        "seed": seed,
        "split": split,
    },
)
output = await reset_task.json()
session_id = output["session_id"]  # Store session_id manually

# 2. On subsequent calls in multi-turn loop, must explicitly pass session_id
for _ in range(25):
    # Query model...
    
    # Must manually pass session_id with each command
    action_task = await server_client.post(
        server_name="tales",
        url_path="/execute_command",
        json={"command": action, "session_id": session_id},  # <-- Manual session_id
    )
    output = await action_task.json()

Steps/Code to reproduce bug

Please list minimal steps or code snippet for us to be able to reproduce the bug.

A helpful guide on on how to craft a minimal bug report http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports.

Expected behavior

Session ID should remain consistent for the same server_client instance throughout a multi-turn interaction.

server_client = ServerClient.load_from_global_config()

# Session created
reset_task = await server_client.post(server_name="tales", url_path="/seed_session", json={...})

# Subsequent calls automatically use same session without manual session_id
action_task = await server_client.post(
    server_name="tales",
    url_path="/execute_command",
    json={"command": action}  # No session_id needed
)

Additional context
@christopherzc mentioned in PR: #203

resources_servers/tales/example_scripts/multi_turn/generate_gpt_rollouts.py lines 54, 75
resources_servers/tales/example_scripts/single_turn/generate_single_turn_gpt_rollouts.py lines 70, 103

Activity

  1. added theissue type on Oct 27, 2025
  2. christopherzc commented on Oct 27, 2025

    @christopherzc
    Contributor

    I've added a script to illustrate this behavior.

    This script calls the 'execute_bug' function from the server, which is a replica of the 'execute_command' function without the workaround. This results in the code erroring out due to the request returning the following error despite the environment having been initialized prior to the loop:

    {'detail': 'Session id: 6027bff9-8011-4263-ab52-bdc52cd79dbb not initialized. Please call seed_session first.'}

  3. added this to the v0.2.0 milestone on Oct 30, 2025
  4. cwing-nvidia commented on Oct 30, 2025

    @cwing-nvidia
    ContributorAuthor

    Also impacts swe agent, need to address this as fast-follow after v0.1.0

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    community-requestIssue reported or requested by someone from the communitycore-infraHelpful infrastructure

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions