Commit Graph
572 Commits
Author SHA1 Message Date
haelyra 348f6e62b6 fix: reserve log lock quarantines without overwriting foreign files 2026-11-19 17:38:01 -05:00
haelyra 6c3ebeab96 test: document and verify orphan log recovery fallback 2026-11-19 17:35:32 -05:00
haelyra 7b9f56fb94 fix: preserve runtime history and project discovery across hook races 2026-11-19 17:34:15 -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 d26e1d946f Merge reviewed security and evaluation batch preserving fifteen source PRs 2026-11-19 15:22:25 -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 ca91012a1b Merge reviewed PR #4039 into security and evaluation batch 2026-11-19 15:15:20 -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 5beaaade10 Merge reviewed PR #3966: fix(hooks): include module extensions in edit and Stop checks 2026-11-19 15:14:55 -05:00
Gaurav Dubey b427484d1e fix(hooks): tighten a legacy log before rotating it
An existing 0664 log that was already at the cap was renamed to .1
before its mode was tightened, so the rotated copy stayed group/world
readable. Tighten the existing log first, and drop the post-open
fchmod that only reached the new active log.

Refs #3846
2026-11-19 04:21:19 +00:00
Gaurav Dubey 9e6272d5df fix(hooks): keep recording the command when log rotation fails
If the rename to <log>.1 fails (another session rotated first, or
Windows refuses the rename), append to the current log instead of
dropping the line.

Refs #3846
2026-11-19 03:57:06 +00:00
Gaurav Dubey c940659dab fix(hooks): create command logs owner-only and rotate them
bash-commands.log and cost-tracker.log record every Bash command but
were created with the default umask (0664 in the report) and grew
without bound. appendLine now opens them with mode 0600, tightens an
existing group/world-readable log on the next write, and rotates the
log to <log>.1 once it would pass 10 MiB, keeping one rotated copy.
This mirrors the metrics.jsonl scheme in scripts/lib/gateguard-metrics.js,
inlined because hooks cannot require scripts/lib/.

Refs #3846
2026-11-19 03:35:48 +00: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
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
haelyra 562b541581 Merge reviewed PR #3106: opt-in context-gate hook 2026-11-17 00:45:08 -05:00
Afloat d96596b4e0 fix(hooks): include module extensions in edit and Stop checks 2026-11-17 11:02:44 +08:00
haelyra 7bb8c65afc Merge reviewed PR #3221: experimental native Antigravity plugin and hooks 2026-11-16 22:00:42 -05: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 679f0ba8df Merge reviewed PR #3849: redact bare keys, JWTs and PEM blocks in bash logs 2026-11-16 21:31:27 -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 2915882707 fix(hooks): fail closed when JWT header decode budget is spent
findJwtHeader capped full header decodes at 8 per segment, so a valid
whitespace-header JWT after 8 decoy candidates (eyAg-eyAg-...-<JWT>) was
logged unredacted. Once the budget is spent, treat the next candidate
that passes the constant-time prefilter as a header. The scan stays
linear and the extra redaction only applies to pathological segments.

