bug: conversation context selects the oldest thread messages instead of recent replies
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
In bot.py, inspect _build_conversation_context() and its call to thread.history(). Use the current message as the history boundary, keep the four-message limit, and check the result is formatted chronologically while explicit reply-reference context remains available. Reproduce with the standalone executable reproduction mentioned in the issue; done when it selects messages 7–10 before message 11.
Written by the indexing model from the issue text.
Description
Bug Description
Summary
_build_conversation_context() fetches the oldest four thread messages and labels them as the immediately preceding discussion. Recent corrections are absent from the context used for answers, repository routing, and issue drafting.
Root cause
In bot.py:203, thread.history(limit=THREAD_HISTORY_LIMIT, oldest_first=True) has no before/after cursor. With discord.py 2.7.1 this starts at after=0, selecting the thread's first four messages. Slicing the resulting context later cannot recover messages that were never fetched.
Expected vs. actual behavior
Expected: for current message 11, select messages 7-10 in chronological order and exclude the current message and later messages.
Actual: select messages 1-4. Explicit reply-reference context should remain available independently.
Proposed fix
Fetch newest-first with before=current_msg, then reverse the bounded result before formatting it. Keep the existing four-message limit, formatting, and explicit reply-reference handling.
Duplicate check
Checked all 10 open issues and 7 open PRs on 28 November 2026. No matching report was found. #58 concerns reconnect/backlog processing; #24 concerns repository document size. The public patches for PRs #60, #70 and #71 do not change this history request.
AI assistance
N/A
Steps to Reproduce
- In an unmodified checkout, consider a thread containing messages 1-10 and a current message with ID 11.
- Call
_build_conversation_context(thread, author, query, current_msg)without an explicit reply reference. - Inspect the context passed to the model: the history request starts at after=0 and contains messages 1-4 instead of 7-10.
This was reproduced offline with discord.py's real history iterator and a fixture replacing its HTTP boundary. A standalone executable reproduction is available for this report.
Logs and Screenshots
History arguments: [{'limit': 4, 'before': None, 'after': 0}]
Immediate preceding context (last 3-4 messages & reply target):
Contributor: message-1
Contributor: message-2
Contributor: message-3
Contributor: message-4
PRIMARY TAGGED QUESTION (from Contributor): please explain the fix
AssertionError: Expected immediately preceding messages 7-10; got the thread's oldest messages
The unmodified checkout exits 1. The patched checkout selects messages 7-10 and exits 0.
Environment Details
Linux; Python 3.12.14; discord.py 2.7.1. Tested commit: a03e0dbac0f9a74a1231c161b40372d420fd8018.
Impact
Medium - Feature works but has issues
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
- Dominant language
- Python
- Stars
- 10
- Forks
- 12
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/SkillBot
-
[BUG]: Issue-creation intent is missed when the article is omitted (create issue for this)May be free again A pull request for this issue was closed without being merged. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
AOSSIE-Org/SkillBot#65 · 2 comments ·
Maintainers usually reply within 1 day
-
[BUG]: Non-Atomic Gap Log Writes Can Cause Data Loss After an Interrupted SavePossibly taken @sankalpmtellur claimed this 4 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AOSSIE-Org/SkillBot#61 · 2 comments ·
Maintainers usually reply within 1 day
-
[BUG]: os.chdir() Changes the Process-Wide Working Directory During Repository SyncPossibly taken @aadityachhipa80-oss claimed this 12 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
AOSSIE-Org/SkillBot#59 · 3 comments ·
Maintainers usually reply within 1 day
-
[BUG]: wait_for_ollama() Retries Indefinitely When Ollama Is UnavailableMay be free again @SYED-IRTEZA-HUSSAIN-RIZVI claimed this 22 days ago, and no pull request is open. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AOSSIE-Org/SkillBot#56 · 4 comments ·
Maintainers usually reply within 1 day
-
[BUG]: Backlog Messages Are Re-processed on Discord ReconnectionMay be free again @SYED-IRTEZA-HUSSAIN-RIZVI claimed this 22 days ago, and no pull request is open. Openbug enhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
AOSSIE-Org/SkillBot#58 · 2 comments ·
Maintainers usually reply within 1 day
All issues in AOSSIE-Org/SkillBot
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
bad-antics/lateralus-lang#1438 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
area: control app
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
glossyio/traffic-monitor#415 ·
Maintainers usually reply within 1 day
-
apply_matrix_rect takes 6-9% of extract_text timePossibly taken @g4lb claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
pdfminer/pdfminer.six#1333 ·
Maintainers usually reply within 1 day
-
intake mcp-intake needs-human-review priority:high type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Ikalus1988/MisakaNet#6081 · 2 comments ·
Maintainers usually reply within 1 day