Skip to content

[Nexthop][distro] Commit the bootstrap agent.conf as the first fboss2 config history commit - #1897

Draft
earnest-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:fboss-image-commit-bootstrap-agent-conf
Draft

earnest-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:fboss-image-commit-bootstrap-agent-conf

Conversation

@earnest-nexthop

Copy link
Copy Markdown

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

fboss2 starts its config history in /etc/coop at the first fboss2-dev config session, from whatever agent.conf holds then. Anything written before that (provisioning, test tooling, hand edits) is never recorded, so the first commit is not reliably the agent.conf the image installed. Tools that need the bootstrap config (for example, to lay generated configuration onto it) cannot get it from the history.

  • On the boot that creates agent.conf (first boot after imaging), fboss_init.sh starts the history as ConfigSession::initializeGit would and commits the bootstrap as cli/agent.conf with cli/cli_metadata.json: "Initial commit: bootstrap agent.conf". A new AGENT_CONF_CREATED flag, set by setup_agent_config, marks that boot.
  • Skipped when agent.conf already existed or the history has commits. A failure is logged and boot continues; fboss2's lazy init still covers that case.
  • fboss2 then skips its own init and commits on top, so the first commit stays the bootstrap.

Test Plan

  • On a Wedge800B running the FBOSS distro image, with this fboss_init.sh installed and a first boot simulated (no agent.conf, no history): one commit by fboss-cli on main holding the materialized bootstrap (with sdkVersion), identical to the live agent.conf, repository group-shared. A fboss2-dev config session then committed on top and reloaded the agent with the first commit unchanged; rerunning fboss_init added nothing.
  • shellcheck and shfmt pass.

…mmit

fboss2 starts its config history in /etc/coop at the first `fboss2-dev
config` session, from whatever agent.conf holds then. Anything written
before that (provisioning, test tooling, hand edits) is never recorded,
so the first commit is not reliably the agent.conf the image installed.

On the boot that creates agent.conf, fboss_init.sh now starts the
history as ConfigSession::initializeGit would and commits the bootstrap
as cli/agent.conf with cli/cli_metadata.json ("Initial commit: bootstrap
agent.conf"). It is skipped when agent.conf already existed or the
history has commits, and a failure is logged without stopping boot,
since fboss2's own lazy init still covers that case. fboss2 then skips
its init and commits on top, so the first commit stays the bootstrap.

Signed-off-by: Earnest Phyo <earnest@nexthop.ai>
@earnest-nexthop
earnest-nexthop requested a review from a team as a code owner November 2, 2026 17:41
@meta-cla

meta-cla Bot commented Nov 2, 2026

Copy link
Copy Markdown

Hi @earnest-nexthop!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nexthop project:distro FBOSS project: distro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant