Skip to content

fix(sdk): align host detection and target path semantics - #29

Closed
spencercjh wants to merge 2 commits into
lathe-cli:mainfrom
spencercjh:codex/align-host-target-semantics
Closed

fix(sdk): align host detection and target path semantics#29
spencercjh wants to merge 2 commits into
lathe-cli:mainfrom
spencercjh:codex/align-host-target-semantics

Conversation

@spencercjh

@spencercjh spencercjh commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • check every non-generic host detection path
  • reuse an existing compatible skills directory before choosing the canonical target
  • exclude generic compatibility roots from agent-specific detection
  • enforce identical behavior in Go, TypeScript, Rust, and Python with shared golden cases

Problem

Host detection and install target resolution did not follow the same contract. An agent could be missed when only a later detection path existed, while installation always selected the first configured path even when another compatible directory was already in use.

The updated contract separates agent-specific detection evidence from compatible target directories and makes target selection deterministic across all four SDKs.

Validation

  • shared golden cases cover Codex-specific and generic path combinations
  • cross-language source and Go checks
  • GitHub Actions

Stack

This is PR 2 of 3 and is stacked on #28, followed by #30. While all three target main because the branches live in a fork, the review-specific commit is a18f0f7.

Signed-off-by: Spencer Cai <jiahao.cai@dynamia.ai>
Signed-off-by: Spencer Cai <jiahao.cai@dynamia.ai>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a18f0f7030

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +20 to +21
cd "$tmp/modules/go-cobra"
GOWORK=off go test ./...

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Test Cobra against the local core before publishing

When preparing the next release, scripts/prepare-release.mjs first changes go-cobra/go.mod to require the not-yet-published core version and then runs make check; this standalone go test therefore tries to resolve that unavailable version and fails before the replacement-based consumer check below can run. Add the temporary local-core replacement for this invocation, or defer the standalone packaged-module test until after publication, so release preparation can complete.

AGENTS.md reference: AGENTS.md:L116-L124

Useful? React with 👍 / 👎.

Comment thread scripts/check.mjs
Comment on lines +337 to +343
[
"source",
"go-test-fixtures",
"node",
["scripts/sync-go-testdata.mjs", "--check"],
rootPath,
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Record the new parity artifact in the architecture map

Adding this check makes scripts/sync-go-testdata.mjs and the copied go/spec and go/testdata artifacts part of shared golden-case parity enforcement, but docs/architecture.mmd still lists only check.mjs · sync-hosts.mjs and has no artifact or edge representing this new ownership boundary. Update the canonical diagram alongside this parity-pipeline change.

AGENTS.md reference: AGENTS.md:L140-L148

Useful? React with 👍 / 👎.

Comment thread ts/src/index.ts
Comment on lines +491 to +494
for (const detectPath of host.detect) {
if (
!isGenericDetectPath(detectPath) &&
(await exists(expandHostPath(detectPath, home, cwd)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat project-relative compatibility roots as generic

With a valid custom host spec such as detect: ["~/.agents", ".agents"], the first path is skipped but the newly scanned second path auto-detects that host in any project containing the shared .agents directory. This can make agents: "auto"—including --yes workflows—select and write for a host that is not installed; extend the generic-path handling to project-relative shared roots (and apply the same fix in all four SDKs).

AGENTS.md reference: AGENTS.md:L83-L85

Useful? React with 👍 / 👎.

@spencercjh spencercjh closed this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant