You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(sync,exec): add okdev sync wait; split command-exit from delivery-failure semantics
okdev sync wait [session] [--timeout 10m] blocks until every sync mapping
has zero pending bytes in both directions, giving scripts the edit-run
guarantee (vim f.py && okdev sync wait && okdev exec -- python f.py). It
forces a rescan on both sides first so files written moments earlier are
indexed immediately instead of after the FS-watcher delay, and fails fast
with guidance when background sync is not running.
Fanout exec failures are now layered: when every failing pod merely
reported a non-zero command exit, the summary is COMMAND EXITED NON-ZERO
and okdev exits with the remote status (single pod, preserving the
documented verbatim-exit contract) or 1 (multi-pod). Any delivery failure
(unreachable, timeout, container gone) keeps the FAILED framing and maps
to new dedicated exit code 69 (sysexits EX_UNAVAILABLE) via the
ErrExecInfraFailure sentinel, so scripts can tell "my command failed"
from "okdev could not deliver the command" without parsing output.
Covered by unit tests plus kind e2e scenarios (sync wait convergence
guarantee, single-pod exit-status preservation, multi-pod non-zero
framing). Docs and skill references updated.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(e2e): write sync-wait probe file inside the sync root
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/command-reference.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,10 +17,11 @@ Commands that resolve a session distinguish failure classes so scripts and
17
17
agents can react without launching a diagnostic chain on every blip:
18
18
19
19
-`0`: success.
20
-
- non-zero from a remote command (e.g. `okdev exec -- false` → `1`, `exit 7` → `7`): the remote process's own status, always preserved.
20
+
- non-zero from a remote command (e.g. `okdev exec -- false` → `1`, `exit 7` → `7`): the remote process's own status, preserved verbatim on single-pod runs. A multi-pod fanout where the command exited non-zero on some pods exits `1` (there is no single status to preserve).
21
21
-`74`: the cluster was reachable but the session has no pods — it is genuinely gone.
22
22
-`78`: a transient cluster-contact failure (API timeout, connection refused/reset, server overload). okdev already retries once with backoff before surfacing this; on `78` the caller should retry rather than treat the session as dead.
23
-
-`1`: any other error (configuration, permissions/RBAC, a failed job result, etc.).
23
+
-`69`: a fanout `okdev exec` could not run the command on at least one pod (unreachable, timeout, container gone) — a delivery failure, as opposed to the command itself exiting non-zero, which stays exit `1`.
24
+
-`1`: any other error (configuration, permissions/RBAC, a failed job result, a fanout command that exited non-zero on some pods, etc.).
24
25
25
26
## Commands
26
27
@@ -50,6 +51,7 @@ agents can react without launching a diagnostic chain on every blip:
@@ -98,6 +100,7 @@ agents can react without launching a diagnostic chain on every blip:
98
100
-`--parallel` runs declared groups in parallel. `--fanout` caps total concurrent pod executions across all groups.
99
101
-`--script <file>` uploads a local script file and runs it across the targeted pods. In v1 this is local-file-only; `--script -` is not supported.
100
102
- With `--script`, everything after `--` is passed to the script as positional arguments (`$1`, `$2`, … / `"$@"`): `okdev exec --script ./bench.sh -- --steps 100 --warmup 10` runs `bench.sh` on each pod with `$1=--steps $2=100 $3=--warmup $4=10`. Arguments containing spaces are preserved.
103
+
- Failure framing for `-- command...` fanout: when every failing pod merely reported a non-zero exit code from the command itself, the summary is headed `COMMAND EXITED NON-ZERO:` and `okdev` exits with the remote status on a single-pod run (`exit 3` → `3`) or `1` on a multi-pod run — either way `okdev exec -- cmd && next` still short-circuits `&&` chains. When any pod could not run the command at all (unreachable, timeout, container gone), the summary is headed `FAILED:` and `okdev` exits `69`, letting scripts tell "my command failed" apart from "delivery failed" without parsing output.
101
104
- The `-- command...` path is non-interactive fanout execution, not a terminal session. TTY-dependent programs such as `watch`, `top`, `htop`, or full-screen TUIs are not expected to work there; use `okdev ssh` or `okdev exec` without `-- command...` to open an interactive shell first.
102
105
-`-- command...` preserves raw argv to the remote process. If you choose `bash -lc '...'`, that remote shell layer is still yours.
103
106
-`--script` avoids the quoting/stitching problem for non-trivial shell pipelines by uploading the file and running it remotely instead of embedding the body in a one-liner.
@@ -326,6 +329,13 @@ agents can react without launching a diagnostic chain on every blip:
326
329
-`--reset --force --local` / `--reset --force --mesh`: force reset a specific component.
327
330
-`okdev init` writes the starter config and, for built-in templates, a starter local `.stignore` file for the initialized sync root.
328
331
332
+
### `okdev sync wait [session] [--timeout 10m]`
333
+
334
+
- Blocks until every configured sync mapping has zero pending bytes in **both** directions, then returns — the edit-run loop guarantee: `vim train.py && okdev sync wait && okdev exec -- python train.py`.
335
+
- Triggers an immediate rescan on both sides before waiting, so files written moments earlier are picked up now instead of after the filesystem-watcher delay.
336
+
- Purely a wait: it does not start or repair sync. If background sync is not running it fails fast with guidance (`okdev sync` starts it, `okdev sync --reset` repairs it).
337
+
- Prints pending-byte progress while waiting; exits non-zero if convergence is not reached within `--timeout`.
338
+
329
339
### `okdev upgrade`
330
340
331
341
- Checks the latest GitHub release and upgrades the `okdev` binary in place.
0 commit comments