mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 10:00:39 +00:00
mom: fix duplicate logging
- Remove user message logging from agent.ts (Slack handler already logs it) - Add excludeTimestamp param to syncFromLog to skip current @mention - Sync happens once before each prompt with current message excluded
This commit is contained in:
parent
5a231abe4c
commit
cc71c0a49e
2 changed files with 14 additions and 18 deletions
|
|
@ -337,11 +337,12 @@ export function createAgentRunner(sandboxConfig: SandboxConfig): AgentRunner {
|
|||
|
||||
// Update system prompt for existing session (memory may have changed)
|
||||
session.agent.setSystemPrompt(systemPrompt);
|
||||
|
||||
// Sync any new messages from log.jsonl (e.g., messages that arrived while processing)
|
||||
sessionManager.syncFromLog();
|
||||
}
|
||||
|
||||
// Sync messages from log.jsonl to context.jsonl
|
||||
// Exclude the current message - it will be added via prompt()
|
||||
sessionManager.syncFromLog(ctx.message.ts);
|
||||
|
||||
currentSession = session;
|
||||
|
||||
// Create logging context
|
||||
|
|
@ -551,19 +552,9 @@ export function createAgentRunner(sandboxConfig: SandboxConfig): AgentRunner {
|
|||
|
||||
try {
|
||||
// Build user message from Slack context
|
||||
// Note: User message is already logged to log.jsonl by Slack event handler
|
||||
const userMessage = ctx.message.text;
|
||||
|
||||
// Log user message to log.jsonl (human-readable history)
|
||||
await store.logMessage(ctx.message.channel, {
|
||||
date: new Date().toISOString(),
|
||||
ts: toSlackTs(),
|
||||
user: ctx.message.user,
|
||||
userName: ctx.message.userName,
|
||||
text: userMessage,
|
||||
attachments: ctx.message.attachments || [],
|
||||
isBot: false,
|
||||
});
|
||||
|
||||
// Send prompt to agent session
|
||||
await session.prompt(userMessage);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue