Skip to content

fix(bridges): make CONTEXT-FIRST reconstruction unconditional (discord + telegram) - #2093

Merged
qingyun-wu merged 2 commits into
mainfrom
fix/bridge-context-first-unconditional
Jul 14, 2026
Merged

qingyun-wu merged 2 commits into
mainfrom
fix/bridge-context-first-unconditional

Conversation

@sonichi

@sonichi sonichi commented Jul 13, 2026

Copy link
Copy Markdown
Owner

What

The owner-task skill-instruction step 1 (CONTEXT-FIRST) injected by the Discord and Telegram bridges gated reconstruction on the agent judging the message "not self-contained." This PR removes that gate — reconstruction now runs before interpreting every owner message, with only a pure greeting/ack (no referent) exempt.

Why

The self-contained judgment is the exact signal that fails. When the agent feels it already understands a terse or threaded reply, it walks past the read and answers from stale/compacted memory — losing the referent. "Do I feel confident?" is precisely the wrong trigger; felt confidence is confidently wrong after a compaction or a long interleaved run. Making the read unconditional trades a few cheap re-reads for never skipping the step in the case where it's most needed.

Change

  • src/discord-bridge.py — CONTEXT-FIRST step reworded to unconditional; still reconstructs via the channel pull-back (discord-read.py).
  • src/telegram-bridge.py — same, via the embedded [Replying to …] quote + session transcript (Telegram has no message-history API — substrate note preserved).

Prompt-instruction text only. No code-path or tool-behavior change; both files py_compile clean.

Scope

Single concern (the CONTEXT-FIRST instruction in the two bridges that pull-back). Slack's CONTEXT-FIRST step is being handled separately in #1839/#1840.

Stand: Echo Act IV Pro

…d + telegram)

The owner-task skill-instruction step 1 (CONTEXT-FIRST) gated reconstruction
on the agent judging the message "not self-contained." But that self-judgment
("I already understand this" / felt confidence) is exactly the signal that
fails — the agent keeps walking past the read on questions it only *feels*
confident about, then answers from stale/compacted memory and loses the
referent.

Remove the gate: reconstruct before interpreting *every* owner message, with
only a pure greeting/ack (no referent) exempt. Trades a few cheap re-reads for
never skipping the step when it's most needed. Discord reconstructs via the
channel pull-back (discord-read.py); Telegram (no message-history API) via the
embedded [Replying to …] quote + session transcript — substrate note preserved.

Prompt-instruction change only; no code-path or tool behavior change.

Stand: Echo Act IV Pro
@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Gate

✅ Diff coverage PASSES the 95% bar. Whole-tree (informational): 44%.

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.

@qingyun-wu

Copy link
Copy Markdown
Collaborator

LGTM from code review. Verified on head b761eefcc4f44d2075443a4320795585dd6b800c:

  • git diff origin/main...pr-2093 -- src/discord-bridge.py src/telegram-bridge.py shows the patch is prompt-only: both owner-task emitters switch CONTEXT-FIRST from a self-contained judgment gate to an unconditional reconstruction instruction, with the pure greeting/ack carve-out preserved in the instruction text.
  • PYTHONPYCACHEPREFIX=/private/tmp/pr2093-pycache python3 -m py_compile src/discord-bridge.py src/telegram-bridge.py passes.
  • git grep -n "CONTEXT-FIRST" pr-2093 -- src/discord-bridge.py src/telegram-bridge.py confirms the updated unconditional wording is the only CONTEXT-FIRST instruction in these two emitters on this head.

Ready to merge once CI passes.

Qingyun's Personal Codex Agent

@qingyun-wu

Copy link
Copy Markdown
Collaborator

LGTM.

I checked the actual prompt-text changes in src/discord-bridge.py:3167-3185 and src/telegram-bridge.py:776-795; both now make the reconstruction step unconditional while preserving the explicit greeting/ack exception and the correct substrate difference between Discord pull-back vs Telegram quote+transcript reconstruction. I also ran PYTHONDONTWRITEBYTECODE=1 python3 -m py_compile src/discord-bridge.py src/telegram-bridge.py in the PR worktree; both files compile cleanly.

Qingyun's Personal Codex Agent

@github-actions

Copy link
Copy Markdown
Contributor

@cla-assistant check

@qingyun-wu
qingyun-wu merged commit 3e101f4 into main Jul 14, 2026
8 checks passed
@qingyun-wu
qingyun-wu deleted the fix/bridge-context-first-unconditional branch July 14, 2026 06:10
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.

2 participants