Migrate delta-refinery git calls to OsGit and remove the stash handler #1601

Open
opened 2026-11-06 16:53:37 +00:00 by jared · 2 comments
Owner

Problem

delta-refinery runs git diff HEAD, git stash list, git stash pop, and git rev-parse HEAD in lib/agents/programmer/post.rb, lib/agents/validator/pre.rb, bin/lint_fix, and lib/rdx_cache/key.rb. post.rb runs stash pop on its own when the stash count grew. bin/lint_fix sets its baseline with instance_variable_set. These files are in the delta-refinery repository.

Design: docs/os-git/use-cases-and-domain.md (design) and docs/os-git/call-site-checklist.md (call sites). Settled decisions are in design section 1 (docs/os-git/use-cases-and-domain.md): the gem lives in plugins/os-git with a path: source; git-context and os:worktree merge into os-git; old wrappers go only after all references are updated; design order is use-cases, objects, interfaces; os-context and os-vault become Ruby; ticket tracking stays out of os-git.

Reproduce

n/a: migration of existing call sites; behavior stays the same unless a criterion says otherwise.

Approach

Group A-16. Add os-git by a path: source. Use Repository#changes and #diff(paths:, against: "HEAD") for the diff reads, and Repository#resolve("HEAD") for the cache key (keep the no-git fallback). Q8 ruling (made with /os-me:predict, recorded in the design doc): delete the stash handler (UC-28) and forbid agent stashing in the agent brief (ADR-0171 already bans stash). If a stash appears, report it and do not pop it. Commit in the delta-refinery repository with explicit paths.

Mark every row in the checklist from the Done column as it is replaced. Mark the matching test rows in the same change. Run bin/refresh-plugins after changes to SKILL.md, hooks, or CLIs.

Required work: none beyond the acceptance criteria.

