ZhiLin Zhang
|
e5969fd8b9
|
feat(harness): introduce HarnessGuardMiddleware for pre-write syntax validation and anti-doom-loop (#7624)
* feat(harness): introduce HarnessGuardMiddleware for pre-write syntax validation and anti-doom-loop
- Add HarnessGuardMiddleware to intercept tool writes and validate .py (AST) and .json syntax before disk write
- Add anti-doom-loop state machine detecting repeated error signatures (>=2) and A -> B -> A -> B oscillating loops
- Inject targeted remediation hints directly into tool results
- Add DynamicSkillRouter for zero-LLM JIT skill intent activation (<1ms)
- Fully unit-tested with 25 passing test cases
* fix(harness): address review findings on write tools, scoping, and content handling
* fix(harness): offload async validation off-thread, support Command results, and harden parsing
* fix(harness): address reviewer 1 feedback on scoping, assembly count, and non-blocking verification
- Revert .gitignore to exclude out-of-scope graphify-out entry
- Short-circuit syntax validation when block_on_syntax_error is false
- Trim AGENTS.md rule chain to fit hard guidance budget (AG002)
- Fix input_sanitization mock and update subagent middleware count expectation to 23
* fix(harness): preserve chunked write flow, normalize CRLF line endings, and guard error classification
- Preserve append-in-chunks flow: use codeop to distinguish incomplete Python fragments from syntax errors, and handle premature EOF on chunked JSON arrays/objects
- Reuse native _match_line_endings for str_replace to prevent CRLF line ending bypass
- Check existing tool failure status before classifying error text to avoid misclassifying successful tool outputs
- Add 4 regression tests covering chunked writes, CRLF replacement, and successful error-text reads
* fix(harness): scope pre-write syntax validation to str_replace and preserve write_file semantics
* fix(harness): make str_replace syntax check opt-in, allow progressive repair of invalid files, and clean up RFC docs
* chore: align subagent middleware count and satisfy AG002 guidance budget
---------
Co-authored-by: Yakyou7 <Yakyou7@users.noreply.github.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
|
2026-11-04 20:13:19 +08:00 |
|