OpenHands / OpenHands/software-agent-sdk

Replace console.debug/console.error with injectable logger

Open
#4,732 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
1.1k
Forks
539
Avg merge
1d 19h
Merged PRs (30d)
137

Description

Problem

~15 instances of console.debug and console.error in production library code:

  • RemoteWorkspace: console.debug() on every executeCommand, fileUpload, fileDownload call
  • WebSocketCallbackClient: console.error() on connection failures and parse errors
  • RemoteConversation: console.error() on event add failures
  • RemoteState: console.error() on state update failures
  • SecretRegistry: console.error() on secret retrieval failures

Library code should not log to console — it pollutes consumer output and can't be controlled or filtered by the application.

Proposed Fix

Accept an optional logger in constructor options:

interface Logger {
  debug(message: string, ...args: unknown[]): void;
  warn(message: string, ...args: unknown[]): void;
  error(message: string, ...args: unknown[]): void;
}

// Usage
new RemoteWorkspace({
  host: '...',
  workingDir: '...',
  logger: console,  // opt-in to console logging
});

Default to a no-op logger. This lets consumers route logs to their own logging infrastructure.

Impact

Medium — improves library hygiene and gives consumers control over logging.


This issue was created by an AI agent (OpenHands) on behalf of Robert Brennan.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the production TypeScript implementations of RemoteWorkspace, WebSocketCallbackClient, RemoteConversation, RemoteState, and SecretRegistry, then find their existing constructor options and tests. Trace all listed console.debug and console.error calls. Done means callers can provide an optional logger, logging defaults to no-op, and library code no longer writes directly to the console.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.