The 80-character stem limit can still produce a filename longer than 255
bytes when a document name contains CJK characters or emoji. Adding the
upload ID then makes an otherwise valid document name fail on disk.
Retain the character limit and trim only stems that exceed the remaining
byte budget after the ID, separator, and extension. Decode at a character
boundary so the saved name remains valid Unicode.
Add file-write regressions for CJK and emoji document names.
Validation: 38 media and attachment-store tests; Ruff; BasedPyright;
import-boundary checks; git diff --check.
The Developer Manual documents 400/100 as meaning "the API token is
present but not valid" only on endpoints without media. Media methods
share that same status and code with an unknown or expired media id and
with a length cap.
Classifying a 400 from `GET /media/<id>` as an invalid token would stop
the channel because one attachment expired, so media requests now pass
`media_endpoint=True` and the heuristic is skipped for them. A malformed
Authorization header (401/190) is still recognised on every endpoint.
Also corrects the state module docstring: the store keeps the cursor,
dedup window, creator identifier, and delivery receipts, and holds no
token material.
Adds `whatsapp_agent`, an additive channel that connects nanobot to the
official WhatsApp Agent Platform API (https://api.whatsapp.com/agent/v1).
It authenticates with a per-agent API token and long-polls `GET /updates`
instead of linking a device, so it is the officially supported interface
rather than the Neonize linked-device protocol used by the existing
`whatsapp` channel.
The existing `whatsapp` channel is unchanged; both can run at once under
different names.
Design notes:
- The poll cursor, dedup window, and creator identifier live in one
atomically replaced state file. A message id is recorded before it is
handled, so a crash re-reads the batch without answering twice, and the
cursor is only accepted after the batch is processed.
- The first poll omits `offset`, which resolves the head and never replays
up to 30 days of history into an auto-replying agent.
- A changed token resets the cursor, because `next_offset` is only valid
for the agent that issued it.
- Each API method is paced below its own rolling 60-second limit, and
progress/tool-hint messages default to off because they spend the shared
12-per-minute send budget.
- Retries are limited to confirmed non-delivery (`429`, `503`/`131016`).
A `500` or read timeout is ambiguous, so it is not retried unless
`retryAmbiguousSends` is set; a duplicate is worse than a missed reply.
- Inbound media is downloaded through the shared SSRF guard, size-capped,
and verified against the reported digest. Outbound media is validated
before upload.
- Reactions are receive-only, matching the API. The token is never logged
or persisted; state stores only a SHA-256 fingerprint.
Docs compare both WhatsApp channels, including the lack of end-to-end
encryption, country availability, and rate limits.
The settings picker mirrored GET /v1/models without reading shutdown_date,
so retired chat-latest snapshots stayed selectable until a turn failed.
Co-authored-by: Cursor <cursoragent@cursor.com>
Render recovery decisions only for awaiting_user and failed states so a reload cannot resurrect a resuming banner. Preserve the runtime recovery state and normal running controls.
Refs NAN-260
porcelain.diff only exists from dulwich 0.24.0 (0.22.x and 0.23.x have
init/add/commit/status but not diff). On the declared floor every call to
GitStore.diff_commits / show_commit_diff raised GitStoreError, and the
dream line-ending test failed for the same reason. tests/agent/test_git_store.py
and tests/agent/test_dream.py pass with 0.24.0 and the other dependencies
still at their minimum versions.
* fix(webui): wait for sidebar state before persisting edits
* test(webui): load sidebar state in temporary chat fixtures
* fix(webui): preserve sidebar pushes during initial reads
* fix(webui): require successful session reads before pruning
Treat sidebar initialization and session-list completeness as separate permissions. Retain sidebar metadata, workbench panes, activity markers, and workspace overrides when the session list fails or only a partial reload cache is available.
Add integration coverage for recovery with and without cached sessions, successful deletion reconciliation, and successful empty session lists.
* test(webui): align sidebar recovery fixture with current schema
Remove obsolete preview and timestamp settings from the raw API fixture. Assert supported view preferences while retaining exact metadata and workbench comparisons.
---------
Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
* fix(cli): require compatible terminal prompt dependencies
Require prompt-toolkit 3.0.52 for Windows VT100 input flushing and Questionary 2.1.1 for compatibility with its prompt layout. Keep the existing major-version bounds and Python minimum.
* refactor(cli): use Questionary for onboarding selection
Delegate menu navigation, selection and scrolling to questionary.select. Retain the existing back/cancel contract, palette and position feedback through a thin adapter and exercise real prompt keyboard behavior instead of viewport arithmetic.
* fix(webui): resume queued prompts after turn completion
Persist the lifecycle turn each queued prompt waits for and use canonical completion identities to resume after navigation or reconnect. Release one entry at a time, and retain stopped or rejected entries for manual sending.
* fix(webui): drain temporary chat prompts on live completion
* perf(webui): resume queued prompts from live completion
* feat: trace Codex requests via Langfuse native SDK
Codex has no OpenAI SDK client for Langfuse's usual swap trick, so
log one generation per request through langfuse's native SDK
instead. Tracing failures never affect the returned Codex response.
* docs: note Codex Langfuse tracing support
* fix: trace every Codex request, close every generation
- Move the Langfuse generation inside _send so the compaction
sub-request gets its own trace too, not just the main request.
- Derive traced model/input from the wire body (post extra_body
override, post response-item-ID stripping) instead of the
pre-normalized one.
- Wrap package detection in the same try/except as the SDK call, so
a broken find_spec() can't turn a valid Codex request into an error.
- Make generation finalization idempotent and cancellation-safe via
try/except/else/finally, so update() failures or a cancelled
request no longer leave a generation open.
- Add tests for compaction tracing, update() failures, and
cancellation.
* docs: fix cli-reference.md langfuse plugin row
* fix: don't trace a rejected compaction as success
- Add a validate hook to _send so a transport-successful compaction
reply with no usable item traces as an error, not a success.
- Add regression tests for a find_spec() failure, for the traced
model/input matching the actual wire body (extra_body override,
ID-stripped replayed items), and for the rejected-compaction case.
* fix: convert LLMUsage to dict for Langfuse usage_details
LLMResponse.usage is now the LLMUsage dataclass upstream, not a
plain dict - Langfuse's usage_details param needs the latter.
* fix: satisfy basedpyright strict on compaction items
* fix(providers): normalize Codex Langfuse cache usage
* fix(providers): migrate Langfuse tracing to SDK 4
---------
Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
SPT_NOENV only keeps the title out of /proc/PID/environ on Linux. On macOS
it confines the title to the argv area, where setproctitle drops the last
byte, and its import-time getproctitle() then fails to decode a command
line ending in a multibyte character, so every such CLI call crashed.
Fixes#6231