GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(compile): honour CODEX_HOME for global Codex instructions by xubenqiang · Pull Request #3491 · microsoft/apm

Conversation

@xubenqiang

@xubenqiang JohnnyXu (xubenqiang) commented Nov 6, 2026

Copy link
Copy Markdown

Fixes #3483

Problem

apm compile --global wrote Codex instructions to ~/.codex/AGENTS.md even when CODEX_HOME points elsewhere:

def _resolve_deploy_root(profile: TargetProfile) -> Path:
    if profile.resolved_deploy_root is not None:
        return profile.resolved_deploy_root
    return Path.home() / profile.root_dir

The codex target profile had no user_root_resolver, so resolved_deploy_root stayed None and the fallback ignored CODEX_HOME. The Codex MCP adapter already honours CODEX_HOME (adapters/client/codex.py::_get_codex_dir), so a single global deployment split MCP config and compiled instructions across two directories.

Fix

src/apm_cli/integration/targets.py gains a resolver wired into the codex profile:

def _codex_home() -> Path:
    raw = os.environ.get("CODEX_HOME", "").strip()
    if raw:
        path = Path(raw).expanduser()
        if not path.is_absolute():
            raise PathTraversalError(
                "CODEX_HOME is set to a non-absolute path; cannot locate the "
                "Codex CLI configuration directory."
            )
        return path
    return Path.home() / ".codex"
    "codex": TargetProfile(
        capability=TARGET_CAPABILITIES["codex"],
        root_dir=".codex",
        user_root_resolver=_codex_home,
        ...

for_scope(user_scope=True) now sets resolved_deploy_root from CODEX_HOME, and _resolve_deploy_root() returns it. With CODEX_HOME unset the result is unchanged (~/.codex), and a relative CODEX_HOME fails loudly like the MCP adapter instead of silently writing somewhere unexpected.

Verification

Three tests are added to tests/unit/compilation/test_user_root_context.py:

  • test_codex_home_overrides_default_root — with CODEX_HOME set, KNOWN_TARGETS["codex"].for_scope(user_scope=True) resolves to that directory.
  • test_codex_home_unset_falls_back_to_home_dot_codex — unset keeps ~/.codex.
  • test_relative_codex_home_is_rejected — relative value raises PathTraversalError.

Before the fix (production file reverted, tests kept):

test_codex_home_overrides_default_root: AssertionError

After:

codex_home_overrides_default_root: PASS
codex_home_unset_falls_back: PASS
relative_codex_home_rejected: PASS

ruff check and ruff format --check pass on both changed files.

Notes

  • Scope is the user-scope deploy root only; project-scope .codex/ resolution is untouched.
  • The duplicate logic in adapters/client/codex.py::_get_codex_dir could later call the same helper; I left it alone to keep the diff to the reported path.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@xubenqiang
fix(compile): honour CODEX_HOME for global Codex instructions
b3c44cb
`apm compile --global` resolved the Codex user root as `~/.codex`, so on hosts
that set CODEX_HOME the generated AGENTS.md landed in a directory Codex never
reads, while the Codex MCP adapter already used CODEX_HOME.

Give the codex target a user-root resolver that follows CODEX_HOME (absolute
paths only) and falls back to `~/.codex`, so compiled instructions and MCP
configuration share one directory.

Fixes microsoft#3483
@xubenqiang
JohnnyXu (xubenqiang) requested review from Daniel Meppiel (danielmeppiel) and Sergio Sisternes (sergio-sisternes-epam) as code owners November 6, 2026 13:13
Copilot AI balanced review requested due to automatic review settings November 6, 2026 13:13
Copilot AI reviewed Nov 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@microsoft-github-policy-service

microsoft-github-policy-service Bot commented Nov 6, 2026

Copy link
Copy Markdown

JohnnyXu (@xubenqiang) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

2 similar comments
@microsoft-github-policy-service

microsoft-github-policy-service Bot commented Nov 6, 2026

Copy link
Copy Markdown

JohnnyXu (@xubenqiang) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@microsoft-github-policy-service

microsoft-github-policy-service Bot commented Nov 6, 2026

Copy link
Copy Markdown

JohnnyXu (@xubenqiang) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@danielmeppiel Daniel Meppiel (danielmeppiel) mentioned this pull request Nov 10, 2026
[BUG] Global Codex instruction compilation ignores CODEX_HOME #3483
Open
Daniel Meppiel (danielmeppiel) and others added 7 commits November 10, 2026 20:18
@danielmeppiel @xubenqiang
fix(targets): honor CODEX_HOME through the for_scope home override
1172ff3
The first approach wired a user_root_resolver into the codex profile.
That capability marks dynamic-root targets (cowork, copilot-app) whose
lockfile entries use URI locators, so it dropped the .codex/ cleanup
prefix at project scope and moved Codex user skills off ~/.agents.

Route CODEX_HOME through the existing user-scope home override that
already serves CLAUDE_CONFIG_DIR and HERMES_HOME instead. AGENTS.md,
agents and hooks now resolve to $CODEX_HOME at user scope, skills stay
in ~/.agents/skills, project scope is unchanged, and a relative value
fails like the Codex MCP adapter. Tests cover compile set/unset/blank/
relative/outside-home, profile parity with the MCP adapter, and the
agents/hooks/skills user-scope cycle. tests/conftest.py drops an
inherited CODEX_HOME so default-root tests stay hermetic.

Addresses scope record on microsoft#3483 (Done when: consistent user-scope writes).

Co-authored-by: xubenqiang <[email protected]>
Co-authored-by: Copilot <[email protected]>
@danielmeppiel
docs: document CODEX_HOME for global compile and user-scope writes
5e505b1
State that apm compile --global writes $CODEX_HOME/AGENTS.md when
CODEX_HOME is non-blank and absolute, that user-scope agents, hooks and
MCP config share that root, and that skills stay in ~/.agents/skills.
Drops the unsupported claim that CODEX_HOME affects target detection.

Addresses scope record on microsoft#3483 (Done when: compile and environment-
variable docs state the behavior).

Co-authored-by: Copilot <[email protected]>
@danielmeppiel
Merge commit 'refs/tmp/main-3491' into danielmeppiel-pr-3491-codex-ho…
825fd7e
…me-global-compile
@danielmeppiel
docs(changelog): note CODEX_HOME for Codex user-scope writes
4edd9d4
Addresses scope record on microsoft#3483 and repo changelog rule (every merged
code change needs an Unreleased entry).

Co-authored-by: Copilot <[email protected]>
@danielmeppiel
style(tests): apply ruff format to CODEX_HOME tests
3f72241
Lint contract: ruff format --check must be silent before push.

Co-authored-by: Copilot <[email protected]>
@danielmeppiel
test(compile): cover CODEX_HOME through the apm compile --global command
0ee7c64
The CODEX_HOME compile flow crosses targets.for_scope and
user_root_context; unit tests alone sat below the integration tier
floor. Exercise the real command for a custom CODEX_HOME and for a
relative value that must fail before any write.

Addresses panel follow-up from test-coverage-expert (compile --global
integration coverage with a custom Codex root).

Co-authored-by: Copilot <[email protected]>
@danielmeppiel
docs: state absolute CODEX_HOME rule for MCP and Codex deploy root
35a7d22
The MCP install page did not say a relative CODEX_HOME is rejected, and
the targets matrix used vague wording for what CODEX_HOME moves. Align
both with the environment-variables reference.

Addresses panel follow-ups from doc-writer (install-mcp-servers.md and
targets-matrix.md wording).

Co-authored-by: Copilot <[email protected]>
@danielmeppiel

Daniel Meppiel (danielmeppiel) commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_with_followups

Community fix now honours CODEX_HOME for apm compile --global through the existing user-home override, with tests, docs and CHANGELOG.

panel-mode=lean -> delta; personas=python-architect,test-coverage-expert,doc-writer(adhoc: scope Done-when requires docs),apm-ceo

cc JohnnyXu (@xubenqiang) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

The panel converged without dissent. The python-architect confirmed that extending the existing TargetProfile.for_scope user-home override (already used for CLAUDE_CONFIG_DIR and HERMES_HOME) is the right single-owner design: Codex stays a static-root target. The test-coverage-expert raised two gaps. One was folded with mutation-break proof (compile --global integration tests for a custom and a relative CODEX_HOME). The other was declined: the lifecycle external-root matrix asserts that skills deploy under each external root, but Codex skills stay in ~/.agents/skills per the scope record, so adding codex there would assert the wrong behavior. The doc-writer's two wording gaps were folded and confirmed in the delta round.

Maintainer rework, for context: the original commit wired a user_root_resolver into the codex profile. That capability marks dynamic-root targets (cowork, copilot-app) that use URI lockfile locators, and it broke 8 existing unit tests: the project-scope .codex/ cleanup prefix was dropped, and Codex user skills moved under ~/.codex/skills. The replacement routes CODEX_HOME through the existing home override. JohnnyXu (@xubenqiang)'s commit b3c44cb7d is preserved and the folds sit on top with Co-authored-by credit.

Outside code, two things remain before merge: the CLA is unsigned (license/cla pending), and a required review is still open.

Aligned with: Multi-harness parity: CODEX_HOME joins CLAUDE_CONFIG_DIR and HERMES_HOME in one user-home override table. Secure by default: a relative CODEX_HOME fails with the Codex MCP adapter's exact message before anything is written. Community-driven: the contributor's commit is kept and credited.

Panel summary

Persona B R N Takeaway
Python Architect 0 0 0 Extending the user-home override table is the correct single-owner design; codex stays a static-root target with parity tests against the MCP adapter.
Test Coverage Expert 0 2 0 All Done-when branches covered; compile --global integration gap folded; lifecycle-matrix suggestion soundly declined (delta confirmed).
Doc Writer 0 2 0 Docs match the code; MCP-page absolute rule and targets-matrix wording folded and confirmed in delta.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 1 follow-ups

  1. [Python Architect] Unify the two CODEX_HOME readers (TargetProfile.for_scope and CodexClientAdapter._get_codex_dir) into one helper. -- Parity is test-guarded but not structurally enforced. Deferred because it crosses into the MCP adapter surface; CLAUDE_CONFIG_DIR has the same two-reader shape. Low urgency.

