Commit Graph
713 Commits
Author SHA1 Message Date
haelyra 7b9f56fb94 fix: preserve runtime history and project discovery across hook races 2026-11-19 17:34:15 -05:00
haelyra c0cfd5727e test: separate missing hook targets from stdin pipe failures 2026-11-19 16:25:03 -05:00
haelyra 38f94bf2ea test: retain deterministic context suggestion timing fixtures 2026-11-19 16:00:24 -05:00
haelyra af5ccb77ab test: control context suggestion budgets through the hook wrapper 2026-11-19 15:58:43 -05:00
haelyra b3d87c0b77 chore: combine reviewed contributor batch with UI Canvas 2026-11-19 15:36:25 -05:00
haelyra b5ff79c12f feat(ui-canvas): integrate hand-editable preview with safe resume and exports 2026-11-19 15:33:44 -05:00
haelyra fa198c59a4 test: secure temporary fixtures without filesystem forwarding wrappers 2026-11-19 15:22:51 -05:00
haelyra d26e1d946f Merge reviewed security and evaluation batch preserving fifteen source PRs 2026-11-19 15:22:25 -05:00
haelyra 390b8bc067 Merge PR #4016 observer launch optimization while preserving per-event log rotation 2026-11-19 15:20:18 -05:00
haelyra 66d1ff31cd Merge reviewed PR #3938 same-batch GateGuard denial consistency 2026-11-19 15:18:11 -05:00
haelyra daa113b6df Merge reviewed PR #4023: fix(mcp): use the dispatched tool namespace for health checks 2026-11-19 15:15:21 -05:00
haelyra f428f1a766 Merge reviewed PR #4022: fix(statusline): preserve newer tool metrics during context updates 2026-11-19 15:15:07 -05:00
haelyra 4277ddd357 Merge reviewed PR #3980: fix(instincts): recognize canonical framework and language aliases 2026-11-19 15:14:57 -05:00
haelyra a8f3704061 Merge reviewed PR #3979: fix(formatter): find shared workspace config above package manifests 2026-11-19 15:14:56 -05:00
haelyra 5beaaade10 Merge reviewed PR #3966: fix(hooks): include module extensions in edit and Stop checks 2026-11-19 15:14:55 -05:00
Jeffrey Montoya ea7e77664a fix(clv2): keep the config timestamp check, normalize observer.enabled
Address the second round of review findings:

- Cache: trust an entry only while it is newer than the repository .git/config
  as well as while git reports the stored origin, so a core.worktree change
  that moves the root is not served stale.
- observe.sh: emit observer.enabled as a literal true or false so a value
  containing a newline cannot shift the fields that follow.
- Tests: remove GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE, GIT_COMMON_DIR and
  GIT_PREFIX from the detection test environment; add a config-change test and
  an observer.enabled newline test. Refresh the registry digest.
2026-11-18 15:38:30 -05:00
Jeffrey Montoya 155b4d254f fix(clv2): validate the detection cache against the live origin
Address the review findings on the observe hook trim:

- Cache entries store the credential-stripped origin detection read, and a hit
  compares it with `git remote get-url origin`, so included, global and
  GIT_CONFIG_* origins and a config change during detection are all caught.
- Keep the payload cwd byte for byte (a directory name may hold a newline).
- Follow a symlinked python stub outside WindowsApps on Windows-like shells.
- Run housekeeping once a day from its own per-project marker, independent of
  the detection cache.
2026-11-18 04:25:30 -05:00
Rudy Celekli d722c6dae6 test(statusline): distinguish stale observations from warning dedupe 2026-11-18 01:10:35 -05:00
Rudy Celekli b64e30be6c fix(mcp): use the dispatched tool namespace for health checks 2026-11-18 01:06:49 -05:00
Rudy Celekli 0a143b8b68 fix(statusline): preserve newer tool metrics during context updates 2026-11-18 01:04:50 -05:00
montjeffrey d2db7871fe perf(clv2): cut observe hook process launches
observe.sh runs before and after every tool call and launched about 50
external processes per run. Each costs a few milliseconds on Linux/macOS
but 80-280 ms under Git Bash on Windows, where one run took 5-7 s.

