项目文件夹

文件
Ali Khokhar abaee5bd38 Fix messaging task launch on uvloop (#1117)
## Problem

uvloop 0.22.1 rejects the Python 3.14-only `eager_start` task keyword,
so every Telegram and Discord message fails on Unix. Removing the
keyword alone would let eager task factories execute claims before FCC
publishes task ownership. Fixes #1108 and fixes #1115.

## Changes

| Before | After |
| --- | --- |
| Claim tasks depend on `eager_start=False`, which uvloop does not
accept. | Claim tasks use the portable event-loop contract behind an
explicit ownership gate. |
| Task execution ordering depends on event-loop keyword support. | Task
execution begins only after FCC attaches the task and completion
callback. |
| Regression coverage exercises native asyncio only. | Regression
coverage exercises a restricted task contract, eager task factories, and
real uvloop. |
| The package version is 4.5.0. | The package version is 4.5.1 with a
refreshed lockfile. |

<!-- greptile_comment -->

<details open><summary><h3>Greptile Summary</h3></summary>

This PR fixes messaging claim launch on event loops that reject
Python-specific task keywords. The main changes are:

- Removes `eager_start=False` from claim task creation.
- Adds an explicit ownership gate before claim processing starts.
- Adds tests for portable task creation, eager task factories, and
uvloop.
- Bumps the package version and lockfile entry to `4.5.1`.
</details>

<h3>Confidence Score: 5/5</h3>

This looks safe to merge after a small test hardening cleanup.

The runtime task ownership change preserves the intended launch
ordering, and no blocking issues were found in the changed runtime code.

tests/messaging/test_tree_ownership_concurrency.py needs a small
hardening update so the uvloop case skips cleanly when the optional
package is absent.

<details><summary><h3><a href="https://www.greptile.com/trex"><img
alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="20" align="absmiddle"></a> T-Rex Logs</h3></summary>

**What T-Rex did**
- T-Rex executed the messaging ownership regression pytest suite to
capture runtime proof for the messaging concurrency changes.
- During the run, the first shell wrapper used PIPESTATUS\[0\] under
/bin/sh, producing a harmless Bad substitution during version evidence
collection.
- The pytest command was rerun after the substitution issue, and the run
completed with EXIT\_CODE: 0.
- The regression suite provides focused runtime evidence for the
messaging concurrency behavior, avoiding unrelated suites or external
services.

<a
href="https://app.greptile.com/trex/runs/14465005/artifacts"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifactsDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"><img
alt="View all artifacts"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"></picture></a>

<sub><a href="https://www.greptile.com/trex"><img alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="14" align="absmiddle"></a> Ran code and verified through
T-Rex</sub>
</details>

<details open><summary><h3>Important Files Changed</h3></summary>

| Filename | Overview |
|----------|----------|
| src/free_claude_code/messaging/trees/processor.py | Replaces the
uvloop-incompatible task keyword with an ownership event that opens
after task registration. |
| tests/messaging/test_tree_ownership_concurrency.py | Adds task-launch
tests, with one uvloop test that can fail instead of skip when uvloop is
absent. |
| pyproject.toml | Bumps the package version to `4.5.1`. |
| uv.lock | Updates the editable package version to match
`pyproject.toml`. |

</details>

<a
href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22alishahryar1%2Ffree-claude-code%22%20on%20the%20existing%20branch%20%22ali%2Ffix-messaging-event-loop-compatibility%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22ali%2Ffix-messaging-event-loop-compatibility%22.%0A%0AFix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Atests%2Fmessaging%2Ftest_tree_ownership_concurrency.py%3A485%0A**Optional%20Uvloop%20Becomes%20Required**%0A%0AWhen%20tests%20run%20on%20Linux%20or%20macOS%20without%20the%20optional%20%60uvloop%60%20package%20installed%2C%20this%20import%20raises%20%60ModuleNotFoundError%60%20instead%20of%20skipping%20the%20uvloop-only%20case.%20A%20contributor%20or%20CI%20job%20that%20installs%20only%20the%20test%20dependencies%20can%20fail%20this%20test%20even%20though%20the%20platform%20skip%20condition%20passes.%0A%0A&repo=alishahryar1%2Ffree-claude-code&pr=1117&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodexDark.svg?v=6"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=6"><img
alt="Fix All in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=6"></picture></a>

<sub>Reviews (1): Last reviewed commit: ["Fix messaging task launch on
uvloop"](https://github.com/alishahryar1/free-claude-code/commit/180a7255df0a43a20706cdde2f1cd2d6830921d7)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=44296382)</sub>

> Greptile also left **1 inline comment** on this PR.

<!-- /greptile_comment -->
2026-07-14 15:28:15 -07:00
..