City-scoped Worker: work HQ beads, open PRs on gascity-root #13
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-eij"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
rolespack's Worker now runs for the city as well as for each rig. It has noscope, so gc instantiates it in the city, asroles.worker, and in every rig, as<rig>/roles.worker. The city's pool works the HQ store's beads in worktrees of gascity-root under<city>/.gc/worktrees/workerand opens its pull requests on gascity-root; the city directory is never edited. One role serves both: the prompt, theworkerandcityskills andmol-worker-workread right for either, and the Operator routes an HQ bead to the city's pool.What changed
agent.toml: noscope. For the city,work_dirdrops the empty rig segment andpre_starthandsworktree-setup.shthe city directory, since there is no rig root. Without that, the empty argument shifted the others and a city Worker would not have started. A rig's expansions are byte-identical to before.mol-worker-work:forgedefaults toforgejo. A sling to the city's Worker has no rig behind it, so gc applies noformula_vars, and the required variable failed every such sling.workerandcityskills: say which store and repository each kind of Worker works, and that the city directory followsorigin/main.operatoranddeny-permissionskills: file a change to gascity-root as an HQ bead and route it to the city's Worker, where they said it was the user's to make.worktree-setup.sh: wording only.tests/worktree-setup.sh: a worktree of a city checkout with no default branch, and the failure with noorigin/HEAD.forgedefault) and CHANGELOG.Verified in gc 6bd609f
work_queryis needed. For an agent with no rig,controllerWorkQueryEnvsetsGC_STORE_SCOPE=city,GC_STORE_ROOT=<city>,GC_BEADS_PREFIX=<HQ prefix>and an emptyGC_RIG, so the query forgc.routed_to=roles.workerreads the HQ store. Onlyscope = "city"agents are cross-store eligible, so the unscoped Worker's hook reads that one store; a second agent withscope = "city"would also have read every rig's.work_dirandpre_startexpand over gc'sPathContextandSessionSetupContext, whereRig,RigRootandDefaultBranchare empty without a rig. Rendering both templates with gc's options gives, for the city,worktree-setup.sh <city> <city>/.gc/worktrees/worker/<name>, and for a rig what it gave before.worktree-setup.shgets no default branch for the city and readsorigin/HEADof the city checkout, which isorigin/main.formula_varsinto a sling whose agent has no rig, souserishumanunless the sling passes--var user=<name>.rig_nameis empty and no step uses it.base_branchis the city checkout'sorigin/HEADprobe (main), else the formula's defaultmain.gc forgejo pr opentakes owner and repository from the worktree'soriginand bases the pull request on the Forgejo repository'sdefault_branch. Run from a worktree of a gascity-root clone against a stub Forgejo, it requestedGET /repos/mikluko/gascity-root,GET .../pullsandPOST .../pullswithbase: mainandhead: worker/<id>..gitignorestarts with.*, so the worktrees leave the city checkout clean. The beads git hooks thatcore.hooksPathruns there (switch, commit, push) exit 0 in a worktree of a gascity-root-shaped clone; the only output is a warning that.beadsis 0755.mergeorder closes HQ beads: the city-level import registers it at city level, where it reads the HQ store.Enabling it in gascity-root, after this merges
Once a release carries this, move the
rolespin (andforgejo's, if it moved): theupgradeorder proposes that for a semverversionimport, and asha:pin moves by hand. That alone creates the city's pool, 0 to 2 sessions and idle until a bead is routed. Withrolesimported at the city level, as the README asks, noscope, import ordefault_sling_targetchange is needed.To hold the pool to the spec's 0 to 1, patch it. With no
rigkey the patch reaches the city's pool alone; the pack's one definition carries one limit, which is 2.default_sling_targetis a[[rigs]]key, so the HQ store has none. Route an HQ bead withgc sling roles.worker <bead>from outside a rig's directory; inside one, gc reads the bare name as that rig's Worker. The Operator's skill says so.The bead goes to
humanafter its pull request opens unless the sling passes--var user=<name>.Checks
gc lint .,go vetandgo testinforgejo/,tests/worktree-setup.sh,tests/merge.shandtests/upgrade.shpass, and so doesCHANGELOG.mdunder the changelog checker at v1.6.0, the newest v1. Self-review found that the new city case oftests/worktree-setup.shfailed on macOS, where$TMPDIRis a symlinked path and git lists the physical one, and fixed it.Bead: gascitypacks-eij