Skip to content

refactor(agents): discover skill context with Go - #796

Draft
tbhb-agent wants to merge 2 commits into
mainfrom
feat/755-20261026
Draft

tbhb-agent wants to merge 2 commits into
mainfrom
feat/755-20261026

Conversation

@tbhb-agent

@tbhb-agent tbhb-agent commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Use the agentrepo context command for repository, worktree, harness, and session discovery. Buffer responses and reject failed or incomplete output. Keep the existing shell path for binaries without the command.

Why

A failed Git or checksum lookup must stop discovery without exposing a partial value or selecting a fallback. Existing consumers need the shell path until #772 removes it.

Verification

AC Command Result
Older binaries keep the shell result mise run test-hooks tests/skills/source/lib Passes with older binary stubs, with no call to context.
Repository, unborn HEAD, linked worktree, harness, and session discovery match the shell `go test ./internal/agentrepo ./internal/config -run 'TestDiscovery TestContext' -count=1`
Failed producers and incomplete frames refuse with empty stdout mise run test-hooks tests/skills/source/lib Passes. The fixtures reject any shell fallback.
Git failures keep status and diagnostics mise run test-hooks tests/skills/source/lib Passes with empty stdout.
Readiness output matches the shell `go test ./internal/agentrepo ./internal/config -run 'TestDiscovery TestContext' -count=1`
Checksum failures match shell status and streams mise run test-hooks tests/skills/source/lib Passes, including a producer that prints before failing.
Generated skill copies match their sources mise run check-generated-skills Passes.
Repository gates mise run lint Passes.

Risk

Skill gates depend on discovery. Accepting a failed response could hide an error. Caller fixtures exercise that boundary. Revert this change to restore the previous behavior.

Compatibility: none

Related

Closes #755. Part of #588. Merges after #753. Issue #772 owns fallback removal.

@tbhb-agent tbhb-agent added the provenance:agent-assisted PR contains commits authored with AI assistance (see Assisted-by trailers) label Oct 26, 2026
Skill callers need to distinguish an absent capability from a failed
lookup. Buffer supported responses before exposing a value so Git and
checksum failures can't select a shell fallback or leak partial data.
Keep older binaries on the existing shell path without raising the
binary floor. Preserve worktree readiness refusals and session
precedence while leaving trust and downloads to the operator.

Assisted-by: codex:gpt-6.1-sol
Signed-off-by: Tony Burns <tony@tonyburns.net>
Windows path joining changes the spelling returned by Git. Git Bash
also converts literal arguments before a native command reads them.
Preserve the shell strings that existing callers expect from discovery.

Use the sourcing shell's home spelling for expansion without overriding
`HOME` in native child processes.

Assisted-by: codex:gpt-6.1-sol
Signed-off-by: Tony Burns <tony@tonyburns.net>
@tbhb-agent tbhb-agent added the change:chore PR with no user-facing change (chore, refactor, build, ci, test, style, perf) label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:chore PR with no user-facing change (chore, refactor, build, ci, test, style, perf) provenance:agent-assisted PR contains commits authored with AI assistance (see Assisted-by trailers)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(agents): port skill capability and worktree context discovery to Go

1 participant