Skip to content

Added new CoreSerializer methods#84

Merged
sawradip merged 5 commits into
mainfrom
sawra/util_fix
Nov 12, 2025
Merged

Added new CoreSerializer methods#84
sawradip merged 5 commits into
mainfrom
sawra/util_fix

Conversation

@sawradip
Copy link
Copy Markdown
Contributor

@sawradip sawradip commented Nov 12, 2025

Summary by CodeRabbit

  • Chores

    • Version bumped to 0.1.25 across all packages
  • New Features

    • Added shorthand -y flag for --yes option on teardown command
    • Enhanced structured object serialization and deserialization capabilities
  • Bug Fixes

    • Improved error message sanitization for consistent, clearer error reporting
    • Enhanced authentication and permission error detection with actionable guidance
  • Style

    • Updated display formatting for command parameters with improved visual presentation

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Version bumped to 0.1.25 across multiple package manifests. CLI output formatting updated for extra parameters. Error handling refactored with centralized message normalization across client, REST, and socket layers. New structured serialization format added for objects with type inference and payload handling.

Changes

Cohort / File(s) Summary
Version Bumps
CHANGELOG.md, pyproject.toml, runagent/__init__.py, runagent/__version__.py, runagent-go/runagent/version.go, runagent-rust/runagent/Cargo.toml, runagent-ts/package.json
Version incremented from 0.1.24 to 0.1.25 across all language implementations and package metadata.
CLI Display Formatting
runagent/cli/commands/run.py, runagent/cli/commands/run_stream.py
Extra parameter output formatting changed; removed -- prefix and added green color styling to values.
CLI Teardown Command
runagent/cli/commands/teardown.py
Added shorthand -y flag as alias for --yes option.
Client Error Handling
runagent/client/client.py
Modified run_stream to re-raise cleaned error messages; enhanced _build_suggestion with new permission/authentication error detection block returning dashboard guidance.
REST & Socket Client Error Normalization
runagent/sdk/rest_client.py, runagent/sdk/socket_client.py
Introduced centralized _clean_error_message helper to strip common error prefixes and status codes; refactored error handling paths in streaming and REST execution to use structured error payloads with explicit error codes (AUTHENTICATION_ERROR, PERMISSION_ERROR) and sanitized messages.
Structured Serialization
runagent/utils/serializer.py
Added public methods serialize_object_to_structured and deserialize_object_from_structured with supporting internal utilities: _determine_type (maps Python objects to OpenAPI-like types), _prepare_for_serialization (converts special types to JSON-friendly format), and _json_serializer_fallback (fallback object handling).

Sequence Diagrams

sequenceDiagram
    participant Client as Client Code
    participant RestClient as REST Client
    participant SocketClient as Socket Client
    participant ErrorHandler as Error Handler
    
    Note over RestClient,SocketClient: Old Flow (0.1.24)
    Client->>RestClient: run_agent(request)
    RestClient->>SocketClient: stream request
    SocketClient-->>SocketClient: raw error received
    SocketClient-->>RestClient: raw error message
    RestClient-->>Client: raw/formatted error
    
    Note over RestClient,SocketClient: New Flow (0.1.25)
    Client->>RestClient: run_agent(request)
    RestClient->>SocketClient: stream request
    SocketClient-->>SocketClient: raw error received
    SocketClient->>ErrorHandler: _clean_error_message(error)
    ErrorHandler-->>SocketClient: sanitized message
    SocketClient-->>RestClient: cleaned error
    RestClient->>ErrorHandler: categorize (AUTH/PERMISSION/etc.)
    ErrorHandler-->>RestClient: error code + structured payload
    RestClient-->>Client: structured error response
Loading
sequenceDiagram
    participant App as Application
    participant Serializer as CoreSerializer
    participant TypeDetector as Type Detector
    participant JSONHandler as JSON Handler
    
    rect rgb(200, 240, 255)
    Note over Serializer: Structured Serialization
    App->>Serializer: serialize_object_to_structured(obj)
    Serializer->>TypeDetector: _determine_type(obj)
    TypeDetector-->>Serializer: type (e.g., "object", "array")
    Serializer->>Serializer: _prepare_for_serialization(obj)
    Serializer->>JSONHandler: json.dumps({type, payload})
    JSONHandler-->>Serializer: JSON string
    Serializer-->>App: structured JSON
    end
    
    rect rgb(240, 200, 255)
    Note over Serializer: Structured Deserialization
    App->>Serializer: deserialize_object_from_structured(json_str)
    Serializer->>JSONHandler: json.loads(json_str)
    JSONHandler-->>Serializer: {type, payload}
    Serializer->>Serializer: type-specific reconstruction
    Serializer-->>App: Python object
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • runagent/sdk/rest_client.py: Substantial error handling refactoring with multiple error categorization paths (AUTHENTICATION_ERROR, PERMISSION_ERROR) and structured error payload construction. Requires careful verification of error classification logic and message sanitization paths.
  • runagent/sdk/socket_client.py: Complex streaming flow restructuring with JSON message validation, type-driven message processing, and new error normalization applied across async/sync paths. Verify resource cleanup on exceptions and backward compatibility of streaming semantics.
  • runagent/utils/serializer.py: New structured serialization infrastructure with type inference, recursive data preparation, and type-specific deserialization. Verify correctness of type mapping (especially edge cases for NaN/Inf), compatibility with Pydantic/dataclass models, and error handling paths with DISABLE_TRY_CATCH flag.
  • runagent/client/client.py: Permission/authentication error detection logic in _build_suggestion with dashboard URL handling; verify error message precedence and integration with upstream socket/REST client changes.

Possibly related PRs

Poem

🐰 A hop through versions, from .24 to .25,
Where errors now speak clean and serialization thrives,
Structured payloads dance, types align just right,
Error messages sanitized, permissions brought to light! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sawra/util_fix

📜 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 419266a and 5f047a3.

⛔ Files ignored due to path filters (1)
  • runagent-ts/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (14)
  • CHANGELOG.md (1 hunks)
  • pyproject.toml (3 hunks)
  • runagent-go/runagent/version.go (1 hunks)
  • runagent-rust/runagent/Cargo.toml (1 hunks)
  • runagent-ts/package.json (1 hunks)
  • runagent/__init__.py (1 hunks)
  • runagent/__version__.py (1 hunks)
  • runagent/cli/commands/run.py (1 hunks)
  • runagent/cli/commands/run_stream.py (1 hunks)
  • runagent/cli/commands/teardown.py (1 hunks)
  • runagent/client/client.py (2 hunks)
  • runagent/sdk/rest_client.py (3 hunks)
  • runagent/sdk/socket_client.py (3 hunks)
  • runagent/utils/serializer.py (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sawradip sawradip merged commit f552444 into main Nov 12, 2025
1 of 2 checks passed
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.

1 participant