From d2b1717592d57ed5cb34aeda9aa45edbdbc2d7da Mon Sep 17 00:00:00 2001 From: Michael Xu Date: Wed, 9 Sep 2026 15:54:47 -0500 Subject: [PATCH 1/2] chore: add make lint/test entrypoints and fix repo URLs in CONTRIBUTING CONTRIBUTING pointed at scaleapi/agentex (the repo is scale-agentex) and told contributors to run make lint, which did not exist. Add lint/lint-fix targets to agentex/Makefile (ruff check + format --check, matching CI) and root lint/test targets that delegate to agentex/. Claude-Session: https://claude.ai/code/session_01HCVKnA7LeJZ44nxZz1uzF3 --- CONTRIBUTING.md | 11 ++++++----- Makefile | 8 +++++++- agentex/Makefile | 8 ++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dd1caea4..d7dab438 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,12 +17,12 @@ To set up your development environment for Agentex, please refer to the [README. 1. **Fork** the repository. 2. **Clone** your fork: ```bash - git clone https://github.com//agentex.git - cd agentex + git clone https://github.com//scale-agentex.git + cd scale-agentex ``` 3. **Set the original repo as upstream** (recommended): ```bash - git remote add upstream https://github.com/scaleapi/agentex.git + git remote add upstream https://github.com/scaleapi/scale-agentex.git ``` 4. **Create a new branch** for your feature or bugfix: ```bash @@ -30,14 +30,15 @@ To set up your development environment for Agentex, please refer to the [README. ``` 5. **Make your changes.** Follow project coding style and conventions. -6. **Test your changes:** +6. **Test your changes** (backend; runs from the repo root or from `agentex/`): ```bash make test ``` - Run linter/formatter as required: + Run the linter/formatter checks as required: ```bash make lint ``` + For the developer UI, run `npm run lint`, `npm run typecheck`, and `npm test` inside `agentex-ui/`. 7. **Commit your changes** (see commit message guidelines below). 8. **Push** to your fork: ```bash diff --git a/Makefile b/Makefile index 4e783f07..5683cd65 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,16 @@ # AgentEx Workspace Makefile -.PHONY: repo-setup help +.PHONY: repo-setup help lint test repo-setup: ## Setup development environment for the workspace uv sync --group dev uv run pre-commit install +lint: ## Run backend lint + format checks (delegates to agentex/) + $(MAKE) -C agentex lint + +test: ## Run backend tests (delegates to agentex/; see agentex/Makefile for FILE/NAME/ARGS) + $(MAKE) -C agentex test + help: ## Show this help message @echo "AgentEx Workspace Commands:" @echo "" diff --git a/agentex/Makefile b/agentex/Makefile index c66b5a5e..7de36349 100644 --- a/agentex/Makefile +++ b/agentex/Makefile @@ -105,6 +105,14 @@ docker-build-with-docs: ## Build production Docker image with docs included # Test Commands # +lint: ## Check lint and formatting with ruff (same checks as CI) + uv run ruff check src/ + uv run ruff format --check src/ + +lint-fix: ## Auto-fix lint errors and format with ruff + uv run ruff check src/ --fix + uv run ruff format src/ + test: ## Run tests (examples: make test FILE=path/to/test.py, make test NAME=pattern, make test ARGS="-v") @uv run python scripts/run_tests.py \ $(if $(FILE),$(FILE)) \ From d9f29fec241ea9386fc5a0232fe41646e6db922b Mon Sep 17 00:00:00 2001 From: Michael Xu Date: Wed, 9 Sep 2026 16:00:10 -0500 Subject: [PATCH 2/2] style(agentex): apply ruff import sorting and formatting so make lint passes Mechanical: ruff check --fix (one un-sorted import block in src/api/routes/checkpoints.py) and ruff format on the four files it flagged. No behavior change. Backend ruff is not run in CI, which is how these drifted. Claude-Session: https://claude.ai/code/session_01HCVKnA7LeJZ44nxZz1uzF3 --- agentex/src/api/routes/checkpoints.py | 8 ++++---- agentex/src/domain/repositories/checkpoint_repository.py | 4 +--- agentex/src/domain/services/agent_acp_service.py | 6 +++++- agentex/src/temporal/run_worker.py | 1 + agentex/src/utils/otel_metrics.py | 4 +++- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/agentex/src/api/routes/checkpoints.py b/agentex/src/api/routes/checkpoints.py index 8c1d7090..69b64f33 100644 --- a/agentex/src/api/routes/checkpoints.py +++ b/agentex/src/api/routes/checkpoints.py @@ -2,6 +2,10 @@ from fastapi import APIRouter, Response +from src.api.schemas.authorization_types import ( + AgentexResourceType, + AuthorizedOperationType, +) from src.api.schemas.checkpoints import ( BlobResponse, CheckpointListItem, @@ -14,10 +18,6 @@ PutWritesRequest, WriteResponse, ) -from src.api.schemas.authorization_types import ( - AgentexResourceType, - AuthorizedOperationType, -) from src.domain.use_cases.checkpoints_use_case import DCheckpointsUseCase from src.utils.authorization_shortcuts import DAuthorizedBodyId from src.utils.logging import make_logger diff --git a/agentex/src/domain/repositories/checkpoint_repository.py b/agentex/src/domain/repositories/checkpoint_repository.py index b320517d..567fd15d 100644 --- a/agentex/src/domain/repositories/checkpoint_repository.py +++ b/agentex/src/domain/repositories/checkpoint_repository.py @@ -248,9 +248,7 @@ async def list_checkpoints( self.async_ro_session_maker() as session, async_sql_exception_handler(), ): - query = select(CheckpointORM).where( - CheckpointORM.thread_id == thread_id - ) + query = select(CheckpointORM).where(CheckpointORM.thread_id == thread_id) if checkpoint_ns is not None: query = query.where(CheckpointORM.checkpoint_ns == checkpoint_ns) diff --git a/agentex/src/domain/services/agent_acp_service.py b/agentex/src/domain/services/agent_acp_service.py index 9035b619..f55cdd89 100644 --- a/agentex/src/domain/services/agent_acp_service.py +++ b/agentex/src/domain/services/agent_acp_service.py @@ -314,7 +314,11 @@ async def get_headers( # message, streaming and cancel (which call get_headers(agent) with no # request_headers) would drop traceparent and the downstream agent would # start a detached trace. The inbound headers are on self._request. - inbound_headers = dict(self._request.headers) if getattr(self, "_request", None) is not None else {} + inbound_headers = ( + dict(self._request.headers) + if getattr(self, "_request", None) is not None + else {} + ) trace_context_headers = extract_trace_context_headers(inbound_headers) delegation_headers = self.get_delegation_headers(agent) auth_headers = await self.get_agent_auth_headers(agent) diff --git a/agentex/src/temporal/run_worker.py b/agentex/src/temporal/run_worker.py index 095359b1..4a9a3e9a 100644 --- a/agentex/src/temporal/run_worker.py +++ b/agentex/src/temporal/run_worker.py @@ -74,6 +74,7 @@ def build_metrics_url(host_url: str | None) -> str | None: host = f"[{host}]" return f"http://{host}:{port}" + # Global worker instance health_check_worker: Worker | None = None diff --git a/agentex/src/utils/otel_metrics.py b/agentex/src/utils/otel_metrics.py index f286e9f1..7f562dbd 100644 --- a/agentex/src/utils/otel_metrics.py +++ b/agentex/src/utils/otel_metrics.py @@ -75,7 +75,9 @@ # Module state _auto_instrumentation_bootstrapped = False -_meter_provider: MeterProvider | None = None # Set only when this module creates the provider +_meter_provider: MeterProvider | None = ( + None # Set only when this module creates the provider +) _initialized: bool = False DEFAULT_SERVICE_NAME = "agentex"