Skip to content

feat(ci): Add process-safety ast-grep rules - #5746

Merged
dan-petty merged 3 commits into
mainfrom
feat/1976-add-ast-grep-rules-for-rlimit
Nov 15, 2026
Merged

dan-petty merged 3 commits into
mainfrom
feat/1976-add-ast-grep-rules-for-rlimit

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

ARCHITECTURE.md section 7.3 holds three process-safety rules that an agent reads only when it opens that section, and no ast-grep rule enforces them. #1976 adds the three rules, their cases and their entries in the construct gate.

Closes #1976

Change: openspec/changes/archive/2026-11-15-1976-add-ast-grep-rules-for-rlimit/

@devops-cli-service
devops-cli-service Bot force-pushed the feat/1976-add-ast-grep-rules-for-rlimit branch from 6aabb75 to 6bfc266 Compare November 14, 2026 21:30
@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The steps of the job:

Stopped at group 1.

Failure class: ci_infra.
Action taken: none.
Action left: retry: run the item again.

Step Status Attempts Tokens in/out Last failing command
group 1 stopped 1 3425795/20542 -

Reason:

A behavior group changed no test file. Write the failing test first, in a file under tests/.

Last message of the agent (a claim that no check verified): Both tasks of group 1 are done, committed, and the verification passes. What changed - .ast-grep/rules/process-setrlimit-nproc.yml (new): resource.setrlimit(resource.RLIMIT_NPROC, $$$REST) and bare setrlimit(RLIMIT_NPROC, $$$REST), severity: error, files: ["src/**"]. - .ast-grep/rules/process-nonblocking-std-fd.yml (new): os.set_blocking($FD, False) and fcntl.fcntl($FD, $$$REST) with os.O_NONBLOCK/O_NONBLOCK anywhere among its arguments (stopBy: end), both with the metavariable constraint FD: regex '^[012]$'. - .ast-grep/rules/process-killpg-guarded.yml (new): os.killpg($$$ARGS) with a not over an inside relation on function_definition whose name matches _signal_process_group, terminate_process_group, _terminate_process_group_os or _terminate_process_group_async (stopBy: end). - .ast-grep/rule-tests/{process-setrlimit-nproc,process-nonblocking-std-fd,process-killpg-guarded}-test.yml (new): valid and invalid cases for each rule, including os.set_blocking(3, False) and fcntl.fcntl(3, fcntl.F_SETFL, os.O_NONBLOCK) as valid, and the guarded _signal_process_group body as valid. - tests/gate/construct_gate.py: new CONST_PROCESS_SAFETY_RULES table, its ids added to CONST_AST_GREP_RULE_FILES with ("src/**",), and one Violation per rule in the src tree of VIOLATIONS. - openspec/changes/1976-add-ast-grep-rules-for-rlimit/tasks.md: tasks 1.1 and 1.2 ticked (nothing else edited). What each check returned - Failin

The item is Blocked, and the job will not run it. Fix the cause. Then comment implement: retry. The Service clears the stop on its own when a new runner image rolls out, but only if a retry can fix the class of the stop and the limits of roadmap.implement.digest_clears_per_class and roadmap.implement.digest_clears_per_item allow it.

The job kept 2 work-in-progress commits on the branch feat/1976-add-ast-grep-rules-for-rlimit on origin. The last is 6bfc2668c0728587748a1a7883774c81bdf063a7. The job discarded only the work after it. The next run continues from it and does the tasks that are not ticked.

Step Status Attempts Tokens in/out Last failing command
group 1 stopped 1 3425795/20542 -

@dan-petty
dan-petty force-pushed the feat/1976-add-ast-grep-rules-for-rlimit branch from 6bfc266 to 5d78b45 Compare November 15, 2026 01:58
@dan-petty
dan-petty marked this pull request as ready for review November 15, 2026 02:05
@dan-petty
dan-petty self-requested a review as a code owner November 15, 2026 02:05
@dan-petty
dan-petty merged commit 9436400 into main Nov 15, 2026
23 checks passed
@dan-petty
dan-petty deleted the feat/1976-add-ast-grep-rules-for-rlimit branch November 15, 2026 02:22
dan-petty pushed a commit that referenced this pull request Nov 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.148.0](v0.147.2...v0.148.0)
(2026-11-15)


### Features

* **ci:** Add process-safety ast-grep rules
([#5746](#5746))
([9436400](9436400))
* **roadmap:** result lines state first-pass, model calls and cost
([#5779](#5779))
([cd3e0f9](cd3e0f9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.

feat(ci): Add ast-grep rules for RLIMIT_NPROC, O_NONBLOCK, os.killpg

1 participant