Repository navigation
Description
Problem
One jiji-proxy container per host serves every project on it, and every project's jiji-agent reconciles that container. Today any agent may recreate it: the host lease (host_lease::try_acquire in crates/jiji-agent/src/proxy_bringup.rs) only stops two agents from recreating it at the same moment, and it is released at the end of each tick. There is no lasting owner.
#142 (for #140) handles the fights we know about without an owner:
- From jiji-agent v0.7.4, an agent never replaces a newer proxy, so among current agents the newest image wins and stays.
- A newer agent that has replaced a running proxy 3 times within 10 minutes stops replacing a running proxy until it restarts, and reports the conflict in
jiji network diagnostics. jiji server upgradeandjiji network diagnosticslist other projects' agents on the host and warn about ones older than v0.7.4 or not running.
A sticky owner was left out because it doesn't help with the case that caused #140: agents older than v0.7.4 would ignore any new lease. It may still be worth doing for future agents, so the proxy's lifecycle has exactly one decision-maker.
What a sticky owner would look like
- One agent per host holds a lease, for example a file under
/etc/jiji/proxynaming the owning project and its agent version, refreshed on every tick and expiring after N missed ticks. - Only the owner creates, recreates, or upgrades the container. The other agents only attach their own bridge and apply their own routes, as they already do every tick.
- Ownership moves to the agent with the newest paired proxy version, so upgrading any project still upgrades the shared proxy.
- An owner whose project is torn down or whose agent stops releases the lease, or lets it expire, so another agent takes over.
Open questions
- Does this fix a real failure mode that the "never downgrade" rule and the recreate guard leave open? If not, close this as not needed.
- How should an owner handle a co-resident agent that requires a newer proxy than the owner pairs with: hand over ownership, or upgrade on its behalf?
- What happens to the lease file across
jiji server teardownand host reboots?
Related surfaces to keep stable either way
- The
jiji-proxy route/tcp-route/versionflags that released agents and CLIs send, pinned by test(proxy): pin the route flags released agents and CLIs send #143. - The daemon
config.ymlreleased agents write before (re)creating the proxy, also pinned by test(proxy): pin the route flags released agents and CLIs send #143. A proxy release that renames a key there breaks older agents at recreate time, just as a flag rename would.
Needs real-host validation (Docker and Podman, two projects on different agent versions) before it ships, like #142.
Activity