Skip to content

Conversation

@ezyang
Copy link
Owner

@ezyang ezyang commented Apr 15, 2025

Stack from ghstack (oldest at bottom):

We sometimes fail to get current commit hash. This is because we improperly pass a file rather than directory to the git command. Here is a representative warning:

2025-04-14 21:31:31,930 - root - WARNING - Exception when getting current commit hash: [Errno 20] Not a directory: '/Users/ezyang/Dev/codemcp/codemcp/agno.py'
Traceback (most recent call last):
File "/Users/ezyang/Dev/codemcp/codemcp/git_query.py", line 279, in get_current_commit_hash
result = await run_command(
^^^^^^^^^^^^^^^^^^
File "/Users/ezyang/Dev/codemcp/codemcp/shell.py", line 73, in run_command
process = await asyncio.create_subprocess_exec(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/subprocess.py", line 224, in create_subprocess_exec
transport, protocol = await loop.subprocess_exec(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 1756, in subprocess_exec
transport = await self._make_subprocess_transport(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/unix_events.py", line 211, in makesubprocess_transport
transp = _UnixSubprocessTransport(self, protocol, args, shell,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/base_subprocess.py", line 36, in init
self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/unix_events.py", line 820, in _start
self._proc = subprocess.Popen(
^^^^^^^^^^^^^^^^^
File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/subprocess.py", line 1028, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/subprocess.py", line 1963, in executechild
raise child_exception_type(errno_num, err_msg, err_filename)
NotADirectoryError: [Errno 20] Not a directory: '/Users/ezyang/Dev/codemcp/codemcp/agno.py'

Convert this warning into a hard error, and add a test which triggers the failure. The test SHOULD fail. Halt when done so I can inspect, before we fix.

e4427af  (Base revision)
a6b4788  Convert file not directory warning to hard error
5646b1b  Add test for get_current_commit_hash with file path
e59e63c  Auto-commit format changes
HEAD     Auto-commit lint changes

codemcp-id: 265-fix-convert-git-directory-check-warning-to-error

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Apr 15, 2025
We sometimes fail to get current commit hash. This is because we improperly pass a file rather than directory to the git command. Here is a representative warning:

2025-04-14 21:31:31,930 - root - WARNING - Exception when getting current commit hash: [Errno 20] Not a directory: '/Users/ezyang/Dev/codemcp/codemcp/agno.py'
Traceback (most recent call last):
  File "/Users/ezyang/Dev/codemcp/codemcp/git_query.py", line 279, in get_current_commit_hash
    result = await run_command(
             ^^^^^^^^^^^^^^^^^^
  File "/Users/ezyang/Dev/codemcp/codemcp/shell.py", line 73, in run_command
    process = await asyncio.create_subprocess_exec(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/subprocess.py", line 224, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 1756, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/unix_events.py", line 211, in *make*subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/base_subprocess.py", line 36, in **init**
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/asyncio/unix_events.py", line 820, in _start
    self._proc = subprocess.Popen(
                 ^^^^^^^^^^^^^^^^^
  File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/subprocess.py", line 1028, in **init**
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/ezyang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/subprocess.py", line 1963, in *execute*child
    raise child_exception_type(errno_num, err_msg, err_filename)
NotADirectoryError: [Errno 20] Not a directory: '/Users/ezyang/Dev/codemcp/codemcp/agno.py'

Convert this warning into a hard error, and add a test which triggers the failure. The test SHOULD fail. Halt when done so I can inspect, before we fix.

```git-revs
e4427af  (Base revision)
a6b4788  Convert file not directory warning to hard error
5646b1b  Add test for get_current_commit_hash with file path
e59e63c  Auto-commit format changes
HEAD     Auto-commit lint changes
```

codemcp-id: 265-fix-convert-git-directory-check-warning-to-error
ghstack-source-id: f8608c9
Pull-Request-resolved: #257
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.

2 participants