Skip to content

feat: local memory + local vault wiring + autofix-pr + CI mock isolation#444

Open
amDosion wants to merge 7 commits intomainfrom
feat/local-memory-vault-wiring
Open

feat: local memory + local vault wiring + autofix-pr + CI mock isolation#444
amDosion wants to merge 7 commits intomainfrom
feat/local-memory-vault-wiring

Conversation

@amDosion
Copy link
Copy Markdown
Collaborator

@amDosion amDosion commented May 9, 2026

Summary

Integrates fork work onto upstream main: local-memory + local-vault feature wiring, autofix-pr command, and CI mock-pollution isolation. 7 commits, 243 files (~41k+ insertions vs upstream/main).

Functional changes

  • /local-memory — manage local memory stores in ~/.claude/local-memory/, no API key required
  • /local-vault — manage local encrypted secrets (OS keychain or encrypted-file fallback), no API key required
  • /vault, /skill-store, /memory-stores, /agents-platform — workspace-API-key-gated CLI commands for cloud resources (hidden when no key set)
  • /triggers (renamed from /schedule to avoid collision with upstream bundled skill of same name) — CRUD UI for scheduled remote agent triggers via /v1/code/triggers
  • /autofix-pr — gated by AUTOFIX_PR flag, now in DEFAULT_BUILD_FEATURES so it actually appears in builds
  • VaultHttpFetchTool, RemoteTriggerTool, MemoryHTTPFetchTool — backing tool implementations

Test infrastructure

  • tests/mocks/axios.ts — shared spread+flag axios mock helper. Replaces 12 bare mock.module('axios', ...) polluters across packages/builtin-tools/ and src/commands/ that leaked stub implementations process-globally in CI's alphabetical file-order run
  • Same spread+flag pattern applied to node:child_process (issue.test.ts), dgram (lanBeacon.test.ts), @anthropic/ink (ultrareviewCommand + onboarding suites)
  • Rewrote 6 stale tests:
    • 4 ultrareviewCommand tests aligned to current source's gate-branch logic (preflight integration was removed upstream)
    • 2 autonomy-lifecycle CLI flow tests switched to bundled dist/cli.js (Bun.spawn cwd does not resolve src/* tsconfig alias)

Verification

  • Local: 5345/5345 tests pass
  • Codecov 100% patch coverage
  • typecheck clean, biome lint clean

Test plan

  • Verify /local-memory and /local-vault work without API key
  • Verify gated commands (/vault, /skill-store, /memory-stores, /agents-platform, /triggers) appear when ANTHROPIC_API_KEY or workspaceApiKey set
  • Verify /autofix-pr is enabled in default build (was previously dead due to missing feature flag)
  • Run full test suite — should be 5345/5345
  • CI / codecov green

🤖 Generated with Claude Code


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

unraid and others added 7 commits May 9, 2026 14:58
Squash-merge of feat/autofix-pr-test (69 commits) onto upstream/main
with -X ours strategy (upstream as authoritative for content conflicts).

Key features brought in from fork:
- LocalMemoryRecall + VaultHttpFetch tools (end-to-end wired)
- /local-memory, /local-vault, /memory-stores, /skill-store interactive panels
- /agents-platform, /schedule, /vault command scaffolding
- /login: switch / replace / remove of workspace API key
- statusline refactor (built-in status row, /statusline as info command)
- autofix-pr command + workflow

Conflict resolutions (upstream-wins):
- 10 .js command stubs kept from upstream (alongside fork's .ts implementations)
- src/components/BuiltinStatusLine.tsx accepted upstream's deletion
  (fork's wire-up references in StatusLine.tsx will be cleaned up next)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bare `mock.module('axios', () => ({ default: { stubs } }))` is
process-global last-write-wins and drops `axios.create`, `request`,
`isAxiosError`, etc. that real consumers need. In CI's alphabetical
file order, that produces dozens of polluted failures (AgentsPlatformView,
schedule API, memory-stores API, etc.) that don't reproduce on WSL2.

Introduce `tests/mocks/axios.ts` with `setupAxiosMock()` — `require('axios')`
inside the factory, spread real shape, route each verb through a per-suite
`useStubs` flag. beforeAll flips on, afterAll flips off; the spread
fall-through eliminates cross-file leakage.

Refactored 12 axios mockers in tests/, plus the bare `@anthropic/ink` mocks
in ultrareviewCommand and onboarding suites (same pollution pattern broke
AgentsPlatformView's Box/Text rendering).

Verified: 5339/5345 tests pass locally; remaining 6 failures are
pre-existing isolation issues unrelated to this change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The long-body draft-save test registered a bare `mock.module(
'node:child_process', ...)` inside the test body. Without spread+flag,
that stub leaked process-globally into every later test file in the run.

Apply the same pattern used in issue-gh / issue-template / share-* :
spread real child_process, route execFile/execFileSync through a
`useIssueLongBodyCpStubs` flag, flip on at start of test and off in
the finally block.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Same spread+flag pattern as the axios / child_process polluters: the bare
`mock.module('dgram', () => ({ createSocket: () => mockSocket }))` leaked
the stub into every later test file in the run via Bun's last-write-wins
module mock cache. Now we spread real dgram and gate `createSocket`
through `useLanBeaconDgramStubs`, flipped on in beforeAll and off in
afterAll so unrelated UDP-using code in later suites sees real dgram.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two clusters of pre-existing failures fixed by aligning tests with the
source they were meant to verify (not by changing source):

1. ultrareviewCommand (4 fails)
   The 4 "preflight integration" tests assumed `call` makes an axios POST
   and branches on `action: proceed | blocked | confirm`. That integration
   was removed; the current `call` branches on `checkOverageGate()`'s four
   `kind` values. Replaced with 6 tests covering each gate branch
   (`not-enabled`, `low-balance`, `needs-confirm`, `proceed`), arg
   pass-through to launchRemoteReview, and the null-launch failure path.

2. autonomy-lifecycle-user-flow (2 fails)
   The Bun.spawn'd subprocess used cwd=tempDir, where Bun couldn't resolve
   the `src/*` tsconfig path alias (it's resolved from cwd's tsconfig, not
   the entrypoint file's). Switched the entrypoint to the bundled
   dist/cli.js (aliases pre-resolved) and added a beforeAll that lazy-builds
   the bundle if missing — handles the CI ordering where `bun test` runs
   before `bun run build`.

Local: 5345/5345 pass (was 5339/5345).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ll collision

Both `src/commands/schedule/index.ts` (our new UI command) and the upstream
`src/skills/bundled/scheduleRemoteAgents.ts` registered `name: 'schedule'`,
producing two `/schedule` entries in the slash-command picker — one tagged
"(bundled)" with the prompt-skill description, the other our CRUD UI.

Rename the primary name to `triggers` (matches the API endpoint
`/v1/code/triggers`) and drop `'schedule'` from the alias list. `/cron`
alias is preserved. Directory stays `src/commands/schedule/` because
renaming the dir would touch every test file's import path for negligible
benefit.

Updated test that asserted the old name + alias, and the user-facing
feature guide that documented `/schedule create ...` examples.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`docs/jira/AUTOFIX-PR-001.md:134` documents that the AUTOFIX_PR flag
"should be added to DEFAULT_BUILD_FEATURES" but the actual addition
to scripts/defines.ts was never made. Result: every build/dev produced
an /autofix-pr command whose isEnabled() returns false (because
src/commands/autofix-pr/index.ts:9 gates on `feature('AUTOFIX_PR')`),
so the command never appeared in /help and was effectively dead code.

The flag is fork-introduced (0 references in upstream/main) so adding
it here doesn't conflict with upstream policy. Other feature() calls
the PR added (KAIROS_GITHUB_WEBHOOKS, etc.) are upstream-owned flags
where we shouldn't override the upstream default.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 9, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ccb-863780bf 🟢 Ready View Preview May 9, 2026, 11:02 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

Important

Review skipped

Too many files!

This PR contains 243 files, which is 93 over the limit of 150.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 35d22708-5638-4b55-9e3b-4774faa737e1

📥 Commits

Reviewing files that changed from the base of the PR and between 7e2b8e8 and a6d462f.

📒 Files selected for processing (243)
  • .github/workflows/ci.yml
  • .gitignore
  • codecov.yml
  • docs/features/all-features-guide.md
  • docs/features/autofix-pr.md
  • docs/jira/AUTH-LOGIN-UI.md
  • docs/jira/AUTOFIX-PR-001.md
  • docs/jira/CROSS-AUDIT-2026-04-29.md
  • docs/jira/CROSS-AUDIT-MULTI-AUTH-2026-05-06.md
  • docs/jira/LOCAL-WIRING-DESIGN.md
  • docs/jira/MULTI-AUTH-DESIGN.md
  • docs/jira/P2-AUTH-DIFF-2026-04-30.md
  • docs/jira/P2-ENDPOINTS-SPEC.md
  • docs/jira/REVERSE-ENGINEERED-SPEC.md
  • docs/jira/STUB-RECOVERY-PLAN.md
  • docs/jira/SUBSCRIPTION-API-ENDPOINTS-REPORT.md
  • docs/jira/UPSTREAM-V2_1_089-V2_1_123-DIFF.md
  • docs/jira/WSL-CI-RUNBOOK.md
  • docs/testing/SLASH-COMMANDS-TEST-CHECKLIST.md
  • packages/builtin-tools/src/index.ts
  • packages/builtin-tools/src/tools/AgentTool/AgentTool.tsx
  • packages/builtin-tools/src/tools/AgentTool/__tests__/resumeAgent.test.ts
  • packages/builtin-tools/src/tools/AgentTool/resumeAgent.ts
  • packages/builtin-tools/src/tools/LocalMemoryRecallTool/LocalMemoryRecallTool.ts
  • packages/builtin-tools/src/tools/LocalMemoryRecallTool/UI.tsx
  • packages/builtin-tools/src/tools/LocalMemoryRecallTool/__tests__/LocalMemoryRecallTool.test.ts
  • packages/builtin-tools/src/tools/LocalMemoryRecallTool/__tests__/stripUntrusted.test.ts
  • packages/builtin-tools/src/tools/LocalMemoryRecallTool/constants.ts
  • packages/builtin-tools/src/tools/LocalMemoryRecallTool/prompt.ts
  • packages/builtin-tools/src/tools/LocalMemoryRecallTool/stripUntrusted.ts
  • packages/builtin-tools/src/tools/RemoteTriggerTool/__tests__/RemoteTriggerTool.test.ts
  • packages/builtin-tools/src/tools/SkillTool/__tests__/prompt.test.ts
  • packages/builtin-tools/src/tools/SkillTool/prompt.ts
  • packages/builtin-tools/src/tools/VaultHttpFetchTool/UI.tsx
  • packages/builtin-tools/src/tools/VaultHttpFetchTool/VaultHttpFetchTool.ts
  • packages/builtin-tools/src/tools/VaultHttpFetchTool/__tests__/VaultHttpFetchTool.test.ts
  • packages/builtin-tools/src/tools/VaultHttpFetchTool/__tests__/scrub.test.ts
  • packages/builtin-tools/src/tools/VaultHttpFetchTool/constants.ts
  • packages/builtin-tools/src/tools/VaultHttpFetchTool/prompt.ts
  • packages/builtin-tools/src/tools/VaultHttpFetchTool/scrub.ts
  • packages/builtin-tools/src/tools/WebFetchTool/__tests__/headers.test.ts
  • packages/builtin-tools/src/tools/WebSearchTool/__tests__/bingAdapter.test.ts
  • packages/builtin-tools/src/tools/WebSearchTool/__tests__/braveAdapter.test.ts
  • packages/builtin-tools/src/tools/WebSearchTool/__tests__/exaAdapter.test.ts
  • scripts/defines.ts
  • scripts/probe-local-wiring.ts
  • scripts/probe-subscription-endpoints.ts
  • scripts/smoke-test-commands.ts
  • scripts/verify-autofix-pr.ts
  • src/commands.ts
  • src/commands/__tests__/bridge-kick.test.ts
  • src/commands/__tests__/commit-push-pr.test.ts
  • src/commands/__tests__/commit.test.ts
  • src/commands/__tests__/init-verifiers.test.ts
  • src/commands/_shared/__tests__/launchCommand.test.ts
  • src/commands/_shared/launchCommand.ts
  • src/commands/agents-platform/AgentsPlatformView.tsx
  • src/commands/agents-platform/__tests__/AgentsPlatformView.test.tsx
  • src/commands/agents-platform/__tests__/agentsApi.test.ts
  • src/commands/agents-platform/__tests__/index.test.ts
  • src/commands/agents-platform/__tests__/launchAgentsPlatform.test.ts
  • src/commands/agents-platform/__tests__/parseArgs.test.ts
  • src/commands/agents-platform/agentsApi.ts
  • src/commands/agents-platform/index.js
  • src/commands/agents-platform/index.ts
  • src/commands/agents-platform/launchAgentsPlatform.tsx
  • src/commands/agents-platform/parseArgs.ts
  • src/commands/autofix-pr/AutofixProgress.tsx
  • src/commands/autofix-pr/__tests__/AutofixProgress.test.tsx
  • src/commands/autofix-pr/__tests__/index.test.ts
  • src/commands/autofix-pr/__tests__/launchAutofixPr.test.ts
  • src/commands/autofix-pr/__tests__/monitorState.test.ts
  • src/commands/autofix-pr/__tests__/parseArgs.test.ts
  • src/commands/autofix-pr/inProcessAgent.ts
  • src/commands/autofix-pr/index.d.ts
  • src/commands/autofix-pr/index.js
  • src/commands/autofix-pr/index.ts
  • src/commands/autofix-pr/launchAutofixPr.ts
  • src/commands/autofix-pr/monitorState.ts
  • src/commands/autofix-pr/parseArgs.ts
  • src/commands/autofix-pr/skillDetect.ts
  • src/commands/break-cache/__tests__/break-cache.test.ts
  • src/commands/break-cache/index.js
  • src/commands/break-cache/index.ts
  • src/commands/break-cache/panel.tsx
  • src/commands/cost/index.ts
  • src/commands/ctx_viz/index.d.ts
  • src/commands/debug-tool-call/__tests__/debug-tool-call.test.ts
  • src/commands/debug-tool-call/index.js
  • src/commands/debug-tool-call/index.ts
  • src/commands/env/__tests__/env.test.ts
  • src/commands/env/index.js
  • src/commands/env/index.ts
  • src/commands/issue/__tests__/issue-gh.test.ts
  • src/commands/issue/__tests__/issue-template.test.ts
  • src/commands/issue/__tests__/issue.test.ts
  • src/commands/issue/index.js
  • src/commands/issue/index.ts
  • src/commands/local-memory/LocalMemoryView.tsx
  • src/commands/local-memory/__tests__/launchLocalMemory.test.ts
  • src/commands/local-memory/__tests__/parseArgs.test.ts
  • src/commands/local-memory/index.tsx
  • src/commands/local-memory/launchLocalMemory.tsx
  • src/commands/local-memory/parseArgs.ts
  • src/commands/local-vault/LocalVaultView.tsx
  • src/commands/local-vault/__tests__/launchLocalVault.test.ts
  • src/commands/local-vault/__tests__/parseArgs.test.ts
  • src/commands/local-vault/index.tsx
  • src/commands/local-vault/launchLocalVault.tsx
  • src/commands/local-vault/parseArgs.ts
  • src/commands/login/AuthPlaneSummary.tsx
  • src/commands/login/WorkspaceKeyInput.tsx
  • src/commands/login/__tests__/AuthPlaneSummary.test.tsx
  • src/commands/login/__tests__/WorkspaceKeyInput.test.tsx
  • src/commands/login/__tests__/getAuthStatus.test.ts
  • src/commands/login/getAuthStatus.ts
  • src/commands/login/login.tsx
  • src/commands/memory-stores/MemoryStoresView.tsx
  • src/commands/memory-stores/__tests__/api.test.ts
  • src/commands/memory-stores/__tests__/index.test.ts
  • src/commands/memory-stores/__tests__/launchMemoryStores.test.ts
  • src/commands/memory-stores/__tests__/parseArgs.test.ts
  • src/commands/memory-stores/index.ts
  • src/commands/memory-stores/launchMemoryStores.tsx
  • src/commands/memory-stores/memoryStoresApi.ts
  • src/commands/memory-stores/parseArgs.ts
  • src/commands/onboarding/__tests__/onboarding.test.tsx
  • src/commands/onboarding/index.d.ts
  • src/commands/onboarding/index.js
  • src/commands/onboarding/index.ts
  • src/commands/onboarding/launchOnboarding.tsx
  • src/commands/perf-issue/__tests__/perf-issue.test.ts
  • src/commands/perf-issue/index.js
  • src/commands/perf-issue/index.ts
  • src/commands/recap/__tests__/recap.test.ts
  • src/commands/recap/generateRecap.ts
  • src/commands/recap/index.ts
  • src/commands/review/UltrareviewPreflightDialog.tsx
  • src/commands/review/__tests__/ultrareviewCommand.test.tsx
  • src/commands/schedule/ScheduleView.tsx
  • src/commands/schedule/__tests__/api.test.ts
  • src/commands/schedule/__tests__/index.test.ts
  • src/commands/schedule/__tests__/launchSchedule.test.ts
  • src/commands/schedule/__tests__/parseArgs.test.ts
  • src/commands/schedule/index.ts
  • src/commands/schedule/launchSchedule.tsx
  • src/commands/schedule/parseArgs.ts
  • src/commands/schedule/triggersApi.ts
  • src/commands/share/__tests__/share-gh.test.ts
  • src/commands/share/__tests__/share-projectdir.test.ts
  • src/commands/share/__tests__/share.test.ts
  • src/commands/share/index.js
  • src/commands/share/index.ts
  • src/commands/skill-store/SkillStoreView.tsx
  • src/commands/skill-store/__tests__/api.test.ts
  • src/commands/skill-store/__tests__/index.test.ts
  • src/commands/skill-store/__tests__/launchSkillStore.test.ts
  • src/commands/skill-store/__tests__/parseArgs.test.ts
  • src/commands/skill-store/index.tsx
  • src/commands/skill-store/launchSkillStore.tsx
  • src/commands/skill-store/parseArgs.ts
  • src/commands/skill-store/skillsApi.ts
  • src/commands/stats/index.ts
  • src/commands/teleport/__tests__/index.test.ts
  • src/commands/teleport/__tests__/launchTeleport.test.ts
  • src/commands/teleport/index.js
  • src/commands/teleport/index.ts
  • src/commands/teleport/launchTeleport.ts
  • src/commands/tui/__tests__/tui.test.ts
  • src/commands/tui/index.ts
  • src/commands/tui/panel.tsx
  • src/commands/usage/__tests__/usage.test.ts
  • src/commands/usage/index.ts
  • src/commands/usage/usage.tsx
  • src/commands/vault/VaultView.tsx
  • src/commands/vault/__tests__/api.test.ts
  • src/commands/vault/__tests__/index.test.ts
  • src/commands/vault/__tests__/launchVault.test.ts
  • src/commands/vault/__tests__/parseArgs.test.ts
  • src/commands/vault/index.tsx
  • src/commands/vault/launchVault.tsx
  • src/commands/vault/parseArgs.ts
  • src/commands/vault/vaultsApi.ts
  • src/commands/version.ts
  • src/components/BuiltinStatusLine.tsx
  • src/components/StatusLine.tsx
  • src/components/__tests__/StatusLine.test.tsx
  • src/components/skills/SkillsMenu.tsx
  • src/components/skills/__tests__/filterSkills.test.ts
  • src/components/skills/filterSkills.ts
  • src/constants/tools.ts
  • src/keybindings/validate.ts
  • src/services/MagicDocs/__tests__/prompts.test.ts
  • src/services/MagicDocs/prompts.ts
  • src/services/SessionMemory/__tests__/multiStore.test.ts
  • src/services/SessionMemory/__tests__/prompts.test.ts
  • src/services/SessionMemory/multiStore.ts
  • src/services/SessionMemory/prompts.ts
  • src/services/api/__tests__/ultrareviewPreflight.test.ts
  • src/services/api/claude.ts
  • src/services/api/ultrareviewPreflight.ts
  • src/services/auth/__tests__/hostGuard.test.ts
  • src/services/auth/__tests__/saveWorkspaceKey.test.ts
  • src/services/auth/hostGuard.ts
  • src/services/auth/saveWorkspaceKey.ts
  • src/services/langfuse/__tests__/langfuse.test.ts
  • src/services/langfuse/sanitize.ts
  • src/services/localVault/__tests__/keychain.test.ts
  • src/services/localVault/__tests__/store.test.ts
  • src/services/localVault/keychain.ts
  • src/services/localVault/store.ts
  • src/services/mcp/__tests__/officialRegistry.test.ts
  • src/services/providerRegistry/__tests__/loader.test.ts
  • src/services/providerRegistry/__tests__/providerCompatMatrix.test.ts
  • src/services/providerRegistry/__tests__/switcher.test.ts
  • src/services/providerRegistry/loader.ts
  • src/services/providerRegistry/providerCompatMatrix.ts
  • src/services/providerRegistry/switcher.ts
  • src/services/providerRegistry/types.ts
  • src/tools.ts
  • src/types/internal-modules.d.ts
  • src/utils/__tests__/agentToolFilter.test.ts
  • src/utils/__tests__/cacheStats.test.ts
  • src/utils/__tests__/lanBeacon.test.ts
  • src/utils/__tests__/localValidate.test.ts
  • src/utils/agentToolFilter.ts
  • src/utils/cacheStats.ts
  • src/utils/cacheStatsState.ts
  • src/utils/config.ts
  • src/utils/localValidate.ts
  • src/utils/sanitizeId.ts
  • src/utils/settings/__tests__/permissionValidation-vault.test.ts
  • src/utils/settings/permissionValidation.ts
  • src/utils/settings/types.ts
  • src/utils/settings/validation.ts
  • src/utils/teleport.tsx
  • src/utils/teleport/__tests__/api.test.ts
  • src/utils/teleport/api.ts
  • tests/integration/autonomy-lifecycle-user-flow.test.ts
  • tests/mocks/axios.ts
  • tests/mocks/childProcess.ts
  • tests/mocks/state.ts
  • tests/mocks/toolContext.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/local-memory-vault-wiring

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

)
const { accessToken, orgUUID } = await prepareApiRequest()
const baseUrl = getOauthConfig().BASE_API_URL
console.log(`base: ${baseUrl}`)
const { accessToken, orgUUID } = await prepareApiRequest()
const baseUrl = getOauthConfig().BASE_API_URL
console.log(`base: ${baseUrl}`)
console.log(`orgUUID: ${orgUUID.slice(0, 8)}…\n`)
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.

3 participants