Skip to content

Commit 3dc2946

Browse files
charlesvienk11kirky
authored andcommitted
review fixes
1 parent c1f5743 commit 3dc2946

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

apps/twig/src/main/services/agent/service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ export class AgentService extends TypedEventEmitter<AgentServiceEvents> {
435435
adapter,
436436
additionalDirectories,
437437
permissionMode,
438+
customInstructions,
438439
} = config;
439440

440441
// Preview sessions don't need a real repo — use a temp directory
@@ -533,7 +534,7 @@ export class AgentService extends TypedEventEmitter<AgentServiceEvents> {
533534
}
534535
const systemPrompt = this.buildSystemPrompt(
535536
credentials,
536-
config.customInstructions,
537+
customInstructions,
537538
);
538539
const resumeResponse = await connection.extMethod(
539540
"_posthog/session/resume",
@@ -567,7 +568,7 @@ export class AgentService extends TypedEventEmitter<AgentServiceEvents> {
567568
} else {
568569
const systemPrompt = this.buildSystemPrompt(
569570
credentials,
570-
config.customInstructions,
571+
customInstructions,
571572
);
572573
const newSessionResponse = await connection.newSession({
573574
cwd: repoPath,

apps/twig/src/renderer/features/settings/components/sections/PersonalizationSettings.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,20 @@ export function PersonalizationSettings() {
2424

2525
const saveInstructions = useCallback(
2626
(value: string) => {
27-
const trimmed = value.slice(0, MAX_INSTRUCTIONS_LENGTH);
28-
setCustomInstructions(trimmed);
27+
const current = useSettingsStore.getState().customInstructions;
28+
if (value === current) return;
29+
setCustomInstructions(value);
2930
track(ANALYTICS_EVENTS.SETTING_CHANGED, {
3031
setting_name: "custom_instructions",
31-
new_value: trimmed.length > 0,
32+
new_value: value.length > 0,
3233
});
3334
},
3435
[setCustomInstructions],
3536
);
3637

3738
const handleInstructionsChange = useCallback(
3839
(e: React.ChangeEvent<HTMLTextAreaElement>) => {
39-
const value = e.target.value.slice(0, MAX_INSTRUCTIONS_LENGTH);
40+
const value = e.target.value;
4041
setLocalInstructions(value);
4142

4243
if (debounceRef.current) {
@@ -80,6 +81,7 @@ export function PersonalizationSettings() {
8081
value={localInstructions}
8182
onChange={handleInstructionsChange}
8283
onBlur={handleInstructionsBlur}
84+
maxLength={MAX_INSTRUCTIONS_LENGTH}
8385
placeholder="e.g. Always write tests for new code. Prefer functional patterns."
8486
rows={6}
8587
size="1"

0 commit comments

Comments
 (0)