Skip to content

refactor(agent-core-v2): derive wire-record scope from agent scope context#1596

Merged
kermanx merged 1 commit into
mainfrom
refactor/v2-wire-record-scope-context
Jul 13, 2026
Merged

refactor(agent-core-v2): derive wire-record scope from agent scope context#1596
kermanx merged 1 commit into
mainfrom
refactor/v2-wire-record-scope-context

Conversation

@kermanx

@kermanx kermanx commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — internal refactor, problem explained below.

Problem

AgentWireRecordService (agent-core-v2) took an ad-hoc options: { readonly homedir?: string } = {} bag as its first constructor parameter, passed per agent scope through SyncDescriptor args in agentLifecycle. In the DI × Scope architecture, per-scope configuration should flow through scope context tokens, not anonymous constructor option bags.

What changed

The store scope was derived as relative(homeDir, agentHomedir), and agentHomedir is defined as join(homeDir, agentScope) — so the value always equals IAgentScopeContext.scope(), which every agent scope already seeds.

  • wireRecordService.ts: inject @IAgentScopeContext and use scopeContext.scope() as the wire-log scope; drop the options parameter and the now-unused IBootstrapService dependency.
  • agentLifecycleService.ts: seed IAgentWireRecordService without constructor args.
  • test/harness/agent.ts: same seed simplification (the harness already defines IAgentScopeContext for the agent scope).

No behavior change: production resolves to the identical sessions/<ws>/<sid>/agents/<aid> scope string, and the harness's in-memory IAppendLogStore ignores scope/key entirely. Verified with tsc --noEmit and test/agent/wireRecord/resume.test.ts (14 passed).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works. (No new behavior — covered by the existing wireRecord/wire suites.)
  • Ran gen-changesets skill, or this PR needs no changeset. (Internal refactor, no changeset.)
  • Ran gen-docs skill, or this PR needs no doc update. (No user-facing change.)

…ntext

AgentWireRecordService took an ad-hoc { homedir } options object as a
constructor parameter, seeded per agent scope through SyncDescriptor
args. Since agentHomedir is join(homeDir, agentScope), the store scope
derived from it equals IAgentScopeContext.scope() — inject the scope
context instead and drop both the options parameter and the
IBootstrapService dependency.
@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8616ce8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 13, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@8616ce8
npx https://pkg.pr.new/@moonshot-ai/kimi-code@8616ce8

commit: 8616ce8

@kermanx kermanx merged commit 63300dd into main Jul 13, 2026
11 checks passed
@kermanx kermanx deleted the refactor/v2-wire-record-scope-context branch July 13, 2026 08:46
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