Repository navigation
feat(clock): let a backing server follow the gateway clock through its own follower - #994
Conversation
…s own follower A backing server whose sync_time advertises the follower fields (watch_url, name, read_token) is now declared a follower of its env's gateway, as an agent is, and handed the in-compose watch URL, so every program in its image reads the env's time. Teardown retires it. Servers without those fields keep today's sync, and a website whose image runs the follower takes the same path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e website follower path An MCP server and a website may share a name, so a website is declared site-<name> and each server follower is recorded under its follower name, not its service. The website's sync_time no longer takes follower fields: its card never advertised them, so sync_env_clock never sent them, and the path imported the agent package, which plain website installs don't have. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l Docker A server whose sync_time takes the follower's config is declared svc-<name> by sync_env_clock, reaches the gateway's watch from inside the compose network, is waited for by a write that waits for followers (504 naming it while paused), and is no longer waited for once retired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ay that takes no followers A gateway from before declare_follower can still arm the clock and serve env_get_time_url, so a server that could follow is synced the old way there instead of being left unsynced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| for _ in range(100): | ||
| if self.shown is not None: | ||
| return {"synced": True, "version": self.shown.get("version")} | ||
| await asyncio.sleep(0.1) |
There was a problem hiding this comment.
The new test server hardcodes its request timeout, retry delay, and startup wait across _follow and sync_time. The repository requires magic numbers to be stored as named class or instance variables. Give these settings descriptive names so maintainers can change the wait budget without tracking separate literals. This requirement must be satisfied before merging.
Rule Used: Store magic numbers as class or instance variables with descriptive names rather than using them inline in the code. (source)
Learned From
scaleapi/scaleapi#126388
Prompt To Fix With AI
This is a comment left during a code review.
Path: tst/data/clock_follower_mcp/server.py
Line: 39-42
Comment:
**Timing settings lack names**
The new test server hardcodes its request timeout, retry delay, and startup wait across `_follow` and `sync_time`. The repository requires magic numbers to be stored as named class or instance variables. Give these settings descriptive names so maintainers can change the wait budget without tracking separate literals. This requirement must be satisfied before merging.
**Rule Used:** Store magic numbers as class or instance variables with descriptive names rather than using them inline in the code. ([source](https://app.greptile.com/-/switch-tenant?tenant=scale-ai&next=%2Fcustom-context%3Fmemory%3D002e0051-41ad-46c1-9098-47433c580150))
**Learned From**
[scaleapi/scaleapi#126388](https://github.com/scaleapi/scaleapi/pull/126388)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Done in 8453dc0: the watch timeout, retry delay and first-answer wait are now named class attributes on ClockAppEnv (WATCH_TIMEOUT_S, WATCH_RETRY_S, FIRST_ANSWER_WAIT_S, FIRST_ANSWER_POLL_S), and the 100-iteration loop became an explicit deadline. Reran test_server_env_clock_local.py locally: passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🤖 Automated Claude routine — Env Pod PR Context Review. This is a bot, not Edgar Arakelyan; not a human review. Some context from a sibling PR: open #892 ("clock followers declare the times they hold") changes the same
Git will flag the conflict in Generated by Claude Code |
What and why
Open-source apps wrapped as backing servers (Postgres, Gitea, Metabase and others) can run the computer clock follower in their image, so every process reads the env's time natively. Until now,
sync_env_clockonly handed backing servers the time URL. Now a server whosesync_timeadvertises the follower fields (watch_url,name,read_token) is declared a follower of its env's gateway, as an agent already is. It gets the watch URL as a compose sibling reaches the gateway, andteardown_sandboxesretires it. Servers without those fields, and deployments that aren't VM/compose, keep the current sync. A website that advertises them is declaredsite-<name>, so it never collides with an MCP server of the same name. The agent's declare-and-sync code moved intodeclare_and_sync_follower, which agents and servers now share. Part of FD-7156.Docs: the clock page could say that a backing server opts in by advertising the follower fields on
sync_timeand running the follower.How it was tested
ruff checkpasses.pytest tst/unit/task_step tst/unit/a2a_agent packages/agentenv-protocol/tests/test_website_environment.py: 5032 passed on the first commit; after the review fixes, the clock, teardown and website tests (741 + 360) pass.computer_exec_test, 1 intest_mcp_cli_builder); they fail the same way on unchanged main.tst/integration/task_step/test_server_env_clock_local.pypassed on local Docker against the real gateway (110 s):sync_env_clockdeclared the serversvc-warehouse, a write withwait_followers_swas acknowledged in 0.01 s, the same write answered 504 withstale: ["svc-warehouse"]while the server was paused, and afterretire_server_followersa waiting write answered at once.🤖 Generated with Claude Code
Confidence Score: 5/5

The PR appears safe to merge, with no outstanding findings.Summary
Backing servers that advertise follower fields can now follow the gateway clock.
No new actionable issues were found. The previous timing-settings finding is fixed.
Diagram
sequenceDiagram participant Step as Clock setup participant Gateway participant Server as Backing server Step->>Gateway: Arm clock Step->>Gateway: Declare follower with read token Step->>Server: Send watch URL, name, and token Server->>Gateway: Watch clock and acknowledge versions Gateway-->>Step: Waiting clock writes complete after acknowledgement Step->>Gateway: Retire follower before teardownReviews (8) · Last reviewed commit: "test(clock): name the follower test serv..." · Reviewed by Greptile