code wiki / _hdl_build / nx_workstream_git.nx
nx_workstream_git.nx
buildroot/runtime/_hdl_build/nx_workstream_git.nx
about
nx_workstream_git.nx -- conflict-free PARALLEL version control for autonomous workstreams (operator: "as
we work... parallel workstreams committing in git from claude agents just all crash each other instead
of committing to their clear repo"). The fix, from the evidence (git worktrees + branch-per-task +
merge-queues / GitLab merge-trains / trunk-based):
1. ISOLATE: every workstream gets a UNIQUE branch AND a UNIQUE worktree -- two agents never share a
working dir or branch, so they cannot clobber each other (the crash is structurally impossible).
2. INTEGRATE via a MERGE QUEUE: disjoint file-sets merge in PARALLEL; overlapping ones SERIALIZE behind
a one-at-a-time queue with a pre-merge rebase+test gate. license_tier: ORIGINAL Pairs with the
Agent-tool worktree isolation; refined by /deep-research wfb7jkc6h (running).
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_orchestration_test.nxnx_parallel_runner.nx
structs
| none |
consts
| 13 | const WSG_CRASH: i64 = 0 // same branch/worktree -> would clobber (forbidden) |
| 14 | const WSG_PARALLEL: i64 = 1 // disjoint file-sets -> safe to merge concurrently |
| 15 | const WSG_SERIALIZE: i64 = 2 // overlapping file-sets -> queue behind, one at a time |
functions
| 18 | func wsg_isolation_ok(branch_a: i64, branch_b: i64, worktree_a: i64, worktree_b: i64) -> i64 |
| 25 | func wsg_overlap(mask_a: i64, mask_b: i64) -> i64 { return mask_a & mask_b } called by 1: wsg_merge_mode |
| 28 | func wsg_merge_mode(same_branch: i64, mask_a: i64, mask_b: i64) -> i64 |
| 36 | func wsg_can_merge_now(inflight_masks: *i64, n_inflight: i64, candidate_mask: i64) -> i64 called by 1: main |
| 46 | func wsg_merge_gate(rebased_clean: i64, tests_pass: i64) -> i64 called by 1: main |
| 52 | func wsg_mode_label(m: i64) -> *u8 called by 1: main |