Repository navigation
fix(contract): bound the Git ownership probes in a public-boundary scan #8152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
loopx-agent
merged 3 commits into
loopx-project:main
from
gcl-coder:fix/contract-git-probe-budget
Nov 6, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
430863c
fix(contract): bound the Git ownership probes in a public-boundary scan
gcl-coder 91c2cc6
fix(contract): keep an unanswered Git probe out of a clean scan answer
gcl-coder 7462420
fix(contract): retire the probe's session when the scan is cancelled
gcl-coder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
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.
[P2] 在 Ctrl-C 退出前回收隔离的 Git 进程组
新增 start_new_session=True 后,终端向 CLI 进程组发送 SIGINT 不再覆盖 Git 组。这里仅在 TimeoutExpired 时调用清理;communicate 抛 KeyboardInterrupt 时直接退出。真实 loopx check --scan-root + Git core.fsmonitor 对照中,基线取消后无存活进程,当前 head 留下 Git、hook 和辅助子进程,心跳在 CLI 退出后 400ms 从 8 增至 15。取消后的重试会累积后台工作。请在异常退出(至少 KeyboardInterrupt)时有界回收原组、释放管道并等待,再传播取消;保留超时拒绝语义。补真实入口的 SIGINT、后代停止及正常路径对照。
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.
这条成立:独立会话让终端 SIGINT 只到 CLI 自己的进程组,
communicate抛KeyboardInterrupt时会直接从唯一的持有者那里逃出去,那个会话里的 Git、hook 和辅助子进程都留着。已在本分支补上:
_git_query在except subprocess.TimeoutExpired之后加了一个except BaseException分支,先_retire_owned_probe(process)回收本次拥有的会话,再原样raise。超时仍然返回 unavailable 并回收,取消仍然是取消,正常路径不变。回归用真实 Git 加被阻塞的
ls-files,等心跳出现后向扫描的进程组发SIGINT:断言非零退出、返回后 0.6 秒心跳不再增长。这条用例在改前的 head(91c2cc681)上失败,本提交上通过;既有的超时用例与正常对照不变。新 head:
804cabfb2。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.
补一句:上一条报的 head
804cabfb2有一处 lint 漏网——tests/test_contract_git_probe_cancel.py里未使用的import json(F401)、Popen参数列表里的隐式字符串拼接(ISC004)、以及 import 排序(I001)。提交前的检查没有按退出码拦住,是我的疏漏,已经修掉并 amend。当前 head 是
7462420d3,逻辑没有变化:tests/test_contract_git_probe_cancel.py+tests/test_contract_git_probe_budget.py仍是 6 passed;新测试文件在仓库默认规则下ruff check全绿,loopx/contract.py在 CI 的 E4/E7/E9/F 选择集下也全绿。