Skip to content

fix: group chat reliability batch - #70

Merged
NatanTechofNY merged 9 commits into
mainfrom
fix/group-chat-reliability
Oct 16, 2026
Merged

NatanTechofNY merged 9 commits into
mainfrom
fix/group-chat-reliability

Conversation

@NatanTechofNY

Copy link
Copy Markdown
Owner

Summary

  • Retry empty model responses (424) in place; end an already-answered turn quietly; never send the "couldn't get through" text for a turn that was answered; keep the inbound message last in retry history.
  • Group bursts are off by default (GROUP_BURSTS=1 turns them back on), so each group text is its own turn and reactions land on the right message.
  • Let the person the assistant just asked answer without naming it, even after other members spoke in between.
  • Scheduled turns are told the weekday; find_gif drops results titled for a different weekday.
  • create_page in a group returns scoped related_pictures from the group's own memories; prompt tells the agent to add them.
  • Remove the Categories filter from Reflections (scope key hash stays compatible).

Deploy notes

Republish agent-studio/system-prompt.txt and the get_reflection_evidence tool (agent-studio/tools/client-tools.json) in Agent Studio.

Test plan

  • npm run lint
  • npm run typecheck
  • npm test (99 web, 414 server)

Made with Cursor

NatanTechofNY and others added 6 commits October 16, 2026 16:31
…for an answered turn

Co-authored-by: Cursor <cursoragent@cursor.com>
…TS is set

Co-authored-by: Cursor <cursoragent@cursor.com>
…name

Co-authored-by: Cursor <cursoragent@cursor.com>
…for another one

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Reflections no longer filter by category in the UI, API, tool schema or
evidence scope. The scope key hash keeps a constant empty categories entry so
existing keys stay valid.

Co-authored-by: Cursor <cursoragent@cursor.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T20:36:41.526919Z 15992f0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 15992f0291

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/agent-runner.ts
Comment on lines +1418 to +1420
WHERE thread_id=? AND role='tool' AND content IN (${ANSWERING_TOOLS.map(() => "?").join(",")})
AND json_extract(metadata_json,'$.output.success')=1
AND rowid>? AND (? IS NULL OR rowid<?)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve confirmations for writes made after staying quiet

On a retry after a successful stay_quiet followed by a successful record write, this query returns true merely because the silence tool exists. That ordering is possible because stay_quiet only rejects writes that occurred before it; a later write succeeds and requires confirmation. If the first attempt then fails during a subsequent completion or while delivering that confirmation, the early return at line 1906 marks the event handled without sending anything, leaving the group unaware that its record changed. Treat stay_quiet as terminal only when no later successful record-write trace exists.

Useful? React with 👍 / 👎.

Comment thread server/agent-runner.ts Outdated
// Past the assistant's reply, which may have been two bubbles, to what it answered.
const answered = earlier.find(row => row.role === "user");
AND (? IS NULL OR (created_at<=(SELECT created_at FROM channel_messages WHERE id=?) AND id<>?))
ORDER BY created_at DESC,rowid DESC LIMIT 12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Search the full follow-up window for the asked question

In a named_only group, once 12 other eligible messages arrive after the assistant's question, this fixed limit excludes the assistant row even when it is still inside the documented ten-minute follow-up window. When the originally addressed person then answers without naming the assistant, answersAssistant() returns false, so holdUntilNamed() silently holds the answer and runs no completion. Locate the latest assistant message within the time window rather than limiting the search to 12 total rows.

Useful? React with 👍 / 👎.

Comment thread server/agent-runner.ts Outdated
// The reply may have been two bubbles; what it asked can be in either.
let firstBubble = lastSaid;
while (earlier[firstBubble + 1]?.role === "assistant") firstBubble += 1;
const asked = earlier.slice(lastSaid, firstBubble + 1).some(row => /\?\s*$/.test(row.content.trim()));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recognize questions that have trailing text

A question is recognized only when the entire assistant bubble ends in ?. Natural replies such as Which song? I can look it up. or Which one? 🎵 therefore set asked to false; in named_only mode, even an immediate answer from the person the assistant addressed is then held without a completion. Detect a question independently of trailing prose or emoji so the new follow-up exception applies to these messages.

Useful? React with 👍 / 👎.

NatanTechofNY and others added 3 commits October 16, 2026 16:47
…w notes

- Folding a backlog of group texts (older than two minutes when reached)
  stays on while GROUP_BURSTS is off, so an outage does not cost a turn each.
- A post to another group counts as an answer when a failed turn is retried.
- Pages made through POST /api/pages are offered related pictures too.
- answersAssistant keeps its indexed range scan when the inbound is filed.

Co-authored-by: Cursor <cursoragent@cursor.com>
… tidy review notes

- answersAssistant reads the thread over the follow-up window, keeps a
  question open until its person speaks, and takes a kind instead of a flag.
- turnAlreadyAnswered also counts a bubble the turn filed itself; a retry of
  an overtaken turn no longer ends its window on a reply.
- todayIs and todayWeekday replace six copies of the date line and the
  weekday lookup; a GIF title naming today as well is kept.
- related_pictures carries the planned shape only.
- Tests for the empty-response early end, the give-up suppression, and the
  open question; docs and the prompt match.

Co-authored-by: Cursor <cursoragent@cursor.com>
…d read any question mark

- A retry is not skipped, and the give-up line is not withheld, when a
  record was written beside the GIF, post, or silence: its confirmation
  was never sent.
- A bubble asks a question wherever its question mark falls, outside links.

Co-authored-by: Cursor <cursoragent@cursor.com>
@NatanTechofNY
NatanTechofNY merged commit 1f26be5 into main Oct 16, 2026
2 checks passed
@NatanTechofNY
NatanTechofNY deleted the fix/group-chat-reliability branch October 16, 2026 21:43
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