Repository navigation
fix(policy): v1.2.43 consolidation — read-lane FP residual + retention landing + one-time prune [t_40022daf] - #65
Open
maximalang wants to merge 17 commits into
Open
maximalang wants to merge 17 commits into
maximalang wants to merge 17 commits into
Conversation
…_9412d7d5) The deployed live clone drifted from trunk again: an uncommitted classifier patch (source card t_f6acc5dc, archived; the code existed in no commit or branch, git log --all -S empty) sat in its working tree on top of trunk policy.py, with tests/test_policy_lexical_delta.py untracked beside it. Post-merge QA finding F-A (t_85547708) flagged the repeat of the live-clone-as-sole-carrier pattern from the v1.2.32->34 rescue: any reinstall or checkout to trunk would have lost the fix the running gate already relies on. Captured byte-exact onto trunk 2f2f5ee (v1.2.34): policy.py staged blob cac7780 and test blob 95d7b60 both equal the live canonical blobs (git hash-object in the live repo). The live clone was NOT modified - read-only capture; controlled apply follows the merge. D1 (F1, run2166 call19 class): an EMPTY-value dotted git -c config assignment (option reset/disable, e.g. an empty helper value) is a config-key NAME, not a filesystem operand; only that form directly after git -c is exempt, every non-empty value stays guarded. D2 (F2, run2172 call26 class): dispatcher worker env-pin bindings (HERMES_KANBAN_DB/_BOARD/_TASK/_WORKSPACE/_WORKSPACES_ROOT, HERMES_TENANT) as NAME=value tokens bind a child process and mutate no store; unknown env names carrying a store path stay denied. D2e (fail-closed tightening): when the same command expands a bound pin ($PIN/${PIN}), the bound value re-enters the path-guard subjects, so expansion cannot smuggle a store path past the guard - a shape previously allowed is now denied. Tests: tests/test_policy_lexical_delta.py (captured from the live clone, 13 tests) - FP recurrences F1/F2/F2b plus TP controls proving no weakening. Full battery on this branch (Windows, uv, CPython 3.12.14, mirrors CI): pytest tests/ 901 passed plain and under HERMES_KANBAN_TASK=t_ci_simulated; check_version_uniqueness collision false (1.2.37, released_max 1.2.34); uv lock --check; compileall; drift-check ok:true; fleet-policy --version 1.2.37; build-bundle + verify-bundle green. Version 1.2.37: 1.2.35/1.2.36 are claimed by open PRs #54/#55; policy.py may overlap textually with #54 - merge sequencing is the owner's call.
…icy state (events/task/show), sessions/dumps enumeration exemption, read-shaped control-plane deny hint, --root gap closed in self-approval guard [t_e393b6e8]
…are data: task-type inference masking, attestation lines filter (arm/revoke/write-guard/anchors), tightened terminal forgery heuristic, lifecycle channel on broken markers [t_e393b6e8]
…mpany session route via bundle+runbook with [continues: company], tech-card advice scoped to repo sources [t_e393b6e8]
…sed, RR-1 drift gate, JSON manifest + rollback) + fleet-ops runbook [t_e393b6e8]
…sqlite-heredoc CLI-route reason, ls-sessions enumeration matrix, POISON-quote inference, broken-marker lifecycle channel [t_e393b6e8]
…cutable from any checkout [t_e393b6e8]
…412d7d5 branch): changelog, version pins, lockfile, comment labels [t_e393b6e8]
…e guard, hot-path indexes [t_1d99b96b]
…lure status, retry throttle [t_7733d471] F1: PRAGMA auto_vacuum=2 staged in migrate() never persisted — journal_mode=WAL materializes the db header first (fresh stores were silently born in mode NONE), and a staged mode does not cross connections. Issue the pragma BEFORE the WAL switch and re-issue it in full_vacuum() on the vacuuming connection, so legacy auto_vacuum=0 stores actually convert to INCREMENTAL on the advertised operator full vacuum. Proven by freelist + file-size reclamation, not a marker. F2: fleet-policy maintenance exited 0 when the report carried per-batch errors (fail-closed archive verification). Now exits 1 on error/errors. F3: a run with errors no longer stamps retention_last_run_epoch, so the documented retry-next-tick fires; failed attempts are ledgered in retention_last_failure_epoch / retention_consecutive_failures. Ports the independent QA assertions (t_218bc548 comment 6212) into tests/test_v1242_retention_maintenance.py: fresh/legacy conversion + reclamation proof, mode-NONE negative control, CLI exit assertion, throttle preservation across failure.
# Conflicts: # CHANGELOG.md # integrations/hermes/fleet-policy-plugin/plugin.yaml # plugin.yaml # pyproject.toml # src/fleet_policy/__init__.py # tests/test_hardening_v121.py # uv.lock
# Conflicts: # CHANGELOG.md # integrations/hermes/fleet-policy-plugin/plugin.yaml # plugin.yaml # pyproject.toml # src/fleet_policy/__init__.py # tests/test_hardening_v121.py # uv.lock
# Conflicts: # CHANGELOG.md # integrations/hermes/fleet-policy-plugin/plugin.yaml # plugin.yaml # pyproject.toml # src/fleet_policy/__init__.py # tests/test_hardening_v121.py # uv.lock
…railing-;, bare search patterns), rm quote-adjacent evasion, one-time prune script [t_40022daf] - _SHELL_METACHARACTERS: fd duplication 2>&1 no longer trips the bare-& scan - _sqlite_stage_is_read_only: single trailing ';' + fd-dup tokens tolerated - MUTATOR view masks search-tool operands (grep/rg/findstr/select-string/find) - rm keyword anchor accepts quote-adjacent form (closes os.system evasion) - scripts/prune_policy_db.py: operator one-time prune (backup+manifest -> verified archive+delete -> full vacuum -> re-verify+report) - tests: +25 read-lane battery, +3 prune battery; v1223 fd-dup re-pinned - consolidates PR #56 (v1.2.37), PR #57 (v1.2.38), PR #63 (v1.2.42)
This was referenced Oct 8, 2026
added 2 commits
October 9, 2026 05:27
maximalang
added a commit
that referenced
this pull request
Oct 9, 2026
…llision race: 1.2.44 claimed by open PR #65 mid-run)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Card
fleet-ops t_40022daf — fleet-policy: context-aware pattern matching (stop false-positive blocks on read-only commands) + enforce retention so the live event-store never regrows unbounded.
Base:
codex/company-os@ 9b09444. Version: 1.2.43 (collision guard:{"collision": false, "released_max": "1.2.36"}; open PRs hold 1.2.37–1.2.42).What this PR is
A consolidation of three in-flight, unmerged fix branches onto current trunk, plus the residual fix that none of them covered:
The three source cards are
donebut their PRs never landed, so the live gate kept biting. This PR makes them landable as one unit; the source PRs can be closed after merge.Residual fix (the gap none of the PRs closed)
Live evidence (policy event-store, ventures
.state/fleet-policy.db):f3b2e0d2cd9e0edaedaccbbaa88849fd7fa1b2703ce03f4ab4222876c09578ba(2026-10-08T14:13:22Z, task t_40022daf call 41): a read-onlysqlite3 "file:...state.db?mode=ro" "SELECT ... MATCH '<word>' ...;" 2>&1 | headblocked asirreversible_data_loss/ approval_required — the keyword sat inside quoted SQL data.python -cQA-bench runner whose embedded prompt text tripped the same keyword rule.Root causes found and fixed:
_SHELL_METACHARACTERSmatched the&inside fd duplication (2>&1), contradicting its own comment ("handled by the redirect scanner, not matched here"). Every read pipeline with stderr redirection failed closed into state_change and then into the keyword rules. Fixed:(?<![&>])&(?!&);cmd &,&> f,&>> fstill fail closed. (v1.2.23 had pinned the buggy behavior as an adversary case; re-pinned with justification, plus a new adversary proving fd-dup + real file redirect still writes-deny.);and counted the2>&1token as a positional. Both fixed; interior;, dot-commands, multi-statement chains stay fail-closed.grep -rn deploy src/flipped todeploy_external_runtime(evidence-gated at runtime). v1.2.22 masked only quoted spans. Now search-tool operands (grep/rg/findstr/select-string/find patterns, paths, value-flag values) are blanked in the MUTATOR view only — the write-marker scan keeps the raw command, and every stage still passes its own read-only check, so masking cannot launder a mutating stage.rmkeyword anchor accepted only(?:^|\s), sopython -c "os.system('rm -rf /x')"andbash -c 'rm -rf ...'slipped through as scoped_state_change/allow. Anchor widened with quote chars; pinned by tests.Not fixed by design:
python -cwith prompt text embedded in the code string stays strictly scanned (no nested-literal masking — that would open anos.systemevasion). Sanctioned lane: write_file +python file.py(file contents are data). Documented in CHANGELOG.One-time prune of the live ~450 MB store (D2-b)
scripts/prune_policy_db.py— operator-only: pre-flight counts → SQLite backup-API snapshot + MANIFEST.json/sha256 → forced maintenance tick (verified archive before delete, from feat(policy): v1.2.42 built-in event retention, verified archive, size guard, hot-path indexes [t_1d99b96b] #63) → full VACUUM → post-run sidecar re-verify + PRUNE-REPORT.json. Dry-run posture by default;--yesto execute.docs/fleet-ops/fleet-policy-prune-runbook.md(preconditions, steps, post-verify, rollback).Verification (local, Windows worktree C:/tmp/fp-t40022daf)
uv run --frozen python -m pytest tests/ -q→ 1011 passed (merged baseline 981; +25 read-lane batterytest_v1243_readlane_fp.py, +3 prune batterytest_v1243_prune_script.py, +2 re-pinned v1223 adversaries).uv lock --checkOK;compileall src tests scripts integrationsOK.fleet-policy --root . drift-check→{"missing": [], "ok": true};--version→ 1.2.43.build-bundle(92 files) +verify-bundle→ ok.check_version_uniqueness→{"collision": false, "version": "1.2.43"}.2>&1) approval_required → read_only/allow; grep bare/quoted keyword patterns → read_only/allow; TP controls (rm -rf,push -f,reset --hard,drop table, multi-statement splice, backgrounding,&>write redirect, os.system/bash -c evasion) all stay escalated.Merge protocol
Same as the source PRs: independent QA review on this exact head, company GO anchor, merge by company/operations. After merge: deploy via
scripts/deploy_policy.sh(tag route per the deploy runbook), then the one-time prune per the prune runbook.Finances: 0 ₽ incremental.