Skip to content

Sync phase 4+5 (trimmed): fork hardening — provisioning, scoping, identity fallback, perf caps - #9

Merged
ChronodeAi merged 9 commits into
mainfrom
sync/v0.9.29-phase45
Aug 24, 2026
Merged

Sync phase 4+5 (trimmed): fork hardening — provisioning, scoping, identity fallback, perf caps#9
ChronodeAi merged 9 commits into
mainfrom
sync/v0.9.29-phase45

Conversation

@ChronodeAi

Copy link
Copy Markdown
Owner

Final implementation train of the v0.9.29 sync. Host adapters (Cursor/Devin/Droid/Antigravity) deliberately NOT ported — unused in this deployment; upstream keeps them as additive files so skipping creates no future merge friction.

  • Zero-touch capability provisioning (d7fb53a): connect generates ~/.agentmemory/project-capability-secret (0600) when absent — removes the fresh-install silent-capture-loss failure mode where strict-capability mode had no credential; doctor now reports provisioned.
  • Export/audit scoping (db3ba5a, 401a7b2): memory_export/memory_audit join the scope model — project required unless explicit scope:"global" behind admin auth, closing the cross-project dump inconsistency flagged in the adversarial review.
  • Identity fallback (3dba5ef): unnormalizable git remotes (file://, bare paths) warn and fall back to local/<sha256(canonpath)[:24]> instead of throwing inside every hook and killing capture for that repo.
  • Perf/leak caps (e8208ad): stale-session sweep throttled (AGENTMEMORY_STALE_SESSION_SWEEP_MS, default 60s) instead of a full KV scan per session start; background-pipeline failedRuns map capped at 100 (oldest dropped).
  • Docs (aae55aa): README leads with npx install; pipe-to-shell option removed. (cb9716a): AGENTMEMORY_PROJECT_NAME precedence documented + pinned by test.

Test plan

  • vitest: 1904/1904, zero failures
  • Full canonical R-13 run passes (171 tracked test files, no waivers)
  • tsc error set identical to baseline; evidence/skills/bundle gates green

Every real connect run (CLI command and onboarding wiring alike) now leaves
the machine with a project capability signing credential: when
~/.agentmemory/project-capability-secret is absent or valueless, a 32-byte
random hex secret is generated and written with mode 0600; populated files
are left untouched. Dry-run stays side-effect free. Only this credential is
auto-provisioned — AGENTMEMORY_SECRET and AGENTMEMORY_ADMIN_SECRET keep
their own flows. Doctor's capability diagnostic drops its manual-only flag:
its fix generates the credential directly and the recheck reports it as
provisioned.

(cherry picked from commit bfbd84f8292de6b788191c47a7d5d6d3b189a343)
memory_export and memory_audit bypassed applyProjectScope and answered
checkAuth-only REST routes with the full corpus. Both now follow the fork
model: requireProjectReadScope makes a project mandatory unless scope is
explicitly global, which the api-auth middleware (and the handler contract)
gates behind administrative authority — mirroring api::sessions. mem::export
filters every attributable section by the requested project and omits
sections that carry no project field instead of leaking them; queryAudit
matches only entries whose details name the project. MCP schemas for
memory_export/memory_audit accept project/scope like the other scoped tools,
and the standalone proxy passes the scoping as query params while the local
fallback filters identically.

(cherry picked from commit 0d38aaa67ad040f82ee5eea293e319999fe0ad83)
…read

memories-pagination asserted a source pattern that pinned the unscoped
payload passthrough; project scoping spreads it into { ...payload, project }
so the assertion now matches the scoped forwarding while still pinning that
pagination params reach mem::export.

(cherry picked from commit 2475fb13f301a6cabcbff8fdc2b8ff4972ef9a0e)
…alizable remotes

inferProjectId threw 'configured Git remote cannot be normalized safely' for
bare-path and file:// origin remotes, which killed every hook process running
inside such a checkout. Those remotes still identify one machine-local
checkout, so inferProjectId now warns once per process to stderr and falls
back to the stable local/<sha256(canonpath)[:24]> id. ssh/https identities
are unchanged; no throw remains because the input path is typed string.

(cherry picked from commit 7b418a0a21af09af1a56f7b279e03ecc9db5caea)
closeStaleSessions() full-scanned KV.sessions on every event::session::started
and every POST /agentmemory/session/start. The hot paths now go through
maybeCloseStaleSessions(), which sweeps at most once per 60s per process
(AGENTMEMORY_STALE_SESSION_SWEEP_MS tunes the interval, 0 restores per-call
sweeps); closeStaleSessions itself stays unthrottled for the session-end
paths that read their own records. The health module's failedRuns map grew
without bound — recordFailedRun now caps it at 100 entries, evicting
oldest-first on both the failure and restart-restore paths.

(cherry picked from commit aac67e494ec8abbd364ec971855c1d5dd901b263)
… script

Replace the pipe-to-shell 'curl -fsSL ... | sh' engine-install option with
the npx flow (npx -y @agentmemory/agentmemory@latest) and keep the
iii-installer as a documented alternative that is downloaded, inspected, and
run from a file — never piped straight into a shell. The VERSION=0.11.2 pin
warning stays.

(cherry picked from commit f0403548b77b9f13aee530312f92e6e721368f1a)
…ved identity

resolveProject already applies the env override ahead of the canonical
remote-derived identity through resolveProjectConfig's layer order; document
that contract on the resolver and pin it with a test that proves a
normalizable https remote loses to the override.
…y fallback

The warn-and-fall-back inferProjectId path is bundled into every packaged
hook entry via the shared _project chunk.
…nd r13 manifest for the trimmed train

Skills pick up AGENTMEMORY_STALE_SESSION_SWEEP_MS and the scoped
memory_export/memory_audit schemas. The inventory re-issues with unchanged
denominators (137 REST, 60 tools, 13 hooks, 19 connectors). The r13 manifest
recomputes to 171 tracked tests.
@ChronodeAi
ChronodeAi merged commit 5cbabbb into main Aug 24, 2026
7 of 8 checks passed
@ChronodeAi
ChronodeAi deleted the sync/v0.9.29-phase45 branch August 24, 2026 20:53
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.

1 participant