Skip to content

hive msg inbox crashes: missing CODESHIP_AGENT_ID env var and messages.filter not a function #656

@nikrich

Description

@nikrich

Bug

`hive msg inbox ` fails in two ways:

1. Missing CODESHIP_AGENT_ID

Running `hive msg inbox hive-bX7r_2-tech-lead` throws:

Error: Codeship API not configured. Set CODESHIP_API_URL, CODESHIP_SESSION_ID, and CODESHIP_AGENT_ID environment variables.

The `msg` command calls `requireClientFromEnv()` which requires `CODESHIP_AGENT_ID`, but this env var is not set by the CLI harness for tech-lead sessions. Only `CODESHIP_API_URL` and `SESSION_ID` are provided.

2. messages.filter is not a function

Even after manually supplying `CODESHIP_AGENT_ID`, the command crashes:

TypeError: messages.filter is not a function
    at Command.<anonymous> (file:///app/dist/cli/commands/msg.js:31:29)

This means the API response for messages is not an array (likely an object like `{ messages: [...] }` or some other shape), but the code does `messages.filter()` directly on the response.

Reproduction

# Fails with missing env var
hive msg inbox hive-bX7r_2-tech-lead

# Fails with filter error even with env var set
CODESHIP_AGENT_ID=<any-agent-id> hive msg inbox hive-bX7r_2-tech-lead

Fix

  1. The `msg` command should derive the agent ID from context or accept it as optional (not require it as an env var).
  2. The inbox handler should unwrap the API response correctly before calling `.filter()`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions