Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,28 @@ This project uses the **Rust 2024 edition** (`edition = "2024"` in root
hand-edit them. Run `cargo xflowey regen` to regenerate.
- **flowey nodes**: Use `flowey::shell_cmd!` and `rt.sh` inside flowey
nodes — not `xshell::cmd!` or `xshell::Shell::new`.

## Autonomous Agent Inner Loop

When running as a coding agent (GitHub Copilot coding agent or similar),
follow this validation loop **before pushing each commit**. This covers
the common early CI failures (including the fmt + clippy checks from job0)
locally, avoiding slow push-and-wait cycles.

1. **Identify modified packages.** For each file you changed, find the
crate's `Cargo.toml` and note the package name.
2. **Check compilation:** `cargo check -p <package>` — fast type-check.
3. **Clippy:** `cargo clippy --all-targets -p <package>` — lint.
4. **Doc:** `cargo doc --no-deps -p <package>` — catch doc errors.
5. **Unit tests:** `cargo nextest run -p <package>` — run the crate's
tests. If nextest is not installed, use `cargo test -p <package>`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a separate PR, folks said cargo test was simply broken for us. If that's true, this will lead astray.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test works fine for all the tests the agent will be able to build (they won't be able to run vmm-tests). But this note in the instructions file is kind of dumb now that we install nextest...

6. **Formatting:** `cargo xtask fmt --fix` — run last, since earlier
fixes may introduce formatting changes.

If any step fails, fix the issue and re-run from that step. Do not push
until all six steps pass.

**Cost notes:** Steps 2–5 are scoped to the modified package (`-p`),
so they are fast even in this large workspace. Step 6 runs workspace-wide
but is also fast. The full cycle typically takes under 2 minutes for
a single-crate change.
41 changes: 41 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Copilot Setup Steps"

# Validate the setup steps when they change, and allow manual testing.
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

jobs:
# This job name is required — the Copilot coding agent looks for it by name.
copilot-setup-steps:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6

# Install the exact Rust toolchain used by CI.
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- --default-toolchain=1.94.0 -y
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
Comment thread
jstarks marked this conversation as resolved.

# Install cargo-nextest so the agent can run unit tests.
# Keep this version in sync with NEXTEST in
# flowey/flowey_lib_hvlite/src/_jobs/cfg_versions.rs
- name: Install cargo-nextest
run: |
curl -LsSf https://get.nexte.st/0.9.101/linux | tar zxf - -C "$HOME/.cargo/bin"

# Restore protoc and other build dependencies via the canonical
# flowey pipeline. This compiles flowey_hvlite first, then downloads
# protoc, sysroots, firmware, and test kernels.
- name: Restore packages
run: cargo xflowey restore-packages --no-compat-igvm
14 changes: 12 additions & 2 deletions flowey/flowey_hvlite/src/pipelines/restore_packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ pub struct RestorePackagesCli {
///
/// If none are specified, defaults to just the current host architecture.
arch: Vec<CommonArchCli>,

/// Skip downloading released OpenHCL IGVM files used for compatibility testing.
///
/// This avoids the need for `gh` CLI authentication.
#[clap(long)]
no_compat_igvm: bool,
Comment thread
jstarks marked this conversation as resolved.
}

impl IntoPipeline for RestorePackagesCli {
Expand All @@ -21,7 +27,11 @@ impl IntoPipeline for RestorePackagesCli {
);

let mut pipeline = Pipeline::new();
let (pub_last_release_igvm_files, _) = pipeline.new_artifact("last-release-igvm-files");
let pub_last_release_igvm_files = if self.no_compat_igvm {
None
} else {
Some(pipeline.new_artifact("last-release-igvm-files").0)
};
let mut job = pipeline
.new_job(
FlowPlatform::host(backend_hint),
Expand Down Expand Up @@ -59,7 +69,7 @@ impl IntoPipeline for RestorePackagesCli {
|ctx| flowey_lib_hvlite::_jobs::local_restore_packages::Request {
arches,
done: ctx.new_done_handle(),
release_artifact: ctx.publish_artifact(pub_last_release_igvm_files),
release_artifact: pub_last_release_igvm_files.map(|a| ctx.publish_artifact(a)),
},
);
job.finish();
Expand Down
29 changes: 16 additions & 13 deletions flowey/flowey_lib_hvlite/src/_jobs/local_restore_packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ flowey_request! {
pub struct Request{
pub arches: Vec<CommonArch>,
pub done: WriteVar<SideEffect>,
pub release_artifact: ReadVar<PathBuf>,
/// If `None`, skip downloading OpenHCL IGVM release files.
pub release_artifact: Option<ReadVar<PathBuf>>,
}
}

Expand Down Expand Up @@ -85,18 +86,20 @@ impl SimpleFlowNode for Node {
}
}

deps.push(
ctx.reqv(
|v| crate::init_openvmm_magicpath_release_openhcl_igvm::resolve::Request {
arch,
release_version:
crate::download_release_igvm_files_from_gh::OpenhclReleaseVersion::latest(),
release_artifact:release_artifact.clone(),
done: v,
},
)
.into_side_effect(),
);
if let Some(release_artifact) = &release_artifact {
deps.push(
ctx.reqv(
|v| crate::init_openvmm_magicpath_release_openhcl_igvm::resolve::Request {
arch,
release_version:
crate::download_release_igvm_files_from_gh::OpenhclReleaseVersion::latest(),
release_artifact: release_artifact.clone(),
done: v,
},
)
.into_side_effect(),
);
}
}

ctx.emit_side_effect_step(deps, [done]);
Expand Down
Loading