Skip to content

feat(computers): the clock app and its follower put a computer on its gateway's clock (FD-5476) - #645

Closed
williamloo-scale wants to merge 1 commit into
mainfrom
wloo/computer-clock-follower
Closed

williamloo-scale wants to merge 1 commit into
mainfrom
wloo/computer-clock-follower

Conversation

@williamloo-scale

Copy link
Copy Markdown
Contributor

What and why

Adds the clock computer app (FD-5476). A computer env with apps = ["clock"] runs on its multi env gateway's clock: every process uses agent-env's libfaketime and the TLS shim, and a clock follower keeps the clock page in step with the gateway.

  • The app (computers/envs/clock) builds the library and shim at compose from computers/clock, preloads them through /etc/ld.so.preload, and installs the follower. Its clock/v1 sync_time only reports what the follower last showed for a config id. That is also what makes the gateway count the computer as a follower.
  • The follower (computers/clock/clock-follower, stdlib Python) runs as its own user, agentenv-clock, under a root loop (follow) that restarts it. It long-polls the gateway's /clock/watch, writes the clock page on each new version, anchors the page from the watch's four stamps the way NTP estimates an offset, and records its status.
  • Security model: the session user can't write the page or the clock file, read the follower's config (and its token), or stop the follower. The follower and its loop force umask 022, because docker exec starts processes with umask 0000.
  • The app's recipe/ holds per-file symlinks into computers/clock. These are the repo's first symlinks; a built wheel includes them as regular files, and hatchling skips a symlinked directory.

Core writes the follower's config and starts it, as root, in the next PR. Nothing here goes through the driver.

How it was tested

  • Unit tests in tst/unit/env/envs/test_computer_clock.py cover the follower's offset, versions, config change, failures, missing config and umask, and the app's sync_time.
  • End to end on local Docker in the stacked test PR.
  • uv build --wheel: all 10 recipe files are in the wheel.

Notes

Stack: this → sync → e2e → reset.

🤖 Generated with Claude Code

… gateway's clock (FD-5476)

A Linux X11 computer env composes the `clock` app (`apps = ["clock"]`) to follow its multi env's gateway clock. Its
install builds agent-env's libfaketime at compose, preloads it into every process, and adds the clock follower, root's
loop that keeps it running, and the follower's own user, agentenv-clock, whose uid clock.conf names as the clock page's
owner.

The follower long-polls the gateway's /clock/watch with the version it last showed, which acknowledges it, and writes
the page for each new version from the local time the gateway's sent stamp corresponds to (the offset from the watch's
four stamps, as NTP estimates it). It records what it showed in a status file any user can read, and retries a failed
round with backoff. The session user can't write the page, read the follower's config, or stop either process.

The app's clock/v1 sync_time only reports what the follower showed for a config id, since its server runs as the
session user; core configures and starts the follower as root (next change). Its recipe files are per-file symlinks to
computers/clock, which a wheel packs as their content.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@williamloo-scale

Copy link
Copy Markdown
Contributor Author

Closing: superseded by #649, which puts ubuntu-24.04 computers on the gateway's clock from the base image, with core configuring the follower at deploy and after a reset. FD-5477's remaining arm-time work (wait_followers_s and the refusals) stays with its assignee.

@williamloo-scale
williamloo-scale deleted the wloo/computer-clock-follower branch November 12, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant