# Reply tools during goal work

A goal continuation uses a synthetic input origin. The previous origin filter removed registered Telegram reply, reaction and edit tools even after a real user message had entered that turn, while mixed-source routing required an explicit reply and suppressed automatic fallback. The model could therefore receive the message without the required reply tool.

The repair retains existing user tool authority inside one active worker's goal-continuation chain. A private object is bound to the exact agent instance and worker signal. It checks the current turn and active controller before granting or using authority. A different observed goal ID revokes inheritance. Worker completion, failure or cancellation disposes the object; nothing is stored for a later launch or resume. A final answer may still use the tools after goal completion within the same turn.

Only trusted host origin metadata can grant this authority. Pending USER steers count only through the exact request snapshot's sequence boundary; provisional selection does not persist a grant. A committed USER steer grants inheritance only after its actual context append succeeds. A projected message with role `user`, a channel-like text block, or a background/injection/cron origin cannot mint this authority. The existing behavior of direct background and cron turns is unchanged; this repair addresses the restricted synthetic-origin path.

The tools still come from the current registered MCP set and pass through the existing permission hooks. Telegram's configured destination list, language gate and file checks remain in force. That existing destination list covers configured chats; it does not bind a reply to the particular inbound chat. The repair adds no such guarantee, no new destination, no credential store and no automatic reply path. Mixed-source fallback suppression remains unchanged.

Tests extract the actual main and worker methods for tool selection, worker lifecycle, goal driving, pending snapshots and context commit. Model/MCP/network behavior and surrounding per-turn bookkeeping are isolated. They cover consumed and uncommitted input, consecutive goal turns, changed goals, cancellation, existing permission hooks and background text that resembles a channel message. Separate request-boundary regressions verify the composed compaction repair. These checks prove tool availability and lifecycle behavior, not live Telegram delivery or a response-time bound.

The source runtime differs from the packaged repair target. The final composed package still needs installation checks and independent package review before publication.

## Telegram delivery receipts in the package

The bundled bridge asks the model for the chat and incoming message IDs when it replies. The installed Telegram tool records these IDs alongside Telegram-confirmed outgoing IDs in the existing local outbox. Text and attachment failures record only the parts already confirmed. Configured reply threading still applies. If the original message was removed, Telegram can send the reply to the same allowed chat without a thread reference.

When the model supplies an incoming message ID, the existing recent-text duplicate check matches the chat and incoming message together. This prevents an answer to a different message in the same chat from suppressing the current answer. The check remains limited to its recent window. Older outbox entries can lack the address. Existing allowlists, group rules, language release checks and file checks still apply.

## Local delivery correlation in the source runtime

The console copies the numeric chat and incoming message IDs from Telegram bridge metadata into its local checked admission. The session journal records the pair with the actual context append. Active retries use the pair as part of the existing request digest, so the same request cannot claim another chat or message after a restart. The typed address stays out of model requests and public turn-start events. Telegram's existing message content and destination permissions still apply.

The bridge asks the model to pass both IDs for each reply. The Telegram tool records an explicitly supplied incoming message ID alongside the chat and Telegram-confirmed outgoing IDs in the existing outbox, including when visible reply threading is disabled. A partial failure records only acknowledged parts and the address. An abrupt process exit between Telegram's acknowledgement and the outbox write can leave an uncertain receipt. The journal address and the outbox receipt provide separate evidence of local context delivery and Telegram send.

## Reply priority during work

The active goal reminder asks the model to answer new direct questions in their original channel before taking an unrelated goal action. In the bundled console the mixed-input hint also prioritizes new addressed Telegram messages and keeps unaddressed group context silent. A task that needs more work can receive an honest progress update while the agent continues.

This changes model guidance. Existing tool permissions and reply routes apply, and no extra destination is added. The time to a Telegram reply still depends on model and tool execution. An input admitted to the session is a separate event from Telegram confirming a reply.

## Project mistake archive

The bundled runtime references automatically discovered project `Mistake.md` files larger than the existing 32 KiB instruction-size recommendation. The reference stays visible in the system prompt. The existing lesson selector and ordinary file tools can still retrieve relevant entries. Explicit imports and `AGENTS.md` keep their full contents. This reduces the text sent to the existing model endpoint. It adds neither a file write nor a new recipient.

## Overdue recurring jobs on interactive resume

After restoring a session with terminal input and output, the scheduler holds recurring jobs that already had multiple missed occurrences for the first 60 seconds. One-shot reminders and jobs with only one occurrence due at restore follow their existing schedule. When the initial window ends, the scheduler waits for an idle turn before sending the existing coalesced run and advancing the saved cursor. The check uses elapsed time, including when the system clock changes.

## Reply matching in the console

The bundled console carries the bridge's incoming message ID through the visible queue. During a completed turn with one addressed message, it matches the local Telegram receipt on chat ID and incoming message ID. A receipt for a different message leaves the existing text fallback available. Partial receipts and a matching reply call with an uncertain result suppress a resend that could duplicate a delivery. The fallback stores its confirmed send with the incoming message ID in the existing local Telegram outbox. Wire destinations and Telegram reply threading stay the same.

If a second addressed message joins the turn, even from the same chat, use the explicit Telegram reply tool with the address of each original message. Unaddressed group context stays silent. Existing permissions and chat settings apply. Mixed-source reply times still depend on the agent calling the tool.

### Local active-turn admission in the bundle

When the console submits an addressed Telegram input into an ongoing local session using checked queue admission, it takes the chat ID and incoming message ID from the bridge queue item. Submission and receipt lookup bind both to the same runtime-scoped request. A lookup with either ID changed conflicts with the accepted request. Terminal input and older queue items without an address keep their existing receipt format.

The session's local journal keeps the address with the steer and with its context append. A receipt with disposition `context` confirms the append. A discarded steer can have an admission record without a context append. The extra address fields are stripped from the model's message projection. The existing input text, Telegram permissions, outbound confirmation, and gateway request format follow their existing paths. The address alone gives no authority to send a reply.

### Reply opportunity during a local active turn

When a direct Telegram message joins the main agent's active turn and a model step finishes without attempting its reply, the next model request gets one instruction with that message's chat and incoming message IDs. If the first step was about to end the turn, the runtime allows an additional step for the reply. The instruction is transient and included in the normal request size check. It is sent to the same configured model endpoint as the message and uses the registered Telegram reply tool and the normal language and permission checks.

The correction runs after completed tool work and leaves active tools running. It does not schedule another attempt after a matching or ambiguous reply call. Filtered output, an explicit tool stop, and the goal budget retain their existing behavior. Group messages do not enter this direct-message recovery path. The instruction does not send a message by itself. Telegram confirmation still comes from the normal reply tool.
