Sync phase 4+5 (trimmed): fork hardening — provisioning, scoping, identity fallback, perf caps - #9
Merged
Merged
Conversation
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.
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.
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.
d7fb53a):connectgenerates~/.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.db3ba5a,401a7b2): memory_export/memory_audit join the scope model — project required unless explicitscope:"global"behind admin auth, closing the cross-project dump inconsistency flagged in the adversarial review.3dba5ef): unnormalizable git remotes (file://, bare paths) warn and fall back tolocal/<sha256(canonpath)[:24]>instead of throwing inside every hook and killing capture for that repo.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).aae55aa): README leads with npx install; pipe-to-shell option removed. (cb9716a): AGENTMEMORY_PROJECT_NAME precedence documented + pinned by test.Test plan