Skip to content

fix Claude project inference when cwd is missing#164

Open
kunickiaj wants to merge 1 commit intomainfrom
03-04-fix_claude_project_inference_when_cwd_is_missing
Open

fix Claude project inference when cwd is missing#164
kunickiaj wants to merge 1 commit intomainfrom
03-04-fix_claude_project_inference_when_cwd_is_missing

Conversation

@kunickiaj
Copy link
Owner

@kunickiaj kunickiaj commented Mar 5, 2026

Description

Fixes missing Claude project labels when hook payloads do not include cwd or project. Raw-event envelope building now falls back to inferring project from path hints in hook payloads (tool_input.filePath/file_path/path and transcript_path) so Claude streams get project metadata more consistently.

Type of Change

  • 🚀 Feature (new functionality)
  • 🐛 Bug fix (fixes an issue)
  • 📚 Documentation (docs-only change)
  • 🔧 Maintenance (refactor, chore, CI, etc.)
  • 🧪 Testing (test-only changes)

Testing

  • Tests pass locally (pytest)
  • Added/updated tests for changes
  • Manually verified changes work as expected

Checklist

  • Code follows project style (ruff check and ruff format pass)
  • Self-review completed
  • Documentation updated (if needed)
  • No new warnings introduced

Copy link
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kunickiaj kunickiaj marked this pull request as ready for review March 5, 2026 01:36
Copy link

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

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: 3d5ce0fe63

ℹ️ 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 +133 to +137
candidate = Path(text).expanduser()
except Exception:
return None

current = candidate if candidate.is_dir() else candidate.parent

Choose a reason for hiding this comment

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

P2 Badge Resolve relative path hints before inferring project

When tool_input.filePath/file_path/path is relative (for example src/file.py), this code keeps it relative and passes src/. into _infer_project_from_cwd, which returns None for relative roots, so project inference still fails even though the hinted file is inside a git repo. This means streams without cwd/project remain unlabeled in common hook payloads that use relative paths, undermining the new fallback behavior.

Useful? React with 👍 / 👎.

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