Skip to content

[FD-5700] refactor(computers): the clock library and the egress proxy live once, in utils, and each image takes them - #763

Merged
earakely-scale merged 5 commits into
mainfrom
edgararakelyan/fd-5700-hb1-follow-up-the-clock-library-as
Nov 18, 2026
Merged

earakely-scale merged 5 commits into
mainfrom
edgararakelyan/fd-5700-hb1-follow-up-the-clock-library-as

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

FD-5700, and a prerequisite of #726.

ubuntu-24.04 and ubuntu-24.04-browser each held a copy of clock/ (agent-env's libfaketime, the TLS shim, the clock page and the clock follower) and egress/ (the egress proxy). The browser base also copied ubuntu-24.04's root/ and root.conf. Drift tests kept the copies equal, so a fix had to land in each. The clock follower fix on #726 landed in three places. #726 would add a third copy, for the Claude Code image.

The copies existed because an image builds only from its own folder. This PR keeps one copy and lets each image's build context take it in.

What changes

  • clock/ moves to src/agent_env/utils/faketime_clock/ and egress/ to src/agent_env/utils/egress_proxy/, the only copies.
  • Each image that takes them names them in a shared_sources.toml beside its Dockerfile, by the name its Dockerfile copies from:
    clock = "utils/faketime_clock"
    egress = "utils/egress_proxy"
    Paths are under src/agent_env; the names on the left are the folders the Dockerfiles copy from, so Dockerfiles are unchanged. The browser base takes ubuntu-24.04's root/ and root.conf the same way.
  • BuildContext (utils/docker/context.py) holds what its shared_sources.toml takes, at those names. It refuses a name the folder already has, and a path outside agent-env's sources. The toml itself isn't sent, so a context written out and unpacked builds as it is.
  • So every builder still gets one self-contained context: local, VM sandbox, Modal, and the composer's base builds.
    • build_image builds a folder that has a shared_sources.toml as its context sends it.
    • Release CI (infra_build.py) stages the same files before docker build.
  • An image's source hash covers what it takes, so a clock change reaches every image that takes it, in the same PR.
  • A bundle's ledger hashes each file an image's shared_sources.toml takes, under its name in the build context. So rerunning a bundle rebuilds the image when shared code changes ("files changed: clock/libfaketime.patch"), even when no published image exists for the new sources.
  • Paths in AGENTS.md, the Makefile, the clock and local-backends workflows, dependabot and THIRD_PARTY_NOTICES point at the new folders. AGENTS.md's computers entry no longer describes the per-base copies.
  • The drift tests are replaced by tests that the bases take, and don't hold, what they share.

Verification (Linux VM)

  • Unit tier: passes. Four tests fail on that VM (a missing tool), and they fail identically on main.
  • ruff: clean.
  • computer_clock_test.py and both browser_clock_test.py tests: pass, composing both bases through the real bundle and composer path.
  • The wheel and the sdist: hold the shared folders once, with no duplicate entries. Both bases hash the same installed as from the checkout.
  • Build time: unchanged. A cold build of ubuntu-24.04 took 78 s, against 85 s on main. Each image still compiles the library and the proxy for its own base and libc, as before.
  • Both bases' published tags change once: because of the README path fix in faketime_clock/README.md, and because the context now includes what it takes in place of the old copies. The next release rebuilds them, as for any base change.

Release path (Linux VM, amd64)

  • infra_build.py build, as release CI runs it: both bases build from cold and pass infra_build.py smoke. ubuntu-24.04 took 77 s against 101 s on main; the browser base 61 s against 49 s.
  • Image diff against main's build: every file's content, mode and owner. The clock, egress, root and supervisord files are identical in both bases. The only differences are apt and dpkg logs, the ldconfig and fontconfig caches and the dbus machine-id, which differ on any rebuild. The image configs match except the source-tag and revision labels.
  • Disk form: built on the branch's base, it boots to its desktop under TCG in 81 s.
  • Run before the move to utils/ and the rename to shared_sources.toml, which change only paths and names.

Compose and run, and chaos (Linux VMs, amd64, at fe5c0de)

  • agent-env run desktop: composes the shipped desktop (ubuntu-24.04 with the reference driver) and passes the probe at full; a second run reuses everything. After an edit to utils/faketime_clock/clock.conf, the next run rewrites the base (files changed: clock/clock.conf), the computer and the env, and the newly composed image holds the edit. The files task passes too.
  • Computer integration tests: desktop_example_test, computer_clock_test, browser_clock_test, clock_desktop_test, egress_test and base_computer_test: 24 passed, 1 skipped (the agent test, no model endpoint).
  • Chaos, on a user bundle whose base is a copy of ubuntu-24.04 with its shared_sources.toml:
    • It composes and passes the probe.
    • A toml naming a missing path, a path outside agent-env, invalid TOML, or a name the folder also has is refused in 2 s, before any build, with a message naming the problem.
    • A toml missing egress, or a shared file deleted from agent-env, fails at the build naming the missing path; restored, it passes.
    • A run killed mid-build, or during the probe, after a shared edit is recovered by the next run, which passes with the edit in the image.
    • Two runs at once both pass.
    • bundle init of its stored task writes the base with clock/ and egress/ and no toml, and the exported folder composes and passes the probe.

Notes

  • Symlinks were tried and dropped. hatchling puts a file into the wheel and the sdist once, at the first name it reaches it by, so a folder that two images link to ships in only one of them.
  • A published clock image was considered and dropped. No deploy-time build path passes build args, VM and Modal build from one context, the libraries are per libc, and every clock change would ship in two steps.
  • [FD-5916] feat(agents): the Claude Code image follows the env's clock #726 next: the Claude Code image drops its copies and adds a shared_sources.toml.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new blocking issues were found.

Summary

The PR puts the clock and egress code in shared folders while keeping each image's build inputs self-contained.

  • Both computer bases take their clock and proxy from one shared source.
  • Image builders now include declared shared files in each build context.
  • Bundle rebuild decisions now include the shared files an image takes.

No new actionable issues found in the changes since the previous review. Tests were not run during this review.

Reviews (7) · Last reviewed commit: "fix(bundle): a bundle rebuilds an image ..." · Reviewed by Greptile

…, in image_kits, and each image takes them

ubuntu-24.04 and ubuntu-24.04-browser each held a copy of clock/ and egress/ (and the browser base of root/ and
root.conf), kept equal by drift tests, so a fix had to land in each. They now live once, in src/agent_env/image_kits/,
and each base names what it takes in an image_kits.toml (clock = "image_kits/clock"); the browser base takes
ubuntu-24.04's root/ and root.conf the same way.

A build context holds what its image_kits.toml takes, each at the name it gives (utils/docker/context.py), so an
image still builds from one self-contained context on every builder, and its source hash covers what it takes. A local
docker build of such a folder builds that context, and release CI stages the same files (infra_build.py _staged).
Links stay links; the files are real everywhere, in the repository, the sdist and the wheel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread Makefile Resolved
Comment thread src/agent_env/utils/docker/context.py Resolved
earakely-scale and others added 3 commits November 17, 2026 21:15
… image_kits, and ignore exceptions reach a kit

- make egress-test read the Go image from ubuntu-24.04's Dockerfile, not from beside egress/, which moved.
- tst/util/published_image.py builds a base it can't pull through build_image, so its context takes what its
  image_kits.toml names (the slow computer tiers built the bare folder and failed).
- A kit the ignore file excludes is skipped only when no exception pattern brings something under it back, as a
  folder of the context's own is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…herever pytest starts

Its entry names the base by the repository-relative path the release workflow runs from; CodeBuild starts pytest
elsewhere, so it listed nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…faketime_clock and utils/egress_proxy

image_kits/ didn't say what it held. Each image's image_kits.toml names the new paths; the build context names
(clock, egress) and so the Dockerfiles are unchanged. AGENTS.md's computers entry no longer describes the per-base copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale earakely-scale changed the title [FD-5700] refactor(computers): the clock library and the egress proxy live once, in image_kits, and each image takes them [FD-5700] refactor(computers): the clock library and the egress proxy live once, in utils, and each image takes them Nov 18, 2026
…toml takes changes

The ledger hashed an image's own folder, so after the clock and egress proxy moved to utils/, editing them left a
bundle reusing the image built from the old copy whenever no published image stood for either: a second local edit,
a machine that can't reach GHCR, or a user's bundle that copies a base. It now hashes each file the toml takes, under
its name in the build context, so a rerun says "files changed: clock/libfaketime.patch".

image_kits.toml is renamed shared_sources.toml, which says what it lists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit 9472c9b into main Nov 18, 2026
41 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-5700-hb1-follow-up-the-clock-library-as branch November 18, 2026 17:09
earakely-scale added a commit that referenced this pull request Nov 18, 2026
)

