Skip to content

refactor(server): move auth schemas modules - #378

Merged
delete-cloud merged 1 commit into
mainfrom
refactor/server-support-modules
May 24, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
refactor/server-support-modules

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • move HTTP auth and request/response schema modules under coding_agent.server
  • update the HTTP server to import the new server paths
  • keep coding_agent.ui.auth and coding_agent.ui.schemas compatibility exports

Verification

  • uv run pytest tests/ui/test_rate_limit.py tests/ui/test_security.py -v
  • uv run pytest tests/ui/test_http_server.py tests/ui/test_http_server_workspace_transfer.py -v
  • uv run pytest tests/cli/test_remote_client.py::test_serve_config_sets_explicit_server_config tests/cli/test_remote_client.py::test_serve_config_uses_server_host_and_port_when_cli_omits_them tests/cli/test_entrypoint_contract.py -v
  • uv run ruff check src/coding_agent/server/auth.py src/coding_agent/server/schemas.py src/coding_agent/server/http_server.py src/coding_agent/ui/auth.py src/coding_agent/ui/schemas.py src/coding_agent/ui/rate_limit.py
  • git diff --check

Summary by CodeRabbit

  • New Features

    • HTTP API authentication support with API key (X-API-Key header) and bearer token authentication methods
    • Comprehensive API request/response schemas for session management, workspace operations, execution environment binding, checkpoint handling, and operational monitoring
  • Refactor

    • Code organization changes to authentication and schema modules

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 63cc7d17-5762-4247-a2fd-f85cb91f26c8

📥 Commits

Reviewing files that changed from the base of the PR and between 1d9a9e2 and e5ad87c.

📒 Files selected for processing (5)
  • coding-agent/src/coding_agent/server/auth.py
  • coding-agent/src/coding_agent/server/http_server.py
  • coding-agent/src/coding_agent/server/schemas.py
  • coding-agent/src/coding_agent/ui/auth.py
  • coding-agent/src/coding_agent/ui/schemas.py

📝 Walkthrough

Walkthrough

This PR reorganizes authentication and HTTP schema definitions from UI packages into new server packages, establishing server-authoritative implementations. The HTTP server is updated to use server imports, and UI modules are converted to re-export shims for backward compatibility.

Changes

Server Module Reorganization

Layer / File(s) Summary
Server authentication module
coding-agent/src/coding_agent/server/auth.py
New module with AuthContext dataclass, token digest computation, TOML config loading, credential extraction from X-API-Key and Authorization headers, and verify_api_key/auth_context_from_headers FastAPI dependencies for request authentication and owner label mapping.
Server API schemas module
coding-agent/src/coding_agent/server/schemas.py
New module with 39+ Pydantic models covering execution bindings (local/cloud), workspace sources (docker/git), session lifecycle (create/approve/close), runtime observations, workspace operations (diff/patch/publish), checkpoints, health/readiness, and workspace archival/retention with validation constraints and enumerated status fields.
HTTP server import migration
coding-agent/src/coding_agent/server/http_server.py
Import statements updated to source authentication helpers and API schemas from coding_agent.server.* modules instead of coding_agent.ui.*.
UI compatibility re-export shims
coding-agent/src/coding_agent/ui/auth.py, coding-agent/src/coding_agent/ui/schemas.py
Both modules converted to dynamic re-export wrappers that delegate all public symbols from their server counterparts, maintaining backward compatibility for downstream UI imports.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

  • delete-cloud/Coding-Agent-Loop#125: Moves AuthContext and HTTP schema implementations from coding_agent.ui.* to coding_agent.server.* with UI re-export compatibility shims.

Poem

A server stands tall, schemas in hand, 📋
Auth tokens flow through the digital land, 🔐
UI shims wave goodbye to the code,
While server paths take the authoritative road! 🛣️
Backward compatible, forward we go! 🐰

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/server-support-modules

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.

@delete-cloud
delete-cloud force-pushed the refactor/server-support-modules branch from 9841a3b to ef5c541 Compare May 24, 2026 17:26
@delete-cloud
delete-cloud force-pushed the refactor/server-support-modules branch from ef5c541 to e5ad87c Compare May 24, 2026 17:46
@delete-cloud
delete-cloud marked this pull request as ready for review May 24, 2026 18:26
@delete-cloud
delete-cloud merged commit 6f10a7e into main May 24, 2026
1 check was pending
@delete-cloud
delete-cloud deleted the refactor/server-support-modules branch May 24, 2026 18:26
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