Refs #3846
2026-11-16 20:59:51 -05:00
haelyra adcf7be6a7 merge: sync origin/main into feat/antigravity-tier1
Resolve conflicts with grok target and repair source-root changes:
keep both antigravity-home and grok targets, combine main's repair
source root with the PR's trusted-root selection, and rebind the
skill-trigger registry digest to the merged install registry.
2026-11-16 20:59:51 -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
haelyra 4df78f0f64 fix: enforce read-only metadata and separate shell token data 2026-11-16 14:11:51 -05:00
haelyra 88b550f4b0 Merge remote-tracking branch 'origin/pr-3931' into stewardship/20261116 2026-11-16 13:37:29 -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
Gaurav DubeyandClaude Opus 5.5 b2fa2d93ee fix(gateguard): deny same-batch siblings of a first-touch denial
A first-touch denial marks its file checked so the retry passes, which
also let the other edits to that file in the same parallel batch apply
and left the file half-edited (#3136 only warned about this).

When the denied call's own tool_use_id is found in the transcript, the
denial now records the batch (assistant message id) for that file in
the same state write. A later Edit/Write/MultiEdit/NotebookEdit of the
file from that batch is denied with a message that says to resend every
edit with the retry. Calls from any other message pass, including the
retry. There is no newest-message fallback, so a guessed batch can never
deny the retry; without a located batch the #3136 warning still applies.

Same-batch denials are recorded as the new `batch-deny` metrics
decision and do not count toward fact_force_denials. batch_locks is
validated on read, merged by newest `at` and capped at 50 entries.

Fixes #3936

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 04:08:27 +00:00
Neo e6538e2428 fix(hooks): scope MCP health cache to the resolved server 2026-11-13 15:17:12 -05:00
montjeffrey 00bd41a414 feat(context): list installed non-ECC skills next to ECC's selection
ECC's selection, candidates, fallback and receipt stay unchanged. Installed non-ECC skills that also match the task are listed as companions in the resolver result, the ecc profile run launch input and the opt-in suggestion hook, so the host can use ECC's skill and the user's own together. A companion clears the automatic-load score bar and either has a matched word in its name or leads every other neighbor by the existing auto-admission margin. No constant changes.

ecc profile neighbors snapshots the provider home's other skills, including the project's own .claude/skills for Claude, and --neighbors or ECC_CONTEXT_NEIGHBORS passes the snapshot in.
2026-11-13 10:42:21 -05:00
yuhoyuho 322e347a86 fix(gateguard): gate DROP DATABASE, DROP SCHEMA and ALTER TABLE ... DROP COLUMN
DESTRUCTIVE_SQL matched only DROP TABLE, DELETE FROM and TRUNCATE.
`psql -c "DROP DATABASE prod"`, `DROP SCHEMA public CASCADE` and
`ALTER TABLE users DROP COLUMN email` went to the routine gate instead
of the destructive gate, even though each loses at least as much data
as DROP TABLE.

Add DROP DATABASE, DROP SCHEMA and an ALTER TABLE ... DROP COLUMN arm
to the phrase check. The DROP COLUMN arm stops at `;` so it never
matches across two statements. It requires the COLUMN keyword so
ALTER COLUMN ... DROP DEFAULT / DROP NOT NULL stay passive. Existing
literal and quote stripping keeps SQL strings, commit messages and
echo mentions passive.

Update the gateguard trigger list (en, ja-JP, zh-CN) and rebind the
skill-triggers registry digest for the SKILL.md body edit. Skill
descriptions and triggers are unchanged.
2026-11-12 01:08:39 +09:00
Afloat 87b4eed5c1 fix(metrics): fingerprint and track native notebook edits 2026-11-11 21:39:50 +08:00
Muhammad Mirza f64a9b5d04 fix(continuous-learning): flush Stop JSON before exit so the nudge is not truncated
The Stop nudge JSON was written with console.log and main() called
process.exit(0) immediately after. When stdout is a pipe the write is
asynchronous, so the exit can truncate the payload and the model never
sees the nudge. deliverStopNudge now returns whether it delivered, and
writes the JSON with process.stdout.write and exits from the flush
callback; main() exits immediately only when nothing was delivered.

Test: new case in tests/hooks/evaluate-session.test.js forces every
stdout write to be asynchronous with a preload, so the race reproduces
deterministically. It fails on the old code (empty stdout) and passes
with this fix. Full evaluate-session suite: 26/26 pass.
2026-11-10 17:11:03 +07:00
Angga Julyananda Pradana b37b73248b fix(hooks): preserve Git built-ins with same-name aliases 2026-11-08 12:20:15 +07:00
Angga Julyananda Pradana 69e9facd5a fix: block command-supplied Git alias invocations 2026-11-08 11:45:35 +07:00
Gaurav DubeyandClaude Opus 5.5 5f72adbd83 fix(hooks): try later JWT header candidates after a failed prefix match
A word prefix such as `eyewear_session_` was taken as the only JWT
header candidate; when it failed validation the real header after `_`
was never tried and the token stayed in the command log. Keep scanning
eligible candidates, with a constant-time prefilter and a per-segment
decode cap so long candidate runs stay linear.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 03:31:34 +00:00
haelyra f5ff589cd1 fix: close remaining integration security gaps 2026-11-06 00:10:49 -05:00
haelyra bfb4dbe7b0 fix: harden integration security findings 2026-11-06 00:03:44 -05:00
CarbonPyramid 5a565cf1d1 fix(hooks): bind context-gate checkpoint to real identity; frame handoff as a proposal
Round-6 ownership revision for the enforce-mode checkpoint (PR #3106,
@haelyra requested-changes on fffda19).

1. Require real handoff identity, preserve an occupied destination.
   - resolveCheckpointPath -> resolveCheckpointIdentity: drops the literal
     'project'/'session' fallbacks. A session id (input.session_id or a
     session env override) AND a project are now required; when neither
     resolves it returns null and the hook declines enforcement, so two
     same-named projects with no session id can no longer collide on one
     shared <sessions>/resume/project-session.md path.
   - New pickOwnedDestination + readOwnerSession: before targeting an
     existing destination the gate checks an ecc-handoff ownership marker.
     A file owned by this session is reused (idempotent); an unmarked,
     unreadable, or foreign-owned file is never overwritten — the gate
     disambiguates to a sibling (-2, -3, ...) or declines.
   - Missing-identity fire now emits a degraded advisory (buildDeclineText):
     it names no checkpoint path and orders no write, but still warns and
     tells the operator to set ECC_SESSION_ID — not a silent drop.

2. Report a proposed handoff until a write is verified.
   - buildOrderText no longer calls the resume command a completed "receipt".
     The checkpoint is a PROPOSAL; the resume command is gated on an explicit
     "verify the file exists and is non-empty" step. The model is instructed
     to stamp the exact ownership marker (session+project) and record the
     source revision (git rev-parse HEAD), binding the handoff to a revision.

Tests: existing buildOrderText case extended for proposal framing; three new
disposable, sandboxed (ECC_AGENT_DATA_HOME) ownership cases — missing-identity
same-named projects with a pre-existing destination that survives byte-for-byte,
foreign-owned destination disambiguated, same-owner destination reused. Full
suite 4765/4765 serial.
2026-11-05 22:51:16 -06:00