- Read cwd, agent_id and observer.enabled in one Python start, and parse,
  scrub and write the observation in one more (was six). The redaction
  patterns are unchanged.
- Cache project detection per (CLV2_NO_PROJECT, CLAUDE_PROJECT_DIR, PWD)
  for the rest of the day. An entry is rejected when .git/config is not
  older than it, when the project dir or root is gone, or when the id is
  not a shape detection can produce. Worktrees, submodules and non-git
  roots are never cached. CLV2_PROJECT_CACHE=0 disables it; bash < 4.2
  skips it.
- Run the stdin-independent guards before the first interpreter start.
- Run the find/du housekeeping only when detection was not cached.
- Replace dirname/readlink/subshell calls on the hot path with builtins.

Measured on Windows 11 / Git Bash, warm cache: 5.2-5.8 s -> 1.1-1.2 s
per run. Output compared against the previous script on 19 payloads
(records, redaction, registry, counters, exit codes): identical.

Behavior changes: projects.json last_seen refreshes at least daily
instead of every call; observations.jsonl may exceed the 10 MB cap by up
to a day of records before archiving; the App Installer stub check only
follows symlinks for paths under WindowsApps.
2026-11-17 14:20:54 -05:00
Divya Chukkapalli ad90aa6701 fix(hooks): keep a GateGuard deny when another Bash hook adds context
GateGuard denies by printing a PreToolUse permissionDecision on stdout at
exit 0. runHooks only stopped early on a non-zero exit, and its final
return preferred any advisory additionalContext over the hook stdout, so
in the strict profile the git-push reminder replaced GateGuard's deny and
the command ran. Stop at the first deny and return it unchanged.
2026-11-17 04:17:35 -08:00
Afloat 89a8bbc205 fix(instincts): recognize canonical framework and language aliases 2026-11-17 13:55:18 +08:00
Afloat 69bbf04bc7 fix(formatter): find shared workspace config above package manifests 2026-11-17 13:54:47 +08:00
haelyra ce5b17fb45 test(hooks): keep context-gate cwd fixtures inside private sandboxes
Replace the literal /tmp/... cwd values in the context-gate suites with
paths under each test's realpath'd mkdtemp sandbox. CodeQL treats /tmp
string literals as shared temp sources and traced them through the hook
input into readFileTail. The hook only hashes cwd, so assertions are
unchanged.
2026-11-17 00:46:54 -05:00
haelyra 8a5cbb7e14 test(hooks): resolve context-gate fixture roots with realpath
Wrap #3106's mkdtemp fixture roots in realpathSync, matching the existing
atomic-write tests, so CodeQL no longer traces shared-temp paths from
these fixtures into read handles. Assertions are unchanged.
2026-11-17 00:45:14 -05:00
haelyra 562b541581 Merge reviewed PR #3106: opt-in context-gate hook 2026-11-17 00:45:08 -05:00
Afloat fe4e03103b test(hooks): allow guarded Windows temp paths in module checks 2026-11-17 11:19:19 +08:00
Afloat c6f0e31d67 test(hooks): verify module extension command and plugin boundaries 2026-11-17 11:08:13 +08:00
haelyra e413166c50 test(hooks): make context-gate tests portable to Windows (#3106)
The hook proposes a correct absolute checkpoint path on Windows, but the
tests located that line with /^\s+[/\\].*\.md$/, which only matches paths
starting with a slash. Windows paths start with a drive letter (C:\...),
so every case that read the proposed path saw undefined and failed.

- Extract the proposed checkpoint as the indented line that ends in .md
  and satisfies path.isAbsolute, so POSIX and Windows paths both match.
- Include the hook output in the "both fires should propose" assertion
  so a genuine decline is diagnosable from CI logs.
- Write transcript fixtures into private fs.mkdtempSync directories
  instead of predictable names directly under os.tmpdir() (CodeQL
  js/insecure-temporary-file) in context-gate, context-gate-state and
  ecc-context-monitor tests.
2026-11-16 22:07:01 -05:00
Afloat d96596b4e0 fix(hooks): include module extensions in edit and Stop checks 2026-11-17 11:02:44 +08:00
haelyra f30cfd0e8c Merge reviewed PR #2846: per-manager dev-server option arity 2026-11-16 21:31:28 -05:00
haelyra fbd8835ddc Merge reviewed PR #2837: no-verify option arity 2026-11-16 21:31:28 -05:00
haelyra 374d5ef751 Merge reviewed PR #2832: classify wrappers inside find -exec 2026-11-16 21:31:28 -05:00
haelyra 479edd71d4 Merge reviewed PR #3829: flush the opt-in Stop nudge before exit 2026-11-16 21:31:27 -05:00
haelyra 4674f91097 test(dev-command): cover manager-specific option arity across both dev hooks
Add cross-manager fixtures for the same short flag with different meanings
(npm/pnpm -d, pnpm -w, bun -d, bun -c optional value), options before and
after run, -- boundaries, quoted script names and missing values, through
the real pre-bash-dev-server-block entry point and auto-tmux-dev. The new
tests/lib/dev-command.test.js rows for npm and Yarn match real npm 11.6.0
and Yarn 4.9.2 runs of a scratch project whose dev script writes a marker.
2026-11-16 21:15:56 -05:00
haelyra b553918a84 Merge remote-tracking branch 'origin/main' into fix/dev-server-block-quoted-scripts
Main kept evolving pre-bash-dev-server-block.js while this branch waited:
tmux pane-launch detection past tmux options and command sequences, bash
double-quote backslash rules, here-document segment scanning and an indexed
segment queue. Resolve by keeping this branch's thin hook and moving main's
current helpers into scripts/lib/dev-command.js, so both dev hooks still
share one classifier without losing main's tmux behavior.

The same resolution makes package-manager option arity manager-specific,
as requested in review: npm -d / pnpm -d are loglevel flags, pnpm -w is
--workspace-root, bun -d is --define <K:V>. A shared value table swallowed
the script after the boolean spellings, so `npm -d run dev` escaped tmux.
2026-11-16 21:15:47 -05:00
haelyra ae9ce433cd fix(hooks): harden context-gate checkpoint ownership (#3106)
Maintainer carry-forward of the four edge cases reproduced on 5a565cf:

- Same-named project roots: bind the proposal to a SHA-256 owner key of
  the full real project root plus the raw session ID, and put that key in
  both the file name and the ownership marker.
- Sanitized session-ID aliasing: hash the raw session ID before filename
  sanitization so IDs such as owner/a and owner?a no longer share a path.
- Linked or special destinations: probe with lstat, open read-only with
  O_NOFOLLOW and O_NONBLOCK, require a regular single-link file whose
  complete first-line marker matches, and decline linked handoff
  directories. A FIFO at the destination previously hung the prompt.
- Literal resume arguments: emit the resume prompt as one single-quoted
  POSIX (or PowerShell on Windows) argument.

Also merge the UserPromptSubmit registration into the existing event
array. The main merge left a duplicate UserPromptSubmit key in
hooks.json and hooks.metadata.json, and JSON.parse kept only the last,
which silently dropped prompt:hookify-runtime.

Adds tests/hooks/context-gate-ownership.test.js, which fires the hook
through the registered run-with-flags.js entry: 12/12 pass here, 1/12
pass on 5a565cf.
2026-11-16 21:11:56 -05:00
haelyraandNguyen Thanh Dat 7a57c828ac fix(gateguard): resolve wrappers and nested shells in find -exec actions
Main now resolves sudo/doas/env and the timeout/setsid/nice/stdbuf/ionice/
taskset/nohup/time launchers for top-level commands, but find -exec still
read its action argv literally. `find . -exec sudo rm {} \;`,
`find . -exec timeout 5 rm -rf {} +`, `find . -exec sh -c 'rm -rf {}' \;`
and `sudo find . -exec rm {} \;` were allowed although each runs rm.

Resolve the exec argv through unwrapLeadWrappers (external argv, so no shell
builtins), classify find behind a wrapper, and send the -c text of a shell
that find starts through the same bounded quote-aware recursion as a
top-level `sh -c`. Non-executing modes such as `sudo -l` and quoted data
such as `sh -c 'echo rm -rf {}'` stay allowed.

Co-authored-by: Nguyen Thanh Dat <ntdat812.dev@gmail.com>
2026-11-16 21:09:10 -05:00
haelyraandNguyen Thanh Dat de1ef95cbe fix(block-no-verify): port value-taking option arity onto the current scanner
Carry forward the still-missing part of this PR onto main's scanner:
git commit --trailer and the git push value options (-o, --push-option,
--receive-pack, --exec, --repo) now consume the following token, and an
abbreviation that names exactly one value-taking long option consumes it
too. A flag-looking value such as `git push -o --no-verify` is data that
Git sends verbatim while still running pre-push, so refusing it was a
false positive.

--force-with-lease stays out (optional inline-only value), inline =value
forms consume nothing, and prefixes ambiguous among the value options
resolve to none of them. A real-Git sweep over every prefix of every
commit/push long option followed by --no-verify (866 commands, Git
2.50.1) found no command the hook allows while Git skips a refusing hook.

Co-authored-by: Nguyen Thanh Dat <ntdat812.dev@gmail.com>
2026-11-16 21:08:04 -05:00
haelyra ab6996edee Merge origin/main into fix/3260-stop-delivery-opt-in
Main already carries the first three commits of this PR (merged in
22596737f) plus later maintainer hardening that moved the delivery
marker into the private observer directory (bfb4dbe7b, f5ff589cd).

Conflict resolution keeps main's evaluate-session.js and test file as
the base, then re-applies only the remaining change from f64a9b5d0:
deliverStopNudge returns whether it wrote the Stop JSON, writes it with
process.stdout.write, and exits from the flush callback. The
async-stdout regression test is ported with the marker path pointed at
main's private delivery-markers directory.

Verified: evaluate-session 27/27 (new test fails on main 26/27),
hooks 260/260, stop-hooks-stdout 48/48, integration hooks 27/27.
2026-11-16 20:59:23 -05:00
haelyra 9f770ae5a1 chore(hooks): merge main into context-gate carry-forward (#3106) 2026-11-16 20:55:33 -05:00
Rahul Selvaraj f4ff940826 Merge branch 'main' into fix/3867-skip-classifier-notices 2026-11-17 09:27:23 +08:00
haelyra f7aa27b657 test: isolate compaction fixtures from concurrent cleanup 2026-11-16 14:28:07 -05:00
haelyra 926a07b5f8 fix: close metadata races and finish reviewed hook boundaries 2026-11-16 14:00:26 -05:00
haelyra 40327476c4 fix: harden review fixtures and isolate audit verification metadata 2026-11-16 13:35:34 -05:00
haelyra 0d5391a486 Merge remote-tracking branch 'origin/pr-3932' into stewardship/20261116 2026-11-16 13:24:55 -05:00
haelyra df287caae9 Merge remote-tracking branch 'origin/pr-3914' into stewardship/20261116 2026-11-16 13:24:34 -05:00
haelyra f2f3375838 Merge remote-tracking branch 'origin/pr-3921' into stewardship/20261116
# Conflicts:
#	manifests/context-packs/skill-triggers@1.json
2026-11-16 13:24:32 -05:00
haelyra 88e8a4db07 Merge remote-tracking branch 'origin/pr-3894' into stewardship/20261116 2026-11-16 13:20:47 -05:00