[proxy 03/13] main.py: FastAPI app with /healthz and /metrics #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Spec: this implements ONE small step of #2 (the locked reliability-proxy build, aosh leg 04). Do not redesign. Stay tightly scoped to this single step.
Before you start:
git checkout main && git pullso you build on the latest landed step.Fill in
app/main.py.app = FastAPI(). On startup callapp.obs.init_sentry().GET /healthz->{"status": "ok"}with 200.GET /metrics-> returnsapp.obs.metrics_text()with content-typetext/plain; version=0.0.4.Acceptance:
uv run uvicorn app.main:app --port 8080 &thencurl -s localhost:8080/healthzreturns 200 JSON andcurl -s localhost:8080/metricsreturns prometheus text. Add a pytest usingfastapi.testclient.TestClientasserting /healthz == 200.When done:
pre-commit run --all-files(or the repo's gate) must pass, commit your work, and push to canonicalmain(this is an ephemeral feature container - finish the merge, do not leave it for a human).docs/FEATURES.mdfromplannedtolandedfor this feature, in the same push.ward agent engineer coilyco-flight-deck/agent-proxy#8 --driver goose🔒 Reserved by
ward agent --driver claude— containerengineer-claude-agent-proxy-7on hostkais-macbook-pro-2.localis carrying this issue (reserved 2026-07-02T16:43:26Z). Concurrentward agentruns are blocked until it finishes or the reservation goes stale (2h0m0s TTL);--forceoverrides.— Claude (she/her), via
ward agentWARD-OUTCOME: done - main.py already ships /healthz + /metrics on main, verified green; closed #7 as already-landed (no code change warranted).
Candid note: this one was already done before I arrived.
app/main.pyonmainhas the FastAPI app withGET /healthzreturning{"status": "ok"}at 200 andGET /metricsserving prometheus text, plus tests intests/test_api.py(test_healthz,test_metrics_exposed) usingTestClient, anddocs/FEATURES.mdalready marks "Skeleton + observability" as landed. Sentry init runs at import viasetup_observability->_configure_sentry, which covers the issue'sinit_sentryask.What fought back was the temptation to "implement" it. The issue describes a simpler earlier design (
app.obs.init_sentry()at startup,app.obs.metrics_text(), content-typeversion=0.0.4), but the code has since grown the full OpenAI surface and uses the canonical prometheus content-type. Rewriting main.py back to the leaner spec would have been a redesign and a regression that broke the other landed steps, so I left the code untouched and closed the issue against reality instead.Confidence is high:
uv run --extra dev pytestis 37/37 green, and a liveuvicorn app.main:appreturns 200 JSON on /healthz and prometheus text on /metrics.Rough edges / follow-ups worth filing:
Siblings #6 (obs.py), #8 (models.py), #9 (upstream.py) are in the same state - code landed on
main, issue still open. They likely want the same batch-close reconciliation.ward agentdispatch (this issue's step 3,...#8 --driver goose) is not available in this container - thewardhere is only the contributor cli-guard consumer with noagentverb. The next step needs an operator or the director loop to dispatch.Claude (she/her), via ward agent