mom: fix duplicate bot response logging, remove debug logs

- Remove bot response logging from agent.ts (already done in ctx.respond)
- Remove all debug console.log statements
- Clean up unused store parameter
This commit is contained in:
Mario Zechner 2025-12-11 13:39:32 +01:00
parent cc71c0a49e
commit e513127b3b
3 changed files with 98 additions and 107 deletions

View file

@ -262,7 +262,7 @@ export function createAgentRunner(sandboxConfig: SandboxConfig): AgentRunner {
const executor = createExecutor(sandboxConfig);
return {
async run(ctx: SlackContext, channelDir: string, store: ChannelStore): Promise<{ stopReason: string }> {
async run(ctx: SlackContext, channelDir: string, _store: ChannelStore): Promise<{ stopReason: string }> {
// Ensure channel directory exists
await mkdir(channelDir, { recursive: true });
@ -424,7 +424,7 @@ export function createAgentRunner(sandboxConfig: SandboxConfig): AgentRunner {
// Subscribe to session events
const unsubscribe = session.subscribe(async (event) => {
// Handle core agent events
// Handle agent events
if (event.type === "tool_execution_start") {
const agentEvent = event as AgentEvent & { type: "tool_execution_start" };
const args = agentEvent.args as { label?: string };
@ -571,16 +571,7 @@ export function createAgentRunner(sandboxConfig: SandboxConfig): AgentRunner {
.join("\n") || "";
if (finalText.trim()) {
// Log final response to log.jsonl (human-readable history)
await store.logMessage(ctx.message.channel, {
date: new Date().toISOString(),
ts: toSlackTs(),
user: "bot",
text: finalText,
attachments: [],
isBot: true,
});
// Note: Bot response is logged via ctx.respond() in the event handler
try {
const mainText =
finalText.length > SLACK_MAX_LENGTH

View file

@ -161,7 +161,7 @@ export class MomSessionManager {
appendFileSync(this.contextFile, JSON.stringify(entry) + "\n");
}
console.log(`[mom] Synced ${newMessages.length} messages from log.jsonl to context.jsonl`);
// Sync complete - newMessages.length messages added
}
private extractSessionId(): string | null {