PostHog / PostHog/ai-plugin

Codex MCP often treats accessible non-active projects as inaccessible instead of switching project

Open
#72 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
84
Forks
15
Avg merge
14h 34m
Merged PRs (30d)
7

Description

Summary

In Codex sessions using the PostHog MCP/plugin, agents frequently conclude that an accessible project cannot be accessed when it is not the current active project. The project is accessible, and a follow-up prompt usually gets the agent to realise it should call switch-project first.

This happens repeatedly in coding sessions even when local repo instructions explicitly say to use the intended PostHog project and to verify/switch projects before querying.

Observed behaviour
  1. Codex starts with the PostHog MCP active project set to one project, for example a staging/pre-production project.
  2. The user asks Codex to query another project in the same organisation, for example production, sometimes providing the exact project ID.
  3. The agent often responds as if it does not have access to that project.
  4. After the user prompts again and explicitly says it does have access or should check/switch, the agent can discover the project and/or switch successfully.
Expected behaviour

When the user provides a target PostHog project name or project ID that differs from the active project, the Codex/PostHog plugin instructions should strongly guide the agent to:

  1. list or retrieve accessible projects if needed,
  2. call switch-project with the requested project ID, and
  3. only report an access problem after that switch/retrieve attempt fails.
Why this is confusing

The MCP/tool context tells the model the current active project, but in practice the user may have access to multiple projects in the same organisation. The model seems to treat "not currently active" as "not accessible" unless pushed again.

Suggested improvement

Could the Codex plugin/MCP prompt or the switch-project tool guidance be made more explicit? For example:

  • If a user asks for a different project by name or ID, do not infer lack of access from the active project context.
  • First use projects-get, project-get or switch-project as appropriate.
  • Only say the project is inaccessible if those calls fail.
Setup
  • Codex with the PostHog plugin installed
  • PostHog MCP server configured
  • Organisation has multiple projects/environments available to the same user
  • Repro occurs frequently in normal coding-agent sessions

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Codex plugin/MCP instructions and the projects-get, project-get, and switch-project tool guidance mentioned in the issue. Reproduce a request for a non-active project, then update the guidance so it checks or switches projects before reporting an access failure and verify the scenario succeeds.

Written by the indexing model from the issue text.

Assessment

Domain
ai, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.