code wiki / _hdl_build / nx_workstream_git.nx

nx_workstream_git.nx

buildroot/runtime/_hdl_build/nx_workstream_git.nx

2834 B56 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic workstream
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_workstream_git.nx nx_orchestration_test.nx nx_parallel_runner.nx

imports: nx_syscalls.nx

imported by: nx_orchestration_test.nxnx_parallel_runner.nx

structs

none

consts

13const WSG_CRASH: i64 = 0 // same branch/worktree -> would clobber (forbidden)
14const WSG_PARALLEL: i64 = 1 // disjoint file-sets -> safe to merge concurrently
15const WSG_SERIALIZE: i64 = 2 // overlapping file-sets -> queue behind, one at a time

functions

18func wsg_isolation_ok(branch_a: i64, branch_b: i64, worktree_a: i64, worktree_b: i64) -> i64
called by 2: mainmain
25func wsg_overlap(mask_a: i64, mask_b: i64) -> i64 { return mask_a & mask_b }
called by 1: wsg_merge_mode
28func wsg_merge_mode(same_branch: i64, mask_a: i64, mask_b: i64) -> i64
called by 1: main calls 1: wsg_overlap
36func wsg_can_merge_now(inflight_masks: *i64, n_inflight: i64, candidate_mask: i64) -> i64
called by 1: main
46func wsg_merge_gate(rebased_clean: i64, tests_pass: i64) -> i64
called by 1: main
52func wsg_mode_label(m: i64) -> *u8
called by 1: main