feat: /pull-base lab command — user-driven base sync, pull-on-clear, behind-base badge #150
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab!150
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/149"
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?
Closes #149
What
Long-lived instances (grilling sessions especially) go stale when AFK runs land PRs: the worktree falls behind
origin/<base>and the model's context caches reads of old code. This PR ships the full design from #149:/pull-baselab command — the first lab command (new CONTEXT.md concept): the server intercepts it in the composer reply path and it never reaches the provider. It fetches the bare reference repo, mergesorigin/<base>into the run's live worktree (ff when possible, real merge commit otherwise), and repairs the context layer by injecting a compact digest (merge range, commit subjects, capped name-status file list, re-read instruction) down the ordinary reply path.workingagent gets "agent is busy — retry when idle" (409) with no git ops; idle / needs-input / question-pending proceed. If a question dialog blocks digest delivery after a successful merge, the operator gets a 200 notice ("digest was not delivered") rather than a false error.role=clearcommand pulls the base before forwarding the clear, so the fresh context's first read sees fresh disk. Silent on success; loud (200 notice) when skipped-busy or failed; the clear itself always goes through.commits_behindon run detail + instance rows (computed from the bare repo's local refs, no fetch in the request path; freshness rides the existing fetch cadence), an "N behind" chip on the chat header and runs rail (hidden at 0), and a newrun.changedpublish from crmerge the instant it advances a base.repos.default_branch, written as "the run's base" seam so #130/#131 slot in without rework.Layering
gitx.PullBase/CommitsBehind/SummarizeRange(primitives, worktree-untouched failure contract) →internal/pull(crmerge-sibling service: per-run lock, credential env, real author identity, digest rendering, bus publish) →httpapireply-path interception + catalog entry (source: "lab") → web chips/notice banner.Testing
go test ./...green except the pre-existing environmentalinternal/tmuxxreal-tmux failures (package byte-identical to main; sessions cannot survive in this sandbox).go vet ./...,gofmt,npm test(743),npm run lint,format:check,vite build, and the CI-equivalent-tags uibuild with embedded dist all green. golangci-lint is not available in the sandbox — CI's lint gate is the authority there.Out of scope (per issue)
Manual conflict resolution only (no
--resolvemode), tmux-typed clears bypass the pull, staleness between fetches for out-of-band pushes, no command arguments in v1.🤖 Generated with Claude Code
https://claude.ai/code/session_01F3HJWv15fwMgR7iyL5UK91