bug: conversation context selects the oldest thread messages instead of recent replies
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
調査の方向性
bot.pyで_build_conversation_context()とthread.history()の呼び出しを調べます。現在のメッセージを履歴の境界として使い、4メッセージの上限を維持し、結果が時系列順に整形され、明示的な返信参照コンテキストも引き続き利用できることを確認します。issueで言及されている単独で実行可能な再現コードを使って再現します。メッセージ11より前にメッセージ7~10が選択されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 10
- フォーク
- 12
- 平均マージ
- 3分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AOSSIE-Org/SkillBot のほかの issue
-
[BUG]: Issue-creation intent is missed when the article is omitted (create issue for this)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
AOSSIE-Org/SkillBot#65 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Non-Atomic Gap Log Writes Can Cause Data Loss After an Interrupted Save対応中かも @sankalpmtellur が 4 日前に担当しました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
AOSSIE-Org/SkillBot#61 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: os.chdir() Changes the Process-Wide Working Directory During Repository Sync対応中かも @aadityachhipa80-oss が 12 日前に担当しました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
AOSSIE-Org/SkillBot#59 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: wait_for_ollama() Retries Indefinitely When Ollama Is Unavailable再び着手できるかも @SYED-IRTEZA-HUSSAIN-RIZVI が 22 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AOSSIE-Org/SkillBot#56 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Backlog Messages Are Re-processed on Discord Reconnection再び着手できるかも @SYED-IRTEZA-HUSSAIN-RIZVI が 22 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
AOSSIE-Org/SkillBot#58 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
AOSSIE-Org/SkillBot の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
bad-antics/lateralus-lang#1438 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
area: control app
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
glossyio/traffic-monitor#415 ·
メンテナーはふだん 1 日以内に返信
-
apply_matrix_rect takes 6-9% of extract_text time対応中かも @g4lb が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
pdfminer/pdfminer.six#1333 ·
メンテナーはふだん 1 日以内に返信
-
intake mcp-intake needs-human-review priority:high type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
Ikalus1988/MisakaNet#6081 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信