Recommendation

All panel findings are resolved: three folded, one declined with rationale. Code, tests, lint, and docs are clean on the merged head, and CI is green on 35a7d22bd. The one follow-up is low-urgency and outside this scope. Next steps for the maintainer: get the CLA signed, complete the required review, then merge.

Folded in this run

  • (scope record) Rework: CODEX_HOME now flows through the for_scope user-home override, not a dynamic-root resolver. Global AGENTS.md, user-scope agents and hooks resolve to $CODEX_HOME. Skills stay in ~/.agents/skills. Unset or blank uses ~/.codex; a relative value fails. Project scope is unchanged. -- resolved in 1172ff305.
  • (scope record) Docs for compile, environment variables, the targets matrix, and the apm-guide compile row. -- resolved in 5e505b13e.
  • (repo rule) CHANGELOG [Unreleased] entry crediting JohnnyXu (@xubenqiang). -- resolved in 4edd9d493.
  • (panel) Compile --global integration tests for custom and relative CODEX_HOME. -- resolved in 0ee7c64b3.
  • (panel) The MCP install page now says CODEX_HOME must be absolute and relative values are rejected. The targets-matrix Codex wording is precise. -- resolved in 35a7d22bd.

Copilot signals reviewed

  • Review 5800553190 on b3c44cb7d -- NOT-LEGIT: a quota-failure notice with no review content. Two fetch rounds found zero inline comments.

Deferred (out-of-scope follow-ups)

  • (panel) Unify the CODEX_HOME readers into one helper -- scope boundary: the scope asks to match the MCP adapter, not refactor it, and parity is test-guarded.

Regression-trap evidence (mutation-break gate)

  • TestCodexHomeUserRootCompile (set / outside-home / relative) -- with targets.py reverted to main, the tests FAILED as expected; the guard was restored.
  • TestCodexHomeUserScope (home-relative / absolute / relative) -- deleted the CODEX_HOME override; the tests FAILED as expected; the guard was restored.
  • test_codex_home_keeps_codex_a_static_root_target and test_user_scope_codex_home_routes_agents_hooks_not_skills -- swapped in the original user_root_resolver version; the tests FAILED as expected; the guard was restored.
  • test_compile_global_writes_codex_agents_md_under_codex_home and test_compile_global_rejects_relative_codex_home -- deleted the override; the tests FAILED as expected; the guard was restored.

Lint contract

uv run --extra dev ruff check src/ tests/ and
uv run --extra dev ruff format --check src/ tests/ both silent. pylint R0801, lint-auth-signals.sh, and lint-architecture-boundaries.sh are also clean. The canonical-owner gate verified 2 touched owners, with exact-head functional tests for each (owner-extension).

CI

gh pr checks 3491 on 35a7d22bd: 23 pass, 3 skipping, 0 failing. CI, the Windows Compatibility Gate, CodeQL, Spec conformance, NOTICE Drift and Deploy Docs are green. The only pending entry is license/cla (after 0 CI fix iterations).

Mergeability status

PR head SHA CEO stance iters folds defers Copilot rounds CI mergeable mergeStateStatus notes
#3491 35a7d22 ship_with_followups 2 3 1 2 yellow MERGEABLE BLOCKED CLA unsigned; required review pending

Convergence

2 outer iterations; 2 Copilot rounds. Final panel stance: ship_with_followups. Ready for maintainer review.


Full per-persona findings

Python Architect

No findings.

Test Coverage Expert

  • [recommended] The lifecycle state machine's _EXTERNAL_USER_ROOT_ENV omits codex, at tests/integration/test_required_lifecycle_state_machine.py:58.
    Disposition: declined. That matrix asserts that skills deploy under each external root, but Codex skills stay in ~/.agents/skills by scope. Routing is covered instead by test_user_scope_codex_home_routes_agents_hooks_not_skills.
  • [recommended] test_compile_global.py never sets CODEX_HOME, at tests/integration/test_compile_global.py:108.
    Disposition: folded in 0ee7c64b3.

Doc Writer

  • [recommended] install-mcp-servers.md did not say that CODEX_HOME must be absolute, at docs/src/content/docs/consumer/install-mcp-servers.md:296.
    Disposition: folded in 35a7d22bd.
  • [recommended] The Codex wording in targets-matrix.md was vague, at docs/src/content/docs/reference/targets-matrix.md:177.
    Disposition: folded in 35a7d22bd.

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@danielmeppiel Daniel Meppiel (danielmeppiel) Awaiting requested review from danielmeppiel danielmeppiel is a code owner
@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) Awaiting requested review from sergio-sisternes-epam sergio-sisternes-epam is a code owner

At least 0 approving reviews are required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[BUG] Global Codex instruction compilation ignores CODEX_HOME

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@xubenqiang @danielmeppiel
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.