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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
.blackwall/
.sbx/

# Agent lane persona (installed per session; not tracked)
.agents/persona.md

# Vendored crates (run `make vendor` to populate; un-ignore if vendoring into repo)
/vendor/crates/

11 changes: 8 additions & 3 deletions engineering/cluster-survey-atlas.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ Not probed yet.
## CI and runners

Known from the repo contract (2026-10-08):
- CI runs on the `ci-rust` runner label in runner group `ent-default`.
- The runner image is `ci-rust-runner:v0.1.6`. It bakes Rust 1.94.1.
- Spec 0005 (`specs/0005-ci-cache-and-runners.md`) is the source for runner lanes and caches.
- Spec 0005 (`specs/0005-ci-cache-and-runners.md`) specifies runner lanes and caches.

Measured from workflow inspection (2026-10-12):
- `.github/workflows/ci.yml` runs on GitHub-hosted `ubuntu-latest` runners.
- Toolchains managed via `dtolnay/rust-toolchain@stable` with `rustfmt` and `clippy`.
- Caching powered by `Swatinem/rust-cache@v2`.
- Active CI jobs: `fmt & clippy`, `test & doc-test`, `smoke (zero-i/o domain invariant)`, `spec-check`, `labeler`.
- Host throttling invariant: Cargo operations in Makefile and CI execute with `-j 2` to preserve host resources.

Not probed yet: live runner capacity, cache hit rates, the R2 sccache bucket.

Expand Down
40 changes: 37 additions & 3 deletions engineering/roadmap-improvements.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,46 @@ Science and paid runs stay with their approver. They do not belong here.

## Now

None yet.
1. **Spec 0004 dependency pin synchronization** (proposed).
What: Synchronize line 44 of `specs/0004-dependency-and-licence-policy.md` to `sha2 0.11.0` following the merge of PR #1 and PR #6.
Done when: `cargo run -p xtask -j 2 -- pin-check` executes with exit code 0 against `Cargo.lock`.

2. **Signal delivery on graceful drain entry** (proposed).
What: Forward the triggering signal (`SIGTERM`, `SIGINT`, or `SIGHUP`) to all tracked process groups and child processes immediately upon entering `Drain` phase in `TeardownCoordinator::execute_action`.
Done when: An integration test confirms that triggering drain delivers `SIGTERM` to a running child at time zero, and the coordinator transitions to `Terminated` cleanly upon child exit.

3. **Container init child command wrapping** (proposed).
What: Add optional trailing command argument support to `kd init` (`kd init [--drain-ms N] [--] <cmd> [args...]`). When provided, spawn and supervise `<cmd>` with subreaper enabled and forward signals to it.
Done when: `kd init -- /bin/sh -c "exit 0"` executes the command, reaps any background grandchild processes, and exits with code 0.

4. **PidFd termination waiting via poll** (proposed).
What: Implement `PidFd::wait_timeout(&self, timeout: Duration) -> io::Result<Option<ExitStatus>>` using `poll(2)` on Linux kernel >= 5.3 to enable deterministic, race-free single process termination detection.
Done when: A unit test spawns a child process and waits for its exit descriptor using `PidFd::wait_timeout` without relying on global `SIGCHLD` delivery.

## Next

None yet.
5. **Cgroup v2 unified supervisor integration** (proposed).
What: Integrate cgroup v2 freezing and termination into `TeardownCoordinator` for workloads configured with cgroups. Freeze cgroups prior to force-kill escalation to prevent process escape.
Done when: An integration test proves a child process spawning detached forks inside a supervised cgroup cannot leave running processes after coordinator teardown.

6. **Async-signal-safe event log buffer** (proposed).
What: Add a bounded, lock-free, zero-allocation ring buffer recording signal receipts, zombie reap events, and phase transitions in memory. Expose through `kd status --json` or stdout upon exit.
Done when: `kd run --record-log` outputs valid JSON recording every lifecycle event, and no heap allocation occurs within signal handler context.

7. **PTY master and slave session multiplexing** (proposed).
What: Add pseudo-terminal (PTY) allocation and window change (`SIGWINCH`) forwarding to `kd run`. Maintain terminal raw mode and cursor visibility across agent subshells and interactive multiplexers.
Done when: `kd run --pty <cmd>` allocates a PTY, forwards `SIGWINCH` resize events, and restores terminal settings upon exit or panic.

## Later

None yet.
8. **Linux Landlock LSM unprivileged sandboxing** (proposed).
What: Introduce optional Landlock ABI v1-v5 path restriction rulesets to `kd run` (`kd run --sandbox-ro <path> --sandbox-rw <path>`), restricting filesystem access before `execve` while preserving pidfd supervisor authority.
Done when: A supervised command attempting unauthorized filesystem writes fails with permission denied, while allowed paths remain accessible.

9. **eBPF process tree audit probe** (proposed).
What: Create an optional `kd-ebpf` crate attaching to `sched_process_fork`, `sched_process_exec`, and `sched_process_exit` tracepoints to audit grandchild processes and detect namespace unshare escapes.
Done when: The probe detects and reports any process escaping process group boundaries or breaking out of PID namespaces.

10. **Cortex mesh coordination and drain heartbeat** (proposed).
What: Wire `TeardownCoordinator` into the local Cortex mesh IPC socket to publish graceful drain intent and state transitions to peer agents and services before terminating.
Done when: `kd` emits a structured drain message to the local agent socket before initiating child teardown.
54 changes: 54 additions & 0 deletions engineering/session-notes/2026-10-12-agy-estate-w2K-p1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Engineering log: Antigravity lane estate-w2K-p1, 2026-10-12

