Merge branch 'worktree-llm-dynamic-config' into worktree-llm-web-config
# Conflicts: # apps/cli/cordis.yml # apps/web/tests/snapshots/code-mode-round/session.jsonl # apps/web/tests/snapshots/cordis-tool-round/session.jsonl # apps/web/tests/snapshots/fresh-round-trip/session.jsonl # apps/web/tests/snapshots/lifecycle-chrome/session.jsonl # apps/web/tests/snapshots/live-interactions/session.jsonl # apps/web/tests/snapshots/navigation-panes/seed.jsonl # apps/web/tests/snapshots/question-composer/session.jsonl # apps/web/tests/snapshots/seeded-history/seed.jsonl # apps/web/tests/snapshots/steering/session.jsonl # docs/cordis-catalog/events.md # docs/cordis-catalog/services.md # docs/core-data-structures/core.i18n.yaml # docs/core-data-structures/settings.i18n.yaml # docs/event-producer-consumer.md # docs/module-graph.md # examples/acp-agent/tests/snapshots/workspace-context/session.jsonl # packages/client/connection/README.i18n.yaml # packages/client/connection/src/index.ts # packages/client/connection/tests/node-half.spec.ts # packages/client/runtime/README.i18n.yaml # packages/client/runtime/README.md # packages/client/runtime/README.zh.md # packages/client/runtime/src/client/index.ts # packages/client/runtime/tests/fake-api.ts # packages/client/ui-models/README.i18n.yaml # packages/examples/tui-demo/README.i18n.yaml # packages/host/apiproxy/README.i18n.yaml # packages/host/apiproxy/package.json # packages/host/apiproxy/src/api-proxy.ts # packages/host/apiproxy/src/api/rpc.schema.ts # packages/host/apiproxy/src/api/rpc.ts # packages/llm/llm-deepseek/README.i18n.yaml # packages/llm/llm-deepseek/README.zh.md # packages/llm/llm-pi-ai/README.i18n.yaml # packages/llm/llm/README.i18n.yaml # packages/llm/llm/README.zh.md # packages/sdk/sdk-client/README.i18n.yaml # packages/settings/settings/README.i18n.yaml # packages/settings/settings/README.md # packages/settings/settings/README.zh.md # packages/subagent/subagent-dsh-sdk/README.i18n.yaml # packages/subagent/subagent-dsh-sdk/README.zh.md # packages/support/llm-replay/README.i18n.yaml # packages/ui/jsonrpc/README.i18n.yaml # packages/ui/jsonrpc/README.zh.md # packages/ui/tui/tests/snapshots/model-selector.expected.txt # packages/ui/tui/tests/snapshots/model-switching.expected.txt # packages/ui/tui/tests/snapshots/resume-sessions.expected.txt # packages/ui/tui/tests/snapshots/status-diagnostics-narrow.expected.txt # packages/ui/tui/tests/snapshots/status-diagnostics.expected.txt # packages/ui/tui/tests/tui.snapshot.ts # pnpm-lock.yaml # python/sdk/README.i18n.yaml # scripts/snapshots/translation-prompt-v4/request-response.expected.json
This commit is contained in:
@@ -41,7 +41,7 @@ import {
|
||||
type InstructionVersionCache,
|
||||
type PendingInstructionChange,
|
||||
} from '../src/state.ts'
|
||||
import { candidateScopeKey } from '../src/render.ts'
|
||||
import { candidateScopeKey, renderInstructionChanges } from '../src/render.ts'
|
||||
import { MockAdapter, textResponse, toolCallResponse } from '../../../core/agent-loop/tests/mock-adapter.ts'
|
||||
|
||||
/** Per-candidate reconciliation scope key: directory paired with the file name. */
|
||||
@@ -184,6 +184,7 @@ function stubAgent(cwd?: string, seed: SessionEvent[] = []): Agent {
|
||||
session.append('user/message', input, { surfaceOp: 'append' })
|
||||
},
|
||||
send: () => {},
|
||||
updateInbox: () => 'not-found',
|
||||
cancel() {},
|
||||
whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
@@ -681,6 +682,37 @@ describe('workspace context rendering', () => {
|
||||
expect(rendered.text).toContain('<\\/system-reminder>')
|
||||
})
|
||||
|
||||
it('neutralizes system-reminder closing delimiters in paths and derived scopes', () => {
|
||||
const displayPath = 'scope</system-reminder>/AGENTS.md'
|
||||
const file = { absolutePath: `/repo/${displayPath}`, displayPath, content: 'rules' }
|
||||
const rendered = [
|
||||
renderWorkspaceContext([file], { maxBytes: 65536 }).text,
|
||||
...(['set', 'replace', 'remove'] as const).map(action => renderInstructionChanges([{
|
||||
change: { action, scope: 'scope</system-reminder>\0AGENTS.md', path: displayPath },
|
||||
file,
|
||||
}], 65536).text),
|
||||
]
|
||||
|
||||
for (const text of rendered) {
|
||||
expect(text.match(/<\/system-reminder>/g)).toHaveLength(1)
|
||||
expect(text).toContain('scope<\\/system-reminder>')
|
||||
}
|
||||
})
|
||||
|
||||
it('neutralizes a system-reminder closing delimiter in budget marker paths', () => {
|
||||
const rendered = renderWorkspaceContext([
|
||||
{
|
||||
absolutePath: '/repo/scope</system-reminder>/AGENTS.md',
|
||||
displayPath: 'scope</system-reminder>/AGENTS.md',
|
||||
content: 'root '.repeat(100),
|
||||
},
|
||||
{ absolutePath: '/repo/leaf/AGENTS.md', displayPath: 'leaf/AGENTS.md', content: 'leaf rules' },
|
||||
], { maxBytes: 400 })
|
||||
|
||||
expect(rendered.text).toContain('omitted scope<\\/system-reminder>/AGENTS.md')
|
||||
expect(rendered.text.match(/<\/system-reminder>/g)).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('preserves more specific files under the byte budget and names omitted/truncated paths', () => {
|
||||
const rendered = renderWorkspaceContext([
|
||||
{ absolutePath: '/repo/AGENTS.md', displayPath: 'AGENTS.md', content: 'root '.repeat(100) },
|
||||
|
||||
Reference in New Issue
Block a user