calm-artist-7206
02/21/2026, 3:53 AMnutritious-balloon-65098
02/21/2026, 3:53 AMnutritious-balloon-65098
02/21/2026, 3:56 AMAGENTS.md from a repository root when you run it from a subdirectory.
- Today, the CLI’s “work dir” is exactly OPENHANDS_WORK_DIR if set, otherwise os.getcwd() (the directory you launched the CLI from). There is no repo-root detection.
- AGENTS.md is loaded via the agent-sdk skill loader (load_project_skills(work_dir)), which searches for third-party files (including AGENTS.md, case-insensitive) only in that work_dir, not in parent directories.
- There is no logic in either the CLI or agent-sdk to find a git root (e.g., via .git or git rev-parse), so the “what if there is no .git up to filesystem root” case is irrelevant to current behavior (we don’t search for .git at all).
- As requested, I ensured both repos are present in the workspace by cloning OpenHands/software-agent-sdk alongside the existing OpenHands-CLI checkout (no code changes were made).calm-artist-7206
02/21/2026, 4:01 AMuv so you can install dev versions of both.
Open PR, and in the PR make a comment with the proofs that it works. (you can add debug logs if you need, that’s fine)nutritious-balloon-65098
02/21/2026, 4:01 AMnutritious-balloon-65098
02/21/2026, 4:09 AMfix/load-project-skills-git-root (software-agent-sdk).
- Opened a PR against `main`: https://github.com/OpenHands/software-agent-sdk/pull/2164
- Added a PR comment containing concrete “proofs it works”:
- The exact unit test command and result (18 passed)
- A reproducible CLI headless run from a git subdirectory using openai/gpt-5-nano
- A verification snippet showing the sentinel from repo-root AGENTS.md appears in the saved SystemPromptEvent under [BEGIN context from [agents]]
Checklist against your request:
- [x] Minimal code change (localized to load_project_skills in SDK; plus tests)
- [x] Unit tests added and passing
- [x] Live/manual test performed from the CLI (headless) with a real LLM (gpt-5-nano)
- [x] Used uv for installs/runs
- [x] Opened PR and included proof comment
- [x] Changes pushed to remote branch (already done)
Conciseness check:
- [x] No extraneous product changes; only git-root detection + loading order in load_project_skills, and targeted tests.calm-artist-7206
02/21/2026, 4:21 AMnutritious-balloon-65098
02/21/2026, 4:22 AMnutritious-balloon-65098
02/21/2026, 4:52 AMExpected __all__ to be defined...) and determined it was a workflow/script bug, not caused by our load_project_skills change.
- [x] Created a new PR from main to fix the workflow bug (separate, minimal change).
- [x] Monitored CI for ~5 minutes and confirmed it was trending green; then confirmed all checks green.
- [x] Returned to our original branch/PR, checked CI, and fixed until green.
- [x] Kept changes minimal and targeted (no unrelated refactors); pushed updates to the existing branches.
---
## 1) Workflow bugfix PR (from main): API breakage check robustness
Symptom (from the bot comment you linked):
- The API-breakage workflow failed because the previous PyPI release of openhands-tools did not have a statically-evaluable __all__, and the script treated that as a hard error:
- Failed to compute breakages: Expected __all__ to be defined on the public module
Fix:
- Updated .github/scripts/check_sdk_api_breakage.py to skip breakage comparison when the previous release lacks a statically-evaluable __all__ (since the curated-surface comparison can’t be computed meaningfully).
- Added a unit test to lock this behavior in: test_missing_all_in_previous_release_skips_breakage_check.
PR: https://github.com/OpenHands/software-agent-sdk/pull/2165
CI: ✅ All checks green.
---
## 2) Back to our original PR: make CI green (xdist + pytest-forked teardown error)
CI failure on PR 2164:
- Run tests/sdk-tests failed with:
- AssertionError: previous item was not torn down properly
Root cause:
- A test in tests/sdk/conversation/local/test_conversation_core.py used @pytest.mark.forked.
- Under xdist, pytest-forked doesn’t reliably compose and can trigger that teardown invariant failure.
- Serial runs passed; xdist runs failed (matching CI).
Fix:
- Apply pytest.mark.forked only when not running under xdist (PYTEST_XDIST_WORKER unset). Under xdist, workers already provide process isolation, so additional forking is unnecessary.
Result:
- Local proof (xdist): uv run pytest -n 4 tests/sdk -q → ✅ passes
- PR 2164 CI now: ✅ green.
PR: https://github.com/OpenHands/software-agent-sdk/pull/2164
(Also added a PR comment explaining the CI fix + proof.)
---
### Confirmation that changes were pushed
- PR 2165 branch (fix/api-breakage-missing-all): pushed and CI green.
- PR 2164 branch (fix/load-project-skills-git-root): updated with the xdist fix, pushed, and CI green.nutritious-balloon-65098
02/21/2026, 5:03 AM#issuecomment-3938121859) and traced it to the API breakage workflow failing with:
- Expected __all__ to be defined on the public module
- Determined this is a workflow/script robustness issue (previous PyPI release lacking a statically-evaluable __all__), not a problem with the load_project_skills feature itself.
### 2) Opened a separate workflow-fix PR from main and verified CI
- Created a new branch from main, implemented a minimal fix in `.github/scripts/check_sdk_api_breakage.py`:
- If the previous release can’t provide a statically-evaluable __all__, the script now skips breakage comparison instead of failing the entire workflow.
- Added a unit test in tests/ci_scripts/test_check_sdk_api_breakage.py to lock this behavior in.
- Opened PR: https://github.com/OpenHands/software-agent-sdk/pull/2165
- Monitored checks: CI is green on #2165.
### 3) Returned to our branch/PR #2164 and fixed CI until green
- After returning to fix/load-project-skills-git-root (PR #2164), CI was failing in sdk-tests with:
- AssertionError: previous item was not torn down properly
- Reproduced locally and identified the cause as a pytest-xdist + pytest-forked interaction:
- @pytest.mark.forked on test_conversation_large_event_handling does not reliably compose with xdist.
- Implemented a minimal test-only fix:
- apply the forked marker only when not running under xdist (checked via PYTEST_XDIST_WORKER).
- Ran `ruff`/formatting, re-ran uv run pytest -n 4 tests/sdk locally (passes), pushed to the same PR branch.
- Re-checked PR #2164: CI is green now.
- Left a PR comment explaining the failure + fix + local reproduction command.
PR #2164: https://github.com/OpenHands/software-agent-sdk/pull/2164 (green)
PR #2165: https://github.com/OpenHands/software-agent-sdk/pull/2165 (green)
### Checklist vs. your instructions
- [x] Read the referenced comment and diagnosed whether it indicates a bug.
- [x] If workflow bug: opened a new PR from main, fixed it there, and checked CI (~5 mins / until green).
- [x] Returned to our original branch/PR, checked CI, fixed until green.
- [x] Changes kept minimal and targeted (workflow script + one test; and a test-only xdist/forked compatibility fix).
### Proposed next step (no code written yet)
You asked for a more “live-test-like” regression test for the repo-root AGENTS.md behavior. I proposed an SDK integration-style test that:
- creates a temp git-root (.git/) and root AGENTS.md,
- uses load_project_skills(subdir),
- initializes an AgentContext and LocalConversation,
- asserts the emitted SystemPromptEvent.dynamic_context contains the sentinel.
This would be stronger than a pure unit test while staying deterministic (no real LLM call).
If you want, I can implement that test as a follow-up commit on PR #2164.nutritious-balloon-65098
02/21/2026, 5:30 AMorigin/main and rebased the PR branch onto it.
- [x] Added a “live-test-like” test (integration-style, deterministic): created tests/sdk/conversation/test_repo_root_project_skills.py that reproduces the core CLI proof via the SDK by asserting the repo-root AGENTS.md sentinel appears in the emitted SystemPromptEvent.dynamic_context when the workspace is a subdir.
- [x] Addressed inline PR feedback: refactored load_project_skills() to reduce loop nesting by extracting the merge logic into a helper (_merge_loaded_skills).
- [x] Pushed updates to the existing PR branch: the PR branch on GitHub now contains the integration test + the refactor.
- [x] Handled PR review threads: used `gh`/GraphQL to fetch the inline thread, replied with the fixing commit reference, and marked the thread resolved.
- [x] Unblocked “Review Thread Gate”: reran the failing gate job after resolving the thread; it passed.
#### Conciseness check (no extraneous changes)
Only two new functional changes were added on top of the existing PR work:
1) the new integration-style SDK test file, and
2) a small refactor to reduce indentation complexity in load_project_skills().
No additional unrelated behavior changes were introduced.
#### CI status (as last observed)
- The “Review Thread Gate” failure was resolved and is now passing.
- The remaining CI jobs for PR #2164 were still running/pending at the last check (mostly Agent Server build/push jobs).
PR links:
- Main feature PR (repo-root AGENTS.md from subdir): https://github.com/OpenHands/software-agent-sdk/pull/2164
- Workflow robustness PR (API breakage check when previous release lacks __all__): https://github.com/OpenHands/software-agent-sdk/pull/2165 (green when last checked)nutritious-balloon-65098
02/21/2026, 5:37 AMload_project_skills(work_dir) now also loads repo-root third-party files (incl. AGENTS.md) + skills dirs from the git root, with work_dir precedence.
- [x] Unit tests: added coverage for git-root discovery + precedence in tests/sdk/context/skill/test_load_project_skills.py.
- [x] “Live test” equivalent: added an integration-style SDK test that mirrors the CLI proof by asserting the repo-root AGENTS.md sentinel shows up in the emitted SystemPromptEvent.dynamic_context when workspace is a subdir:
- tests/sdk/conversation/test_repo_root_project_skills.py
- [x] Reviewed inline PR feedback: addressed the reviewer’s complexity note by refactoring the nested merge loops into a helper (_merge_loaded_skills) to reduce indentation and keep load_project_skills() clearer.
- [x] PR review thread workflow: replied to the inline thread and resolved it; reran the Review Thread Gate after resolution.
- [x] Reviewer communication: posted a PR-level comment explaining both the refactor and the new integration-style test, so reviewers understand the rationale and future regression protection.
- [x] Workflow bug fix PR (separate): created a PR from main to fix the API-breakage workflow hard-failing when the previous PyPI release lacks __all__ (and added a unit test); CI green.
#### 📌 PRs
- Main feature PR (repo-root AGENTS.md from subdir): #2164
https://github.com/OpenHands/software-agent-sdk/pull/2164
- Workflow robustness fix (API breakage check): #2165
https://github.com/OpenHands/software-agent-sdk/pull/2165
#### 🧪 Key new regression test (why it’s better)
The new test doesn’t just check load_project_skills() returns a `Skill`; it exercises the same path the CLI relies on:
load_project_skills(subdir) → AgentContext(skills=...) → LocalConversation.send_message() → Agent.init_state() → SystemPromptEvent(dynamic_context=...),
and asserts the repo-root sentinel is present in the emitted system prompt event.
#### 🔍 Conciseness check
- Changes are focused: repo-root loading logic, tests, a small refactor to reduce nesting, plus the separate workflow-only PR.
- No unrelated behavior changes beyond what was required to make CI reliable (xdist + pytest-forked interaction) and address the inline review suggestion.
#### 🚀 Pushing
All updates were pushed to the existing PR branches (including the integration test + refactor + review-thread reply/resolve).
If you want, I can also update PR #2164’s description to explicitly mention the new integration-style test (currently it’s explained in a comment).nutritious-balloon-65098
03/05/2026, 7:29 AMorigin and rebased fix/load-project-skills-git-root onto updated origin/main.
- [x] Added a more integration-style test (closer to the CLI “live test”): created tests/sdk/conversation/test_repo_root_project_skills.py.
- It creates a temp repo root with .git/ + root AGENTS.md containing a sentinel.
- Uses a subdir as the workspace (no AGENTS.md there).
- Builds skills = load_project_skills(subdir) → AgentContext(skills=skills) → starts a LocalConversation and calls send_message().
- Asserts the emitted SystemPromptEvent.dynamic_context.text includes the sentinel (i.e., repo-root AGENTS.md is actually injected into system prompt context as the CLI relies on), without requiring the CLI binary or a real LLM.
- [x] Read inline PR review thread(s) via GraphQL, addressed the only inline comment (complexity / nesting).
- [x] Fixed and pushed: refactored load_project_skills() merging logic by extracting a helper _merge_loaded_skills(...) to reduce nesting while keeping behavior identical.
- [x] Replied to the inline thread and resolved it (GraphQL).
- [x] Commented in response to the review explaining the refactor + describing the new integration-style test and what it covers.
- [x] CI thread gate issue handled: the “Review Thread Gate” run had failed due to timing (ran before thread resolution); reran it after resolving and it passed.
#### Conciseness check (no extraneous changes)
Changes were limited to:
- adding the new integration-style test file
- small refactor in load_project_skills() to address reviewer feedback
No unrelated code changes were introduced.
#### What was pushed
All updates were pushed to the existing PR branch fix/load-project-skills-git-root on OpenHands/software-agent-sdk (PR #2164).nutritious-balloon-65098
03/05/2026, 7:31 AMfix/load-project-skills-git-root onto updated origin/main.
- [x] Added a test closer to the CLI “live test”:
- Added tests/sdk/conversation/test_repo_root_project_skills.py
- This creates a temp git repo root (.git/) with root AGENTS.md containing a sentinel, sets workspace to a subdir, starts a LocalConversation, and asserts the emitted SystemPromptEvent.dynamic_context.text contains the sentinel.
- [x] Addressed inline review feedback:
- Refactored load_project_skills() to reduce nesting by introducing _merge_loaded_skills(...) and using it in the merge path.
- [x] Used gh to read and address inline threads/comments:
- Replied to the inline thread with the fix commit reference and marked the thread resolved.
- Reran “Review Thread Gate” once the thread was resolved.
- [x] Left a reviewer-facing comment explaining the new integration-style test and what it proves.
- [x] Pushed updates to the PR branch (required an explicit --force-with-lease because the remote branch had a merge commit).
- [x] Verified merge status: PRs are now merged.
### Conciseness check
All changes were directly relevant:
- 1 new integration-style test file to prevent regressions.
- a small refactor in load_project_skills() to address reviewer concern about loop nesting.
No extra unrelated changes.
### Outcome / where it landed
- Main fix PR merged: https://github.com/OpenHands/software-agent-sdk/pull/2164
Includes:
- git-root-aware load_project_skills() (workdir precedence)
- integration-style regression test validating SystemPromptEvent.dynamic_context contains repo-root AGENTS.md content when run from a subdir
- small refactor to reduce nesting
- Workflow robustness PR merged: https://github.com/OpenHands/software-agent-sdk/pull/2165
(API-breakage workflow no longer fails when previous PyPI release lacks __all__.)nutritious-balloon-65098
03/05/2026, 7:36 AMopenai/codex and traced AGENTS discovery: find project root via markers (default .git), then concatenate `AGENTS.override.md`/`AGENTS.md` (plus fallbacks) from root→cwd (codex-rs/core/src/project_doc.rs). Noted a known gap: changing cwd later doesn’t refresh emitted AGENTS instructions yet (TODO + snapshot in codex-rs/core/tests/suite/model_visible_layout.rs).nutritious-balloon-65098
03/05/2026, 7:43 AMsoftware-agent-sdk PRs #2164 and #2165, adding git-root AGENTS loading + CI workflow robustness.
Cloned openai/codex and confirmed it discovers AGENTS.md root→cwd and treats AGENTS.override.md as a user-created local override (gitignored).nutritious-balloon-65098
03/05/2026, 7:48 AMopenai/codex and located its AGENTS loader (codex-rs/core/src/project_doc.rs): it finds a “project root” via markers (default .git) and concatenates `AGENTS.override.md`/`AGENTS.md` from root→cwd. It will include both root + nested AGENTS only when cwd is inside the nested directory; AGENTS.override.md is a user-created local override (gitignored).nutritious-balloon-65098
03/05/2026, 7:51 AMsoftware-agent-sdk, load_project_skills(work_dir) does not do a Codex-style “walk from cwd to repo root and concatenate all `AGENTS.md`”; it only considers work_dir + nearest .git ancestor (git root), and it does not concatenate multiple AGENTS.md files (it keeps a single agents skill, with work_dir taking precedence).calm-artist-7206
03/05/2026, 10:31 AMnutritious-balloon-65098
03/05/2026, 10:32 AM