Commit Graph
10 Commits
Author SHA1 Message Date
weichen 35d114307d Add the svc.sh environment service manager
Why: deploying a new build meant manually finding and killing the old
process, rebuilding and re-launching with the right flags; dev and prod
instances could collide on ports, data dirs or kill each other.

Evidence: live matrix on the worktree - dev deploy (stop -> make build
-> start with health check), redeploy swaps the pid and keeps seeded
data, prod deploys alongside dev on separate port/data with fully
isolated /api/projects, port takeover is refused with the owning
process named while the running env stays up, stop clears pidfile and
frees the port. A pid-capture bug (compound-background subshell wrote
the wrapper pid instead of the server) was caught and fixed during the
first live run.

Impact: scripts/svc.sh <dev|prod> [deploy|stop|start|restart|status|
logs]; runtime/<env>/{data,svc.pid,svc.log,svc.env} isolation; defaults
dev 127.0.0.1:8788 / prod 127.0.0.1:8787 overridable via SVC_* env
vars (incl. SVC_PROD_DSN for the PG tier); make svc ENV=... shortcut;
runtime/ gitignored. Safety: only processes started by the script are
stopped (pidfile + /proc cmdline double check).

Refs: feature/svc-env-script task card.
2026-09-30 11:38:43 +00:00
weichen dfcf8e4555 Ship the post-merge hook with its executable bit
ci / test (pull_request) Failing after 1m37s
Why: the hook landed as 100644, so `make setup` chmod left a mode-only diff that makes the main checkout permanently dirty and blocks task.sh close (dirty-tree guard).
Evidence: git status showed " M scripts/hooks/post-merge" with 0 insertions/deletions after make setup; task-finish tail reported the dirty-tree refusal.
Impact: mode 100644 -> 100755 only; no content change.
Refs: task card feature/card-autoclose-r1 (PR #16 follow-up)
2026-09-30 07:22:14 +00:00
weichen beaefb7549 Add task-card autoclose wiring: close subcommand, post-merge hook, gate reports
Why: 11 merged branches had left their task cards open (bookkeeping debt found on 2026-09-30); closure was manual and never triggered, so card status rotted after each merge.
Evidence: dogfood run of `task.sh close --fold` closed and archived the 11 cards (previous commit); temp-repo matrix 33/33 PASS covering detection, pending-branch idempotence, dirty/no-fold refusals, post-merge auto-close on merge-type pulls, worktree guard, and the full lifecycle (closure PR merge archives cards on main).
Impact: scripts/task.sh (+close, precheck [cards] report, finish-tail trigger), scripts/hooks/post-merge (new), Makefile (+task-close target, setup chmod), AGENTS.md rule; archive fixes correct PR links missed by the first dogfood run; no module or gitlink change.
Refs: task card feature/card-autoclose-r1
2026-09-30 07:12:54 +00:00
weichen 51543046e1 Pin T1 contracts combo and guard task-finish against wrong cwd
Why: Provider repos merged for T1 (core PR#2, agent-command PR#2, frontend
  PR#3, ui PR#3, documents PR#9); gitlinks pinned to those mains. The
  task-finish guard prevents a repeat of the T0 incident where running
  finish from the main checkout deleted it (scripts/task.sh treated $PWD as
  the worktree to remove).

Evidence: make test green on the pinned combo — core, backend 13 pkgs,
  frontend 9, ui 6, agent-command (vet + tests incl. conformance); make build
  produces the binary; combo version string now includes agentcmd SHA.

Impact: combo grows its version traceability; AGENTS.md documents the
  worktree-cwd requirement for finish.

Refs: modules/documents docs/records/2026-09-30-t1-core-cards-commands-verification.md
2026-09-30 06:29:11 +00:00
weichen 7c9c1e7b22 Align task-start guards with precheck and soften uninitialized to warning
Why: the pin-documents flow exposed guard divergence — precheck counted
submodule drift while task-start checked porcelain only, letting a task
start despite a BUSY verdict; and PR#8 overcorrected by treating
uninitialized (-) submodules as BUSY when they only block builds, not
writes.
Evidence: bash -n clean; precheck on this checkout prints tree line with
drift/uninit split and READY verdict; negative path exercised by the
real divergence that started this task.
Impact: precheck warns on uninitialized, BUSY only on +/U; task-start now
refuses on porcelain dirt and +/U drift, matching precheck.
Refs: PR#8; policy/tool-adaptation-matrix.md A1
2026-09-30 03:50:46 +00:00
weichen c2da46e4d2 Harden the gate: uninitialized-submodule detection and platform protection registration
Why: precheck missed uninitialized submodules (git submodule status '-'
prefix), and the branch protection configured today plus the second live
probe outcome must be recorded honestly in the matrices.
Evidence: platform negative: direct push to protected main rejected
(pre-receive hook declined, Logging-System probe); second write-guard probe
confirmed session-start config loading (no hook run in the pre-config
session log).
Impact: precheck sub_dirty now counts '-' prefixed entries; A3 registered
enforced at platform layer across 11 repos; zcode matrix pending-live
annotated with the loading-timing proof.
Refs: policy/tool-adaptation-matrix.md; policy/tool-adaptation-zcode.md
2026-09-30 03:47:24 +00:00
weichen ccddcc2b2b Add the zcode write-path guard instance with its adaptation matrix
Why: zcode lacks a rules feature (AGENTS.md is the resident layer) but
supports PreToolUse hooks that can block Edit/Write before the write lands,
upgrading A1/A3 from commit-time to write-time enforcement; the two block
shapes (integration branch, detached submodule) mirror the real incidents.
Evidence: script-level suite 8/8 (N1-N3 blocks with exit 2 and remediation
hints, P1-P5 allows incl. fail-open degradation paths); config JSON valid;
client-side live-fire interception marked pending-live in the matrix.
Impact: .zcode/config.json enables the hook runner for this workspace;
.zcode/plans/ ignored (client state); no product code change.
Refs: Development-Guidelines 0.1.0-draft.8; policy/tool-adaptation-zcode.md
2026-09-30 03:43:26 +00:00
weichen fdf63e3fc8 Fall back to prune-based removal for submodule-bearing worktrees
Why: git unconditionally refuses worktree remove when the tree contains
gitlinks (index-level check; deinit does not bypass it), so the PR#4 fix
path still failed on the second real task.
Evidence: after deinit the worktree was clean and submodule dirs empty, yet
remove refused; rm -rf + worktree prune is the documented workaround and
was proven manually on the empty-list task worktree.
Impact: task-finish now completes the recycle path automatically after its
merge verification; no guard weakened.
Refs: Agent-System-Dev PR#4; policy/tool-adaptation-matrix.md A5
2026-09-30 03:37:01 +00:00
weichen a073b8712c Teach task-finish to recycle submodule-bearing worktrees
Why: git refuses to remove a worktree with initialized submodules; the first
real dogfood run of task-finish hit this on the empty-list fix task.
Evidence: the fix task's worktree recycled only after manual force-remove;
deinit-then-remove path exercised on the same state afterwards.
Impact: finish deinitializes submodules, removes, prunes, and deletes the
remote branch; unmerged-result guard unchanged.
Refs: .task/fix-empty-list-json.md
2026-09-30 03:27:06 +00:00
weichen f31fd5f62d Add the task-startup gate scripts and local hooks
Why: agents skipped triggered reading and wrote into shared checkouts holding
other tasks' in-flight changes; the 2026-09-30 empty-list incident session
found 24 overlapping in-flight files only by accident at first write.
Evidence: positive/negative suite in a real scratch repo passed 19/19
(precheck READY/BUSY/SYNC_REQUIRED, start refuse/establish, hook main/badname/
longsubject refusals, sync checkpoint, finish recycle and abandon double-
confirm); the suite caught three real defects (pipefail empty-grep abort,
worktree gitdir COMMIT_EDITMSG resolution, message checks in the wrong hook
phase).
Impact: make setup enables pre-commit/commit-msg hooks; make precheck/task-
start/task-sync/task-finish provide the governed path; no existing workflow
removed. AGENTS.md carries the resident gate rules.
Refs: Development-Guidelines 0.1.0-draft.7; task card .task/delivery-mechanism.md
2026-09-30 03:11:58 +00:00