the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
fix: stabilize flaky plugin capture tests and auto-trigger website deploy
Ogulcan Celik2fe57a57a2b3
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 9ffef369e..323d2bca9 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -352,3 +352,14 @@ jobs:git add website/latest.json docs/next/product-announcement.jsongit diff --cached --quiet || git commit -m "docs: update website manifest for v$VERSION"git push origin master++ - name: Trigger website deploy+ env:+ DEPLOY_HOOK: ${{ secrets.CLOUDFLARE_PAGES_DEPLOY_HOOK }}+ run: |+ if [ -z "$DEPLOY_HOOK" ]; then+ echo "CLOUDFLARE_PAGES_DEPLOY_HOOK not set; relying on Cloudflare git auto-deploy"+ exit 0+ fi+ curl -fsS -X POST "$DEPLOY_HOOK" > /dev/null+ echo "Triggered Cloudflare Pages production deploy"diff --git a/src/app/api/plugins/mod.rs b/src/app/api/plugins/mod.rsindex 1938589cb..8c0e42120 100644--- a/src/app/api/plugins/mod.rs+++ b/src/app/api/plugins/mod.rs@@ -695,6 +695,27 @@ mod tests {.to_string()}+ /// Wait for non-empty contents at `path`. Shell `>` creates the file empty+ /// before the command writes, so waiting on existence alone can read EOF.+ /// `pump` advances any event loop the command depends on.+ fn read_capture_when_ready(path: &std::path::Path, mut pump: impl FnMut()) -> String {+ let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);+ loop {+ pump();+ if let Ok(contents) = std::fs::read_to_string(path) {+ if !contents.is_empty() {+ return contents;+ }+ }+ assert!(+ std::time::Instant::now() < deadline,+ "plugin command did not write {} within deadline",+ path.display()+ );+ std::thread::sleep(std::time::Duration::from_millis(10));+ }+ }+fn write_manifest(root: &std::path::Path) -> std::path::PathBuf {std::fs::create_dir_all(root).unwrap();let manifest = root.join("herdr-plugin.toml");@@ -1207,11 +1228,7 @@ command = ["sh", "-c", "printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \"$PWD\" \"$HERDR_};assert!(app.state.plugin_panes.contains_key(&opened_pane_id));- let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);- while !capture.exists() && std::time::Instant::now() < deadline {- std::thread::sleep(std::time::Duration::from_millis(10));- }- let text = std::fs::read_to_string(&capture).expect("plugin pane command should write env");+ let text = read_capture_when_ready(&capture, || {});let mut lines = text.lines();assert_eq!(lines.next(), Some(canonical_path_string(&root).as_str()));assert_eq!(lines.next(), Some("example.pane"));@@ -1306,11 +1323,7 @@ command = ["sh", "-c", "printf '%s\n%s\n%s\n' \"$HERDR_PLUGIN_ROOT\" \"$HERDR_PLpanic!("expected plugin pane opened response: {open}");};- let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);- while !capture.exists() && std::time::Instant::now() < deadline {- std::thread::sleep(std::time::Duration::from_millis(10));- }- let text = std::fs::read_to_string(&capture).expect("plugin pane command should write env");+ let text = read_capture_when_ready(&capture, || {});let mut lines = text.lines();assert_eq!(lines.next(), Some(canonical_path_string(&root).as_str()));assert_eq!(@@ -1792,13 +1805,11 @@ command = ["sh", "-c", "printf '%s' \"$HERDR_PLUGIN_CONTEXT_JSON\" > {}"]},});- let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);- while !capture.exists() && std::time::Instant::now() < deadline {- app.drain_all_internal_events();- std::thread::sleep(std::time::Duration::from_millis(10));- }let context: PluginInvocationContext =- serde_json::from_str(&std::fs::read_to_string(&capture).unwrap()).unwrap();+ serde_json::from_str(&read_capture_when_ready(&capture, || {+ app.drain_all_internal_events();+ }))+ .unwrap();assert_eq!(context.workspace_id.as_deref(),Some(target_workspace.workspace_id.as_str())