Skip to content

fix(hooks): C2 failure trails + C3 GREPLICA_HOME pin (#145) - #174

Open
aadivyaraushan wants to merge 7 commits into
Autoloops:mainfrom
aadivyaraushan:fix/part-c-hook-runtime-c2-c3
Open

fix(hooks): C2 failure trails + C3 GREPLICA_HOME pin (#145)#174
aadivyaraushan wants to merge 7 commits into
Autoloops:mainfrom
aadivyaraushan:fix/part-c-hook-runtime-c2-c3

Conversation

@aadivyaraushan

Copy link
Copy Markdown

Summary

Part C correctness/runtime fixes from #145:

  • C2 — Hook worker failures are no longer a black hole: each failure appends one JSON line to $GREPLICA_HOME/logs/hook-worker.jsonl, and run artifacts are retained under $GREPLICA_HOME/logs/runs/ (last 20). Successful updates still clean up the temp run dir.
  • C3resolveGreplicaHome() reports path + source (GREPLICA_HOME | ENGINEERING_CONTEXT_HOME | default). Hook worker / agent spawn env pins GREPLICA_HOME to the parent-resolved path. greplica doctor prints the active home path and source before Database/Config.

Skips C5 (owned by #108). Does not include C1/C4/C6 (separate PR).

Test plan

  • npm run typecheck && npm test (includes new check-greplica-home-pin and check-hook-worker-failures)
  • User-facing dry-runs for C2 and C3 (transcripts below)

Unit summary (commit 3f7d0d0)

> npm test
Transcript bundle checks passed.
Repo context checks passed.
Install option checks passed.
Repository installation checks passed.
Managed CLI checks passed.
Graph view checks passed.
Graph view offline browser check passed: charts rendered with zero network access.
Source membership checks passed.
check-proposal-validate: ok
BM25 tokenizer checks passed.
check-anchor-drift: ok
Find similar claims checks passed.
Proposal validation dedupe checks passed.
check-opencode-sqlite-transcript: ok
check-greplica-home-pin: ok
check-hook-worker-failures: ok

Dry-run transcripts

C3 — doctor + env pin

Greplica doctor
Repo: demo
...
Greplica home: /tmp/greplica-c2-c3-demo-U7D1He/home
Greplica home source: GREPLICA_HOME
Database: /tmp/greplica-c2-c3-demo-U7D1He/home/graph.db
...

parent resolved: {"path":"/tmp/greplica-c2-c3-demo-U7D1He/home","source":"GREPLICA_HOME"}
child env GREPLICA_HOME: /tmp/greplica-c2-c3-demo-U7D1He/home
pin matches parent: true

# ENGINEERING_CONTEXT_HOME when GREPLICA_HOME unset:
resolved: {"path":".../eng-home","source":"ENGINEERING_CONTEXT_HOME"}
child GREPLICA_HOME: .../eng-home
pinned equal: true

C2 — failed memory update leaves a trail

# Forced spawn claude ENOENT via empty PATH inside maybeUpdateWorkingMemory
log exists: true
log contents:
{"timestamp":"2026-07-22T14:02:51.087Z","platform":"claude","session_id":"dry-run-fail-session","phase":"working_memory_update","error":"spawn claude ENOENT"}
runs dir exists: true
retained runs: [ '2026-07-22T14-02-51-088Z-claude-dry-run-fail-session' ]
retained entries: [ 'agent-events.jsonl' ]

Made with Cursor

aadivyaraushan and others added 2 commits July 22, 2026 19:30
…ags (C1/C4/C6)

Part C correctness from Autoloops#145: fail closed on incomplete embedBatch results,
resolve default branch via ls-remote or unknown, and neutralize early-close
tags in working-memory prompts so pasted transcript content cannot break
the evidence fence.

Co-authored-by: Cursor <cursoragent@cursor.com>
Log hook-worker failures to JSONL and retain run artifacts; resolve and pin GREPLICA_HOME into child env and surface it in doctor.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 22, 2026 14:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

aadivyaraushan and others added 5 commits July 22, 2026 21:30
Add a 5s timeout on ls-remote, reuse/rename the existing main scope when
default_branch changes, and reject wrong-length embedding vectors in tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Print Greplica home before context resolution, cap hook-worker.jsonl, and
delay OS temp runDir removal after retain so spawn close handlers cannot race.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve worker.ts and package.json conflicts so transcript escape, hook
failure trails, GREPLICA_HOME pin, and all related check scripts coexist.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the worker alive briefly after retain so OS temp dirs are actually
removed, and note that logs/runs may contain sensitive agent output.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document that logs/runs and hook-worker.jsonl may contain agent output.

Co-authored-by: Cursor <cursoragent@cursor.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.

2 participants