Skip to content

Commit 7b116f0

Browse files
committed
Spring-clean OpenShell Agent Runner
1 parent f8c8ab1 commit 7b116f0

9 files changed

Lines changed: 169 additions & 568 deletions

File tree

.github/workflows/repository-agents.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,12 @@ jobs:
7575
working-directory: projects/openshell-agent-runner
7676
run: |
7777
uv run pre-commit validate-config ../../.pre-commit-config.yaml
78-
uv run ruff format --check .
79-
uv run ruff check .
80-
uv run ty check
81-
uv run pytest
82-
python -m compileall -q src tests
83-
bash -n src/openshell_agent_runner/harnesses/pi/runtime/image/exec.sh
78+
make check
8479
8580
- name: Build distributions
8681
working-directory: projects/openshell-agent-runner
8782
run: |
88-
uv build
83+
make build
8984
wheel="$(find dist -name '*.whl' -print -quit)"
9085
python -m zipfile -l "$wheel" | grep -F 'harnesses/pi/runtime/image/Dockerfile'
9186
python -m zipfile -l "$wheel" | grep -F 'harnesses/pi/runtime/image/exec.sh'
@@ -136,11 +131,9 @@ jobs:
136131
--volume "$PWD/projects/openshell-agent-runner/tests/fixtures/tools.json:/sandbox/tools.json:ro" \
137132
--volume "$PWD/projects/openshell-agent-runner/src/openshell_agent_runner/harnesses/pi/runtime/extensions/submit-result.ts:/sandbox/oar-submit-result.ts:ro" \
138133
--volume "$PWD/projects/openshell-agent-runner/src/openshell_agent_runner/harnesses/pi/runtime/extensions/validate-tools.ts:/sandbox/oar-validate-tools.ts:ro" \
134+
--volume "$PWD/projects/openshell-agent-runner/tests/fixtures/validate-pi-extensions.mjs:/sandbox/validate-pi-extensions.mjs:ro" \
139135
openshell-agent-runner-pi:ci \
140-
-c "ln -s /usr/local/lib/node_modules /sandbox/node_modules && node \
141-
--experimental-strip-types --no-warnings --input-type=module \
142-
--eval \"await import('/sandbox/oar-submit-result.ts'); \
143-
const validator = await import('/sandbox/oar-validate-tools.ts'); \
144-
if (validator.findMissingTools(['missing'], [{name: 'read'}])[0] !== 'missing') process.exit(1); \
145-
let handler; validator.default({on: (event, value) => {if (event === 'before_agent_start') handler = value;}}); \
146-
await handler({}, {getAllTools: () => [{name: 'read'}], getActiveTools: () => ['read']});\""
136+
-c "ln -s /usr/local/lib/node_modules /sandbox/node_modules && \
137+
node \
138+
--experimental-strip-types --no-warnings \
139+
/sandbox/validate-pi-extensions.mjs"

plans/openshell-agent-runner-refactor.md

Lines changed: 0 additions & 216 deletions
This file was deleted.

projects/openshell-agent-runner/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
and optional JSON Schema validation are the output boundary; they do not
1616
attest agent-produced claims.
1717
- Use `apply_patch` for edits and `uv` for dependencies, builds, and execution.
18-
- Before handing off, run `uv sync --locked`, Ruff, ty, pytest, and `uv build`.
18+
- Before handing off, run `make check` and `make build`.

projects/openshell-agent-runner/Makefile

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
.DEFAULT_GOAL := help
55

6+
UV ?= uv
7+
UV_RUN := $(UV) run --frozen
8+
PYTEST_ARGS ?=
9+
610
PUBLISH_FLAGS :=
711
ifdef DRY_RUN
812
PUBLISH_FLAGS += --dry-run
@@ -14,7 +18,7 @@ ifdef RETRY_ARTIFACT
1418
PUBLISH_FLAGS += --retry-artifact $(RETRY_ARTIFACT)
1519
endif
1620

17-
.PHONY: help publish
21+
.PHONY: help sync test format-check lint typecheck check build clean publish
1822

1923
help: ## Show available targets and configurable variables.
2024
@awk 'BEGIN {FS = ":.*## "}; /^[a-zA-Z0-9_.-]+:.*## / {printf " %-12s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@@ -23,6 +27,33 @@ help: ## Show available targets and configurable variables.
2327
@printf " DRY_RUN=1 Validate a release without tagging or uploading\n"
2428
@printf " ALLOW_NON_MAIN=1 Permit release validation or publishing off main\n"
2529
@printf " RETRY_ARTIFACT=... Retry a missing wheel, sdist, or both after a failed upload\n"
30+
@printf " PYTEST_ARGS=... Extra pytest paths or flags\n"
31+
32+
sync: ## Install locked runtime and development dependencies.
33+
$(UV) sync --locked
34+
35+
test: ## Run tests; pass paths or flags with PYTEST_ARGS.
36+
$(UV_RUN) pytest $(PYTEST_ARGS)
37+
38+
format-check: ## Check Python formatting.
39+
$(UV_RUN) ruff format --check .
40+
41+
lint: ## Run Ruff lint checks.
42+
$(UV_RUN) ruff check .
43+
44+
typecheck: ## Run ty type checks.
45+
$(UV_RUN) ty check
46+
47+
check: sync format-check lint typecheck test ## Run the full project checks.
48+
$(UV_RUN) python -m compileall -q src tests
49+
bash -n src/openshell_agent_runner/harnesses/pi/runtime/image/exec.sh
50+
51+
build: ## Build the source distribution and wheel.
52+
$(UV) build --clear --no-sources
53+
54+
clean: ## Remove build, test, lint, and Python cache artifacts.
55+
rm -rf build dist .pytest_cache .ruff_cache
56+
find src tests -type d -name __pycache__ -prune -exec rm -rf {} +
2657

2758
publish: ## Validate or publish a release; requires VERSION.
2859
ifndef VERSION

0 commit comments

Comments
 (0)