The follower fix and the egress proxy change this branch made to the bases' copies are in utils/faketime_clock and
utils/egress_proxy; the bases' old copies are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
williamloo-scale added a commit that referenced this pull request Nov 18, 2026
…ls (shared_sources.toml), as Claude Code's does

Drops the clock/ and egress/ copies now that #763 keeps one copy of each in utils; the Dockerfile still copies from
clock/ and egress/, which the build context takes from there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
williamloo-scale added a commit that referenced this pull request Nov 18, 2026
…ls (shared_sources.toml), as Claude Code's does

Drops the clock/ and egress/ copies now that #763 keeps one copy of each in utils; the Dockerfile still copies from
clock/ and egress/, which the build context takes from there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
williamloo-scale added a commit that referenced this pull request Nov 18, 2026
…ls (shared_sources.toml), as Claude Code's does

Drops the clock/ and egress/ copies now that #763 keeps one copy of each in utils; the Dockerfile still copies from
clock/ and egress/, which the build context takes from there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
williamloo-scale added a commit that referenced this pull request Nov 18, 2026
…ls (shared_sources.toml), as Claude Code's does

Drops the clock/ and egress/ copies now that #763 keeps one copy of each in utils; the Dockerfile still copies from
clock/ and egress/, which the build context takes from there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
williamloo-scale added a commit that referenced this pull request Nov 18, 2026
…ls (shared_sources.toml), as Claude Code's does

Drops the clock/ and egress/ copies now that #763 keeps one copy of each in utils; the Dockerfile still copies from
clock/ and egress/, which the build context takes from there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
williamloo-scale added a commit that referenced this pull request Nov 18, 2026
…ls (shared_sources.toml), as Claude Code's does

Drops the clock/ and egress/ copies now that #763 keeps one copy of each in utils; the Dockerfile still copies from
clock/ and egress/, which the build context takes from there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant