Skip to content

fix(agent-core-v2): keep background questions open past turn end - #308

Merged
elkaix merged 1 commit into
mainfrom
fix/reconcile-rows-b-2026-09-10
Sep 15, 2026
Merged

elkaix merged 1 commit into
mainfrom
fix/reconcile-rows-b-2026-09-10

Conversation

@elkaix

@elkaix elkaix commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Related Issue

No tracked issue — internal reconciliation pass. Stacked on #307; review that one first (and #306 under it).

Problem

A background AskUserQuestion (asked with background: true) was bound to the asking turn: the moment the agent finished its turn, the question was cancelled and the user never got to answer it. When a background question was answered, the agent received only the path of a saved output file, not the answer itself.

What changed

  • Detached question requests no longer carry the asking turn's id, and turn-end cancellation leaves them pending; the question stays open until the user answers or dismisses it.
  • The answer is now delivered to the agent inline in the task notification — bounded to 16 KB and XML-escaped inside an <answer> block — instead of only a saved output path. Answered and dismissed outcomes get distinct notification text, and the transcript projection keeps background-question answers grouped with their turn.
  • docs/reference/tools.md documents the background behaviour on AskUserQuestion; two patch changesets included.
  • dist-web manifest restaged in the same commit (packages/transcript is a web build input; only .web-bundle-manifest.json changed).

Verification on this commit: full pre-push gate (597s, all checks passed), agent-core-v2 suite green, typecheck 0, lint 0, leak-check A–G PASS.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 3 included reviews currently available. Your 79 included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 9f3b4fac-a4c9-4ad1-8827-418397e6119a

📥 Commits

Reviewing files that changed from the base of the PR and between 49548fb and d1d880a.

📒 Files selected for processing (15)
  • .changeset/background-question-inline-answer.md
  • .changeset/background-question-survives-turn-end.md
  • apps/pythinker-code/dist-web/.web-bundle-manifest.json
  • docs/reference/tools.md
  • packages/agent-core-v2/src/agent/task/taskService.ts
  • packages/agent-core-v2/src/agent/tools/ask-user-question/askUserQuestionTool.ts
  • packages/agent-core-v2/src/agent/tools/ask-user-question/question-background-task.ts
  • packages/agent-core-v2/src/features/interaction/interaction.ts
  • packages/agent-core-v2/src/session/question/question.ts
  • packages/agent-core-v2/src/session/question/questionService.ts
  • packages/agent-core-v2/test/agent/questionTools/tools/ask-user.test.ts
  • packages/agent-core-v2/test/agent/task/rpc-events.test.ts
  • packages/agent-core-v2/test/session/question/question.test.ts
  • packages/transcript/src/history/groupTurns.ts
  • packages/transcript/test/layers.test.ts

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@pymodel/pythinker-code@09872d7
npx https://pkg.pr.new/@pymodel/pythinker-code@09872d7

commit: 09872d7

Base automatically changed from fix/reconcile-rows-2026-09-10 to main September 15, 2026 00:29
A background AskUserQuestion was bound to the asking turn, so the question was
cancelled the moment the agent finished its turn and the user never got to
answer. Detached requests no longer carry the turn id, and turn-end
cancellation leaves them pending.

The answer now reaches the agent inline in the task notification instead of
only as a saved output path, bounded and xml-escaped.
@elkaix
elkaix force-pushed the fix/reconcile-rows-b-2026-09-10 branch from 09872d7 to d1d880a Compare September 15, 2026 00:30
@elkaix
elkaix merged commit ec99d66 into main Sep 15, 2026
22 of 23 checks passed
@elkaix
elkaix deleted the fix/reconcile-rows-b-2026-09-10 branch September 15, 2026 00:46
elkholy90 pushed a commit that referenced this pull request Sep 15, 2026
## Related Issue

No tracked issue — follow-on to the reconciliation stack (#307 / #308).

## Problem

The minidb cluster suite shares the root vitest shard matrix. Under CI
load, multi-process wait-read cases can time out even when they pass in
isolation, and they slow every shard.

## What changed

- Exclude `packages/minidb` from the root vitest `projects` glob
(`!packages/minidb`).
- Add a dedicated `test-minidb` CI job and require it in the aggregate
`test` gate so coverage stays required.

No product behavior change. No changeset (not user-facing).

## Checklist

- [x] I have read the
[CONTRIBUTING](https://github.com/PyModel/pythinker-code/blob/main/CONTRIBUTING.md)
document.
- [ ] I have linked a related issue (external PRs: the issue must have a
maintainer's `/approve`).
- [x] I have added tests that prove my feature works.
- [x] Ran `gen-changesets` skill, or this PR needs no changeset.
- [x] Ran `gen-docs` skill, or this PR needs no doc update.
elkaix added a commit that referenced this pull request Sep 15, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @pymodel/pythinker-code@2.0.0

### Major Changes

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - Remote Control is always
available — `pythinker rc`, `pythinker web --remote-control` and
`/remote-control` no longer need an experimental flag. Session indexing
and global search move to the new `[database]` section: set
`PYTHINKER_CODE_PERSISTENCE_MINIDB_READMODEL` (was
`PYTHINKER_CODE_EXPERIMENTAL_PERSISTENCE_MINIDB_READMODEL`) and
`PYTHINKER_CODE_SEARCH_WORKER` (was
`PYTHINKER_CODE_EXPERIMENTAL_SEARCH_WORKER`), or `[database] base` and
`[database] search` in `config.toml`.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - The subagent model pool
is always available. Remove
`PYTHINKER_CODE_EXPERIMENTAL_SECONDARY_MODEL` from your environment — it
no longer does anything, and `[secondary_model]` takes effect with no
opt-in.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - Remove the `${now}`
variable from custom system prompt templates. Delete `${now}` from your
`SYSTEM.md` and agent files — the agent still receives the current date.

### Minor Changes

- [#309](#309)
[`3c21d16`](3c21d16)
Thanks [@elkaix](https://github.com/elkaix)! - Add the
`PYTHINKER_CODE_PERMISSION_MODE_REMINDER` environment variable: set it
to a false value or an empty value to stop injecting the auto
permission-mode reminders into the model context.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - The server can now start
and stop Remote Control while it runs, through `GET` and `POST
/api/v1/remote-control`.

### Patch Changes

- [#308](#308)
[`ec99d66`](ec99d66)
Thanks [@elkaix](https://github.com/elkaix)! - Deliver background
question answers to the agent directly instead of via a saved output
file.

- [#308](#308)
[`ec99d66`](ec99d66)
Thanks [@elkaix](https://github.com/elkaix)! - Fix background questions
being cancelled as soon as the agent finishes its turn.

- [#313](#313)
[`09d69fe`](09d69fe)
Thanks [@elkholy90](https://github.com/elkholy90)! - Collapsed tool
cards now show a short outcome row and a width-aware header.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Exclude time spent with
the session closed from goal time budgets.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Preserve image and video
filenames in session history.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Fix print mode
(`pythinker -p`) ignoring the `PYTHINKER_DISABLE_TELEMETRY` environment
variable.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - The Remote Control
banner's Local UI link now carries the server token, so it opens without
a second sign-in.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - Remote Control now gzips
text, JSON, JavaScript, XML and SVG responses over the tunnel.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Remove the 24-hour limit
on goal time budgets.

- [#315](#315)
[`a7666f8`](a7666f8)
Thanks [@elkholy90](https://github.com/elkholy90)! - Skip the
confirmation prompt for rm -rf commands that target only /tmp or /temp
paths.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - Global search now
rebuilds its index instead of staying broken when the stored data is
corrupt or a write keeps failing.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - A background task that
finishes after its agent is closed no longer emits stray task events.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Add `-y, --yes` to
`pythinker upgrade` (alias `pythinker update`) to skip the confirmation
prompt and install the update directly.
## @pymodel/pythinker-desktop@1.0.0

### Major Changes

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - Remote Control is always
available — `pythinker rc`, `pythinker web --remote-control` and
`/remote-control` no longer need an experimental flag. Session indexing
and global search move to the new `[database]` section: set
`PYTHINKER_CODE_PERSISTENCE_MINIDB_READMODEL` (was
`PYTHINKER_CODE_EXPERIMENTAL_PERSISTENCE_MINIDB_READMODEL`) and
`PYTHINKER_CODE_SEARCH_WORKER` (was
`PYTHINKER_CODE_EXPERIMENTAL_SEARCH_WORKER`), or `[database] base` and
`[database] search` in `config.toml`.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - The subagent model pool
is always available. Remove
`PYTHINKER_CODE_EXPERIMENTAL_SECONDARY_MODEL` from your environment — it
no longer does anything, and `[secondary_model]` takes effect with no
opt-in.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - Remove the `${now}`
variable from custom system prompt templates. Delete `${now}` from your
`SYSTEM.md` and agent files — the agent still receives the current date.

### Minor Changes

- [#309](#309)
[`3c21d16`](3c21d16)
Thanks [@elkaix](https://github.com/elkaix)! - Add the
`PYTHINKER_CODE_PERMISSION_MODE_REMINDER` environment variable: set it
to a false value or an empty value to stop injecting the auto
permission-mode reminders into the model context.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - The server can now start
and stop Remote Control while it runs, through `GET` and `POST
/api/v1/remote-control`.

### Patch Changes

- [#308](#308)
[`ec99d66`](ec99d66)
Thanks [@elkaix](https://github.com/elkaix)! - Deliver background
question answers to the agent directly instead of via a saved output
file.

- [#308](#308)
[`ec99d66`](ec99d66)
Thanks [@elkaix](https://github.com/elkaix)! - Fix background questions
being cancelled as soon as the agent finishes its turn.

- [#313](#313)
[`09d69fe`](09d69fe)
Thanks [@elkholy90](https://github.com/elkholy90)! - Collapsed tool
cards now show a short outcome row and a width-aware header.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Exclude time spent with
the session closed from goal time budgets.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Preserve image and video
filenames in session history.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Fix print mode
(`pythinker -p`) ignoring the `PYTHINKER_DISABLE_TELEMETRY` environment
variable.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - The Remote Control
banner's Local UI link now carries the server token, so it opens without
a second sign-in.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - Remote Control now gzips
text, JSON, JavaScript, XML and SVG responses over the tunnel.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Remove the 24-hour limit
on goal time budgets.

- [#315](#315)
[`a7666f8`](a7666f8)
Thanks [@elkholy90](https://github.com/elkholy90)! - Skip the
confirmation prompt for rm -rf commands that target only /tmp or /temp
paths.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - Global search now
rebuilds its index instead of staying broken when the stored data is
corrupt or a write keeps failing.

- [#306](#306)
[`39b50b5`](39b50b5)
Thanks [@elkaix](https://github.com/elkaix)! - A background task that
finishes after its agent is closed no longer emits stray task events.

- [#307](#307)
[`49548fb`](49548fb)
Thanks [@elkaix](https://github.com/elkaix)! - Add `-y, --yes` to
`pythinker upgrade` (alias `pythinker update`) to skip the confirmation
prompt and install the update directly.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mohamed Elkholy <melkholy@techmatrix.com>
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