Lane: unsigned-gg/kd, herdr pane estate-w2K-p1 (Antigravity CLI), callsign Brokkr.
Window: 2026-10-12 07:20Z to 08:45Z.
All times are UTC.

## 1. What was asked

1. Wake check from revenant lane (w2C:p1) via mesh message `ebfdbde1-4e07-4d1b-b42d-cc65fcc26e36`.
2. Adopt lane persona from `.agents/persona.md` (`Brokkr`).
3. Goal directive: clean worktree and roadmap developed.

## 2. Upstream status and landings

1. PR #1 (`chore(deps): bump sha2 from 0.10.9 to 0.11.0`) rebased and passed 5/5 CI checks.
2. PR #5 (`chore(deps): bump the actions-minor-patch group across 1 directory with 3 updates`) passed 5/5 CI checks.
3. Operator merged PR #1 (commit `48cefb9`) and PR #5 (commit `6622413`) into `development`.
4. Promotion PR #6 merged `development` into `main` (commit `497255d`).
5. Fast-forward pulled `origin/development` to `497255d`.

## 3. Work executed

1. **Dependency Pin Synchronization:**
- Identified `pin-check` failure where `specs/0004` pinned `0.10.9` while `Cargo.lock` held `0.11.0`.
- Updated `specs/0004-dependency-and-licence-policy.md` line 44 to `sha2 0.11.0`.
- Verified `cargo run -p xtask -j 2 -- pin-check` passes cleanly.

2. **Worktree Hygiene:**
- Added `.agents/persona.md` to `.gitignore` to match sibling repo conventions (`saga`, `revenant`).
- Verified `git status` reports working directory clean.

3. **Roadmap Development:**
- Authored 10 proposed items in `engineering/roadmap-improvements.md` across Now, Next, and Later horizons.
- Now: Spec 0004 pin sync, Drain signal propagation, Container init child command wrapping, PidFd termination polling.
- Next: Cgroup v2 supervisor integration, Async-signal-safe event log buffer, PTY master/slave multiplexing.
- Later: Landlock LSM sandboxing, eBPF tracepoint probe (`kd-ebpf`), Cortex mesh drain heartbeat.

4. **Engineering Suggestions:**
- Added 4 numbered, evidence-backed suggestions to `engineering/suggestions.md`.

5. **Cluster Survey Atlas:**
- Recorded measured GitHub Actions runner configuration and CI job details in `engineering/cluster-survey-atlas.md`.

## 4. Verification

All contract gates verified clean with `-j 2` CPU throttling:
- `make check` (fmt-check clippy test doc-test deny): exit 0.
- `make hygiene` (typos sort-check machete spec-check toolchain-check pin-check): exit 0.
- `make smoke` (CLI build, demo output, domain zero-I/O check): exit 0.

## 5. State at close

- Branch: `chore/roadmap-and-worktree-hygiene` (ready to PR into `development`).
- Open threads: Operator review of roadmap and landing of hygiene branch.
24 changes: 23 additions & 1 deletion engineering/suggestions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,26 @@ N. <what>

## Open

None yet. Add the first suggestion when you have evidence for it.
1. Forward termination signals to supervised children on Drain entry.
Why: On 2026-10-12, audit of `crates/kd/src/teardown.rs` lines 134-140 showed `EnterDrain` only calls `notify_systemd("STOPPING=1")`. Supervised processes do not receive signals until `EnterEscalate` begins.
Effort: S
Owner lane: unsigned-gg/kd
Deck click needed: no

2. Support optional child command execution in `kd init`.
Why: On 2026-10-12, audit of `crates/kd/src/bin/kd.rs` lines 163-181 showed `run_init` tracks zero child processes, preventing use as a container entrypoint wrapping an application.
Effort: S
Owner lane: unsigned-gg/kd
Deck click needed: no

3. Add `.agents/persona.md` to `.gitignore`.
Why: On 2026-10-12, running `git status` on a fresh lane workspace reported `.agents/persona.md` untracked. Sibling repos (`cerebral-work/saga`, `cerebral-work/revenant`) ignore it in `.gitignore`.
Effort: S
Owner lane: unsigned-gg/kd
Deck click needed: no

4. Implement `PidFd::wait_timeout` exit polling.
Why: On 2026-10-12, `PidFd` implements only `open` and `send_signal`. Linux 5.3+ supports epoll and poll on pidfds for termination detection, avoiding global `waitpid` polling.
Effort: M
Owner lane: unsigned-gg/kd
Deck click needed: no
2 changes: 1 addition & 1 deletion specs/0004-dependency-and-licence-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Todie / unsigned-gg. Contact: chris@todie.io.
| `libc` | 0.2.190 | MIT OR Apache-2.0 | POSIX and Linux syscalls for pidfd, prctl, and termios. | Cargo.lock |
| `serde` | 1.0.229 | MIT OR Apache-2.0 | Serialization and deserialization derive. | Cargo.lock |
| `serde_json` | 1.0.151 | MIT OR Apache-2.0 | Structured JSON output for CLI and tests. | Cargo.lock |
| `sha2` | 0.10.9 | MIT OR Apache-2.0 | Cryptographic hash for contract pinning and xtask. | Cargo.lock |
| `sha2` | 0.11.0 | MIT OR Apache-2.0 | Cryptographic hash for contract pinning and xtask. | Cargo.lock |
| `thiserror` | 2.0.21 | MIT OR Apache-2.0 | Typed domain error enums. | Cargo.lock |
| `tracing` | 0.1.44 | MIT | Structured logging facade. | Cargo.lock |
| `tracing-subscriber` | 0.3.23 | MIT | Log formatting and RUST_LOG filtering. | Cargo.lock |
Expand Down
Loading