fix(tasks): switch cwd detection from removed for-cwd to view . --json - #42
Merged
Conversation
…json`
agi-cli (agents-cli) deleted `agents projects for-cwd` and folded cwd→project
detection into `agents projects view <path> --json` (PHNX-3704, agi-cli #3380,
merged + released). linear-cli's resolve_cwd_project still called the now-gone
`for-cwd`, so on an updated `agents` binary it fell open to unscoped — a
regression the 0.20.0 auto-scope was about to ship.
Rewrite resolve_cwd_project to a SINGLE `agents projects view . --json` call:
it longest-matches the cwd over every bound root + monorepo subpath and returns
`{name, linear:{name, projectId}, root}` in one shot (an unmatched cwd returns
null fields, exit 0). Replaces the previous two-call `for-cwd` + `list` dance.
Same fail-open contract (missing binary / timeout / nonzero / bad JSON / no
match → (None, None), never raises). Amends the unreleased 0.20.0 CHANGELOG.
Tests: ResolveCwdProjectTest rewritten to the single view call; 132 pass.
Live: from prix/ scopes to Prix via view . --json; from /tmp unscoped —
verified against the installed agents that already has view and lacks for-cwd.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code ReviewerVerdict: Ready to merge Build: ✅ Compiles cleanly (Python syntax check, SummaryReplaces the two-call Changes that work well
IssuesNone found. The diff is a straightforward API consumer switch with complete test coverage and no observable behavior changes. Reviewed by Code Reviewer — actually ran the build and tests on this branch (132/132 pass). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
agi-cli deleted
agents projects for-cwdand folded cwd→project detection intoagents projects view <path> --json(PHNX-3704 / agi-cli #3380, merged + released). linear-climain'sresolve_cwd_projectstill calls the now-removedfor-cwd, so on an updatedagentsbinary it falls open to unscoped — the regression the unreleased 0.20.0 auto-scope was about to ship.What
resolve_cwd_project→ a singleagents projects view . --jsoncall. It longest-matches the cwd over every bound root + monorepo subpath and returns{name, linear:{name, projectId}, root}in one shot (unmatched cwd → null fields, exit 0). Replaces the two-callfor-cwd+listdance.(None, None), never raises.Verified
python3 -m unittest test_linear→ 132 pass (ResolveCwdProjectTest rewritten to the single view call).agents(which already hasview, lacksfor-cwd):agents/prix→project: {name: Prix, auto: true}, scope all, 64 tasks/tmp→project: null, unscopedCloses the consumer half of PHNX-3704. After merge → cut linear-cli 0.20.0.