Acceptance criteria

  1. Given a working tree with changes, when the programmer post step and the validator pre step run, then they produce the same changed-file list and diff text as before.
  2. Given a stash created during an agent run, when the post step runs, then it reports the stash and does not pop it.
  3. Given a directory with no git repository, when the cache key is built, then it uses the no-git fallback.
  4. Given the delta-refinery test suite, when it runs, then it passes.
  5. Given rows G-079 to G-082, when the ticket closes, then each row is marked - [x] with Replaced by filled in, or marked out of scope with a reason, in docs/os-git/call-site-checklist.md.
  6. Given the touched code, when it is searched for Open3, system(, %x, backticks, and git argv, then no git call remains outside OsGit adapters, except sites marked out of scope with a reason.

Blocking edges

Blocked by the core ticket (#1588).

Origin

  • Trigger: User request in session 1a5b2630-09c9-46cb-aee4-a5a98e2e7d24 on 2026-11-06: one os-git gem for all local git work in cc-os and the user's projects.
  • Improvised this session: none
  • Chain: agent runner shells out and pops stashes on its own ← no shared git domain ← DESIGN (docs/os-git/use-cases-and-domain.md UC-28, Q8)
  • Root candidate: none found; searched open issues for git, worktree, octokit, ruby port, python, statusline, reset --hard. Related but not a match: #845, #853, #857, #1527, #1554.
  • Where: delta-refinery/lib/agents/, delta-refinery/bin/lint_fix, delta-refinery/lib/rdx_cache/key.rb
  • Session: 1a5b2630-09c9-46cb-aee4-a5a98e2e7d24
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/1a5b2630-09c9-46cb-aee4-a5a98e2e7d24.jsonl
## Problem `delta-refinery` runs `git diff HEAD`, `git stash list`, `git stash pop`, and `git rev-parse HEAD` in `lib/agents/programmer/post.rb`, `lib/agents/validator/pre.rb`, `bin/lint_fix`, and `lib/rdx_cache/key.rb`. `post.rb` runs `stash pop` on its own when the stash count grew. `bin/lint_fix` sets its baseline with `instance_variable_set`. These files are in the `delta-refinery` repository. Design: `docs/os-git/use-cases-and-domain.md` (design) and `docs/os-git/call-site-checklist.md` (call sites). Settled decisions are in design section 1 (`docs/os-git/use-cases-and-domain.md`): the gem lives in `plugins/os-git` with a `path:` source; `git-context` and `os:worktree` merge into `os-git`; old wrappers go only after all references are updated; design order is use-cases, objects, interfaces; `os-context` and `os-vault` become Ruby; ticket tracking stays out of `os-git`. ## Reproduce n/a: migration of existing call sites; behavior stays the same unless a criterion says otherwise. ## Approach Group A-16. Add `os-git` by a `path:` source. Use `Repository#changes` and `#diff(paths:, against: "HEAD")` for the diff reads, and `Repository#resolve("HEAD")` for the cache key (keep the `no-git` fallback). Q8 ruling (made with `/os-me:predict`, recorded in the design doc): delete the stash handler (UC-28) and forbid agent stashing in the agent brief (ADR-0171 already bans `stash`). If a stash appears, report it and do not pop it. Commit in the `delta-refinery` repository with explicit paths. Mark every row in the checklist from the `Done` column as it is replaced. Mark the matching test rows in the same change. Run `bin/refresh-plugins` after changes to `SKILL.md`, hooks, or CLIs. Required work: none beyond the acceptance criteria. ## Acceptance criteria 1. Given a working tree with changes, when the programmer post step and the validator pre step run, then they produce the same changed-file list and diff text as before. 2. Given a stash created during an agent run, when the post step runs, then it reports the stash and does not pop it. 3. Given a directory with no git repository, when the cache key is built, then it uses the `no-git` fallback. 4. Given the delta-refinery test suite, when it runs, then it passes. 5. Given rows G-079 to G-082, when the ticket closes, then each row is marked `- [x]` with `Replaced by` filled in, or marked out of scope with a reason, in `docs/os-git/call-site-checklist.md`. 6. Given the touched code, when it is searched for `Open3`, `system(`, `%x`, backticks, and `git` argv, then no git call remains outside `OsGit` adapters, except sites marked out of scope with a reason. ## Blocking edges Blocked by the core ticket (#1588). ## Origin - Trigger: User request in session 1a5b2630-09c9-46cb-aee4-a5a98e2e7d24 on 2026-11-06: one os-git gem for all local git work in cc-os and the user's projects. - Improvised this session: none - Chain: agent runner shells out and pops stashes on its own ← no shared git domain ← DESIGN (docs/os-git/use-cases-and-domain.md UC-28, Q8) - Root candidate: none found; searched open issues for git, worktree, octokit, ruby port, python, statusline, reset --hard. Related but not a match: #845, #853, #857, #1527, #1554. - Where: delta-refinery/lib/agents/, delta-refinery/bin/lint_fix, delta-refinery/lib/rdx_cache/key.rb - Session: 1a5b2630-09c9-46cb-aee4-a5a98e2e7d24 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/1a5b2630-09c9-46cb-aee4-a5a98e2e7d24.jsonl
Author
Owner

Work is done and committed on delta-refinery branch ticket-1601, in worktree .claude/worktrees/ticket-1601: 749 runs, 0 failures; rake test:rdx passes. worktree finish exits 6: the main checkout has uncommitted edits to .gitignore, CLAUDE.md, and two docs/dependencies files. They do not overlap the branch and are not from this build, so they stay untouched. To finish: commit or set aside those edits, then run worktree finish ticket-1601 from the delta-refinery main checkout. Rows G-079 to G-082 are marked after the merge. Deviation on G-081: OsGit has no stash list, so the baseline compares the refs/stash tip SHA. A new stash or a pop changes the tip; the count is not read.

Work is done and committed on delta-refinery branch ticket-1601, in worktree .claude/worktrees/ticket-1601: 749 runs, 0 failures; rake test:rdx passes. worktree finish exits 6: the main checkout has uncommitted edits to .gitignore, CLAUDE.md, and two docs/dependencies files. They do not overlap the branch and are not from this build, so they stay untouched. To finish: commit or set aside those edits, then run worktree finish ticket-1601 from the delta-refinery main checkout. Rows G-079 to G-082 are marked after the merge. Deviation on G-081: OsGit has no stash list, so the baseline compares the refs/stash tip SHA. A new stash or a pop changes the tip; the count is not read.
Author
Owner

Blocked on Jared: the delta-refinery main checkout has uncommitted edits from 2026-07-14 to .gitignore, CLAUDE.md, docs/dependencies/claude-agent-sdk-ruby/authority-and-scope.md, and open-questions.md. worktree finish refuses to merge while tracked files have changes (exit 6). No branch file overlaps those edits.

Branch ticket-1601 is ready: dfc11a9 (the migration) and a52ff41 (the Gemfile now takes os_git by path to ~/dev/cc-os/plugins/os-git, cc-os ADR-0310, instead of the ~/.claude/plugins/os-git link). The tests for the changed files pass: git_workspace, programmer post, validator pre, and rdx_cache key, 44 runs, 0 failures.

Next step: Jared commits or drops the four edits, then worktree finish ticket-1601 runs from ~/dev/delta-refinery.

Blocked on Jared: the delta-refinery main checkout has uncommitted edits from 2026-07-14 to `.gitignore`, `CLAUDE.md`, `docs/dependencies/claude-agent-sdk-ruby/authority-and-scope.md`, and `open-questions.md`. `worktree finish` refuses to merge while tracked files have changes (exit 6). No branch file overlaps those edits. Branch `ticket-1601` is ready: dfc11a9 (the migration) and a52ff41 (the Gemfile now takes `os_git` by path to `~/dev/cc-os/plugins/os-git`, cc-os ADR-0310, instead of the `~/.claude/plugins/os-git` link). The tests for the changed files pass: git_workspace, programmer post, validator pre, and rdx_cache key, 44 runs, 0 failures. Next step: Jared commits or drops the four edits, then `worktree finish ticket-1601` runs from `~/dev/delta-refinery`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#1601
No description provided.