Work on a machine · Material 12 of 12
Check the feature, not just the health signal
Use a disposable local Python service to distinguish a responding health endpoint from a working feature, then verify the actual result.
A responding server is not necessarily a working application. In one of our controlled CMDOP experiments, a synthetic service returned HTTP 200 from its health endpoint while its orders endpoint returned HTTP 503. The health check was deliberately shallow; it showed that the service could respond, not that its orders feature worked.
Before you start
Choose one online Mac or Linux machine you own, with Python 3 available. Connect an eligible AI client through CMDOP. Running this exercise requires an explicitly enabled exec grant and a machine ceiling that permits exec. Commands have the machine user's authority; the file-tool directory limits do not sandbox exec.
Use only the disposable exercise below. Do not run it against an existing service or repair real data based on this example.
Run a controlled diagnostic
Ask your agent to run the following Python script on that machine using the exec_run tool. It creates a temporary directory and starts a loopback-only server on an OS-selected port. It checks two routes, creates three synthetic records, checks the orders route again, then stops the server and removes its temporary files.
import json
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from tempfile import TemporaryDirectory
from threading import Thread
from urllib.error import HTTPError
from urllib.request import urlopen
with TemporaryDirectory(prefix="cmdop-feature-check-") as directory:
orders = Path(directory) / "orders.json"
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/health":
status, body = 200, {"status": "ok"}
elif self.path == "/orders" and orders.is_file():
status, body = 200, {
"orders": len(json.loads(orders.read_text()))
}
elif self.path == "/orders":
status, body = 503, {"error": "orders.json missing"}
else:
status, body = 404, {"error": "not found"}
payload = json.dumps(body).encode()
self.send_response(status)
self.send_header("Content-Type", "application/json")
self.send_header("Content-Length", str(len(payload)))
self.end_headers()
self.wfile.write(payload)
def log_message(self, *args):
pass
server = ThreadingHTTPServer(("127.0.0.1", 0), Handler)
thread = Thread(target=server.serve_forever, daemon=True)
thread.start()
base = "http://127.0.0.1:" + str(server.server_port)
def check(route):
try:
response = urlopen(base + route, timeout=3)
except HTTPError as error:
response = error
with response:
result = response.code, json.load(response)
print(route, *result)
return result
try:
health = check("/health")
before = check("/orders")
orders.write_text(json.dumps([{"id": 1}, {"id": 2}, {"id": 3}]))
after = check("/orders")
assert health == (200, {"status": "ok"})
assert before == (503, {"error": "orders.json missing"})
assert after == (200, {"orders": 3})
finally:
server.shutdown()
server.server_close()
thread.join()What counts as success?
The expected sequence is health 200, orders 503 with a missing-file explanation, and orders 200 with a count of three. Check the returned exit status and all three responses. The script deliberately creates only synthetic data in its own temporary directory. A zero exit status without the expected responses is insufficient evidence.
If the command is refused, times out, or produces a different response, report that outcome rather than assuming the feature works. Never widen permissions or change an actual application to force the expected result.
For a real service, agree on a safe, authorized feature-specific check and expected result. A deeper readiness check may already cover dependencies; do not assume every health endpoint is shallow. Keep diagnosis, any proposed change and subsequent verification separate.
Continue with Verify the outcome of an AI task for the general result-verification workflow.
