Skip to content

[AIPROFVIS-898] Bug Fixes and Improvements - #1205

Open
Sajeeth-Wimalasuriyan wants to merge 35 commits into
mainfrom
sw-fable-review
Open

Sajeeth-Wimalasuriyan wants to merge 35 commits into
mainfrom
sw-fable-review

Conversation

@Sajeeth-Wimalasuriyan

@Sajeeth-Wimalasuriyan Sajeeth-Wimalasuriyan commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Hardening and accuracy fixes for Ask Optiq:

  • The API key is bound to the endpoint it was saved for, and kept out of everything the model reads or returns.

  • Scripts the assistant offers are harder to run by accident.

  • A Stop button ends a running answer without clearing the conversation.

  • The data tools say which window, tracks and rows each result covers, so the model stops reporting a partial read as the whole trace.

  • New unit tests cover key redaction and URL handling.

  • SettingsManager cleans saved assistant URLs in every build, so even a build without the assistant rewrites a settings file that held a key in a URL. The filter, AssistantStorableUrl, moves to the new rocprofvis_assistant_url.cpp so roc-optiq-assistant-tests can cover it.

  • Core::String gains header-only UTF-8 boundary helpers (utf8_floor, utf8_ceil, is_utf8_continuation).

  • BeginPanelCard now returns false when the card is clipped.

  • SecretStore (shared with remote) zeroes the Windows credential blob before CredFree.

Technical Details

API key and endpoint

  • A stored key is saved with its endpoint's origin, and only handed out while the URL still points there. The check runs on every read, so it also holds when the URL changes outside Preferences, for example in a hand-edited settings file. A key saved by an older build is bound on first use, and isn't used if that binding can't be written.
  • When the host changes in Preferences, the page says the stored key belongs to the previous host before OK removes it ([AIPROFVIS-892] Add model discovery to Ask Optiq. #1214), and a toast confirms the removal afterwards.
  • The settings file never keeps credentials, a fragment, or query parameters other than api-version in the endpoint URL. A file that already holds one is cleaned and rewritten at load. Hover cards show the URL without userinfo, query or fragment.
  • The key is blanked from everything sent to the model (the question, tool replies, tool-call arguments) and from everything that comes back (reply, tool calls, error text). The app's own copies of the key are wiped after use; cpp-httplib's internal copies are not.
  • If the credential store refuses a write, the key is kept for this session only and a toast says so. A failed removal is reported too. Preferences warns about plain http to a non-loopback host and about URL parts that will be stripped, and it queries the store once per dialog open instead of every frame.

Transport

  • Stricter URL checks, for chat requests and the /models lookup alike:
    • the scheme must be http or https, in either letter case
    • URLs with credentials and malformed origins are refused
    • Azure endpoints are detected from the path only
  • One cancellable retry for HTTP 429/502/503/504 (a numeric Retry-After is honoured, capped at 10 s), and for a request whose upload failed within 10 s. A request that went out isn't retried, since the endpoint may already be running it; this also keeps a reply over the 8 MB cap from being fetched twice. The read timeout goes from 120 s to 300 s, since replies aren't streamed.
  • A cancel that arrives before the request is under way now stops it, instead of letting it run to the read timeout.
  • A peer resetting the connection mid-write no longer kills the app with SIGPIPE, for chat requests or the /models lookup. The request thread blocks the signal on Linux, and sockets set SO_NOSIGPIPE on macOS. Nothing is process-wide, so profiler child processes are unaffected.
  • Provider error text leads with the HTTP status, and the key is blanked before the 500-byte cap cuts the text, so part of a key can't survive at the cut. The /models list drops any model name that contains the key. "arguments": null and "error": null are accepted, and to= inside a word, flag or URL is no longer read as an inline tool call.

Turn loop and panel

  • Stop replaces Send while a turn runs. It ends the turn but keeps the conversation: unanswered tool calls get a "stopped" reply, and the history records that the user stopped the turn.
  • A table, metric or statistics read that the turn started is cancelled when it outlives its deadline, so the next read doesn't queue behind it. Stop cancels the turn's own reads, as Clear does.
  • A batch made only of UI actions that did exactly what was asked, plus offer_next_steps, skips the discarded draft round, saving an HTTP round. The summary preload now waits at most 10 s.
  • A read waits for a UI table load of the same type instead of failing. It runs again, inside the same deadline, when its sort column came from a stale header or a selection or range change voided its event details or track statistics.
  • The write-up nudge is removed from history after each turn. Compaction shortens large tool replies before small ones. An answer cut off at the output limit is flagged.
  • Rendering: the activity chart is recomputed only when its bin count changes, not every frame. Clipped messages skip text layout, clicking a next step keeps the typed draft, and numpad Enter sends.

Tools

  • Table reads lead with the window they covered (in raw ns, and where it came from), and say when a track cap or the selection narrowed them. Rows are numbered by position in the whole result, footers name the next offset, and wide rows stop on a whole row.
  • A failed read says so instead of formatting the previous call's rows. sort_by is checked against the columns that came back, grouped reads sort by the group column, and track_samples defaults to time order.
  • goto keeps ranges inside the trace, and frames an event from rows already read or its loaded details when no window is given. It drops its zoom argument and ZoomToRange is removed, since goto already frames the view.
  • event_details works without track_id, and tells an unknown uuid apart from details cleared by a selection change. get_summary and the briefing tell "loaded but empty" apart from "not loaded yet".
  • annotate is capped at five notes per turn, with title and text limits. Next-step buttons show exactly the text a click sends.
  • Smaller changes:
    • list_tracks, search_events and event_details say what they left out.
    • track_ids must be an array.
    • __uuid is refused as a filter or group_by column, since the table compares and groups through a double that can't hold it exactly.
    • show_panel refuses the summary on compare tabs.
    • "overview" now means the Timeline Overview strip.
  • Compute: an unknown workload_id returns the workload list, list_kernels pages on whole rows, metric reads can be cancelled, and kernel_triage names standard tables that returned nothing.
  • Prompt and schema: tool output is declared to be data, not instructions. Arguments the tools ignore are no longer advertised.

Scripts offered by Ask Optiq

  • The offered source is read-only until the user presses Run or Reject. Run ignores clicks for one second after the offer appears, and ignores any press that began before it appeared.
  • No offer replaces unsaved work in the Script tab, and a declined or unanswered offer is the last one that turn. An unanswered offer is marked declined, so it never reads as the user's own. Stopping an approved run is reported as the user's decision, and pressing Run restarts the deadline.
  • Save writes the text as it was when Save was pressed, so an offer that arrives while the dialog is open isn't saved under the user's file name. Loading a file over a pending offer declines it.
  • The approval banner says the script runs with the user's permissions.

Tests

  • roc-optiq-assistant-client-tests adds cases for:
    • key redaction, both directly and against an endpoint that echoes the key
    • cleartext detection
    • the inline to= rule
    • a too-large reply being requested only once
    • a long error cut on a character boundary
    • the /models lookup: names containing the key are dropped, and an upper-case scheme is accepted
  • roc-optiq-assistant-tests covers AssistantStorableUrl.

Docs

  • .agents/UI.md and .agents/SCRIPTING.md are updated to match, including how the per-read key check and the clear at OK fit together. Two known gaps this PR closes are removed from SCRIPTING.md.

Overlap with main

The latest main is merged in. Where its Ask Optiq PRs overlapped this one:

Not in this PR

Earlier commits on this branch describe these, but they were reverted or removed and aren't part of the diff:

  • The TableProcessor fix for duplicated sample rows after the track set changes (added in a586b4e3, reverted in 92893d17). It will follow separately.
  • Python runtime proxy modules, and owner-only config and log directories (reverted in d573daee).
  • The Ask Optiq end-to-end tests with golden tool outputs, and the PackedTable sort tie-break they needed (removed in 772fb96c).

A planned follow-up stores each key in its own credential-store entry per endpoint and origin, which replaces both key layers.

Testing

  • Builds clean on Linux (GCC, Debug) in three configurations: assistant and scripting, assistant without scripting, and scripting without assistant. No new warnings.
  • roc-optiq-assistant-tests: 103 assertions in 19 test cases, passing in all three configurations.
  • roc-optiq-assistant-client-tests: 80 assertions in 18 test cases, passing in both assistant configurations.
  • UI suite (roc-optiq-tests --run-tests) on a system trace and a compute trace: 48 tests each, none failed, and both Ask Optiq cases pass.
  • Experimental CI on this branch (enable_ci_experimental). Regular PR CI doesn't build the assistant, and Windows and macOS haven't been built yet.
  • Manual: <endpoint and model used, scenarios exercised>

Answer quality
- sort_by is checked against the header that landed and the read re-runs
  once when the guessed column index was wrong (first call of a session,
  or after a layout change).
- Table reads lead with the window and tracks they covered, and say when
  the selection (often the model's own goto) or the 32-track cap narrowed
  them.
- A failed table read is reported as failed instead of being formatted
  from the previous call's rows.
- event_details works without a track_id.
- goto rejects a range outside the trace; events[] accepts __trackId.
- Schema and prompt no longer advertise arguments tools ignore (group_by
  and track_ids on some tools, zoom on goto); __uuid is refused as a
  filter column since it compares through a double.
- The tools-off write-up nudge is dropped from history after each turn;
  the briefing is re-sent if trimming dropped it; compaction removes large
  replies before the small overview/summary ones.
- A truncated answer (finish_reason=length) is flagged in the panel.

Speed and reliability
- A batch that is a lone offer_next_steps goes straight to the tools-off
  answer round, saving one full HTTP round per answered turn.
- One cancellable retry on 429/502/503/504 or a fast connection drop;
  read timeout raised to 300 s since replies are not streamed.
- Table tools wait when the UI holds the same controller table type
  instead of failing with "Could not queue"; track_statistics re-runs
  (capped) when a range change drops its result.
- Azure detection reads the URL path only; error text leads with the HTTP
  status; a host merely starting with "127." is not loopback.

Panel and UI
- Long waits no longer pin the transcript to the bottom and keep the
  tool's own status text.
- Clearing a turn withdraws a pending script offer; stopping an approved
  script is reported as a rejection, not a failure.
- switch_tab reaches a second trace with the same file name.
- Next-step clicks keep the typed draft; numpad Enter sends.
- Clipped messages and charts skip per-frame layout; the settings page no
  longer reads the credential store every frame, and a failed store write
  keeps the key for the session.
Key storage and use
- The stored key is bound to the endpoint origin (stored as
  "<origin>\n<key>"); a key saved for one host is not sent to another, and
  the settings page removes it on OK when the host changes. A legacy value
  with no origin is adopted on first read. Default ports compare equal.
- The endpoint and key are snapshotted once per turn, so URL edits in
  Preferences cannot redirect a turn already in flight; the snapshot's key
  bytes are wiped when the turn ends, and the typed draft is wiped on
  discard.
- A failed credential-store erase is reported instead of ignored.
- Settings page warns on plain http to a non-loopback host and on a URL
  that carries userinfo or a query string (a key pasted into the URL is
  saved in clear text).

Transport and error text
- The scheme is lower-cased and must be http or https, and malformed
  origins or URLs with userinfo are refused before anything is logged, so
  the key gate and cpp-httplib agree on what is being contacted.
- Provider error text has the key redacted and is capped at 400 bytes;
  the 404 "Requested <url>" hint is appended after the cap.
- The insecure-URL error no longer suggests clearing the key.

Model and scripts
- Trace-derived text is declared data, not instructions; switch_tab to
  another trace needs the user to have asked, and annotate is capped per
  turn.
- A script offer that times out or is withdrawn reads as declined, no
  further offer is accepted in that turn, the source is read-only while an
  offer is pending, and the user's own draft is not overwritten. The
  approval banner says the script runs with the user's permissions.
- Scripts receive proxy modules exposing only public, non-module
  attributes rather than the real stdlib module objects.

Files
- On Linux and macOS the config and log directories are owner-only, and
  HOME falls back to the account database before the working directory.
- A peer that resets the connection while a request is still being
  written no longer ends the app with SIGPIPE. The client's sockets set
  SO_NOSIGPIPE on macOS, and on Linux the request's thread blocks
  SIGPIPE and drops any it raised. The failed write is retried once and
  then reported like any other dropped connection. This stays inside
  the client rather than ignoring SIGPIPE process-wide, which the
  profiler's fork()/execvp() children would inherit.
- Stop and Clear no longer stall the UI while a connect is in progress.
  cpp-httplib holds the socket until the connect finishes, up to the
  15 s connect timeout, so Cancel() waits for it. CancelPendingRequest
  now hands the cancel and the wait to a thread of their own; Update()
  lets go of it and the destructor waits for it.
- When the trim drops the exchange that carried the briefing, the live
  question takes a fresh one, so no request goes out without a briefing.
- A track read refused because the UI is loading a table of the same
  controller type parks on that table instead of re-running every frame.
- The tracks: line no longer claims a narrowing when the selection holds
  every track with the operation, and says how many tracks it left out.
- goto says when it dropped a range outside the trace instead of "no
  window was given", and gives the trace's extent as raw window_ns.
- Add the ask_optiq UI tests (34 cases) against an in-process scripted
  OpenAI-compatible endpoint: turn flow, transport faults, data and UI
  tools, scripting and compute.
- Pin every tool's reply on both sample traces under
  src/app/test/golden/ask_optiq. Each set runs twice, so output that
  changes between runs fails. ROCPROFVIS_UPDATE_GOLDEN=1 rewrites them.
- roc-optiq-tests: add --test-filter to run a subset.
- Fix sample reads returning duplicated rows after the track set
  changed: TableProcessor kept the merged rows of tracks it re-fetched.
- track_samples defaults to time order. It sorted on the node column,
  which is the same on every row, so row order was arbitrary.
- event_details on an unknown uuid says so, instead of describing an
  event with nothing recorded.
- Send(): the SIGPIPE block is declared before the httplib client, so it
  also covers the client's destructor, which can write a TLS
  close_notify. Correct the retry-wait comment: the panel no longer
  blocks on the worker when it abandons a request.
- goto: a window derived from the named events is held to the trace like
  one the model passed, so an entry with no times cannot store a
  selection outside it.
- event_details: the empty entry FetchEvent records for an unknown uuid
  is removed again unless it is selected, so a later goto does not read
  it as an event at time zero.
- Tests: ask_optiq_mock_endpoint.cpp gets /bigobj on MSVC, like the
  other file that includes httplib.h. Seven tests that read the tool
  reply only when a second request was sent now assert that it was, so
  a short turn fails instead of passing with nothing checked.
These change tool output, so the goldens under
src/app/test/golden/ask_optiq/system must be regenerated with
ROCPROFVIS_UPDATE_GOLDEN=1 and the diff reviewed.

- PackedTable::SortByColumn breaks ties on the row index. The sort is
  std::sort with a key-only comparator, parallel on Linux and Windows
  and sequential on macOS, so which tied rows surfaced and in what order
  depended on the standard library and the core count. Goldens that
  printed tied rows (track_samples_highest, track_events_every_track)
  would fail on another platform with no product change. This is shared
  model code: tied rows in the UI tables now keep row order too.
- A grouped track read defaults to its group column. It was sent the
  index of "id" or "start" resolved against the previous read's
  ungrouped header, which names a different column of the grouped
  result, and the landed-header check could not correct it because
  neither name is in a grouped header. The order depended on what ran
  before.
- track_samples_gfx_busy reads 14 rows, so its golden shows several
  timestamps and pins the time-order default.
Drops the ask_optiq UI tests, the mock endpoint, the golden tool outputs,
the --test-filter option and the test-peer hooks, so the branch carries
only the product changes. The sort tie-break in PackedTable goes with
them: it existed to make the goldens portable.
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Security scan found no critical or high findings on lines changed by this pull request

View the security scan run for complete reports.

“New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta.

Behaviour is unchanged; the diff against main is about 650 lines smaller.

- Client: the retry is post, maybe wait, post once more, with one helper
  deciding the wait; dead userinfo stripping removed; restored lines that
  were only reformatted.
- Panel: the three "run the tool again" paths in PollToolFetch are one;
  NeedsBriefing and BeginFinalAnswer are back to main's text, with the
  trimmed-briefing restore covering the gap; single-use helpers inlined.
- Tools: the four table tools share one tail in FetchStartedResult;
  goto's two trace clamps are one helper; per-turn UI state is two
  values rather than a struct with a tracked flag.
- Settings: one pack/unpack for the stored "<origin>\n<key>" value used
  by both the credential store and the session copy.
- Comments the branch added are cut to a line or two.
- Docs and the table-processor fix are reverted to main: this branch is
  the Ask Optiq code only.
The Python runtime module proxies with their docs, and the owner-only
config directory in rocprofvis_utils, are outside the Ask Optiq harness.
The branch now changes only src/view.
…tool's own result.

A drawn track can replace a track_statistics request under the same id, and opening a script over a pending offer left Run executing that file.
main's per-trace conversations and pinned turns replace this branch's tab-change handling, so the branch's fixes are carried onto that design.

- Dropped as superseded: abandoning a batch when the tab changes, the switch_tab wait and its user-asked gate, the same-label tab advance, the trimmed-briefing restore, and the branch's own off-thread cancel.
- Kept: the per-turn endpoint and key snapshot, retry and SIGPIPE handling, the sort and statistics re-runs, the shared-table wait, the script approval rules, and the note cap.
- Reconciled with the whitespace trimming on main: a stored key with a trailing newline still reads as a key under origin binding, the error scrub looks for the trimmed key, and the stored origin is taken from the trimmed URL.
… misreporting.

- Stop takes Send's place while a turn runs on the conversation on screen. It ends the turn and keeps the conversation. Calls that never finished are answered first, so the history stays one the endpoint accepts.
- goto names the event it selected and no longer says its details are loaded, which it cannot know for a uuid the trace lacks.
- track_statistics hands the shared slot back to the track's pill after reading another window, and when its read is cancelled, so the pill neither shows the assistant's window nor stays blank.
- A turn that ends while a script the user approved is running no longer marks it as not run.
…out of what the model reads.

A key pasted into the endpoint URL was shown by the header and context-pill hover cards and written to the settings file. AssistantStorableUrl now drops userinfo, a fragment and every query parameter but an API version when the file is read (and rewrites it), when OK is pressed, and when it is written; the hover cards show the URL without its query.

Tool replies were logged at debug level and kept in the history unscrubbed, so a script the user approved could print the key into the log and to the provider. AssistantRedactKey blanks the turn's key in every tool reply before it is logged or kept, in every message as the client serializes it, and in the reply and tool calls an endpoint sends back. A key pasted into the question is blanked before the question is shown or kept, so it does not reach the transcript, an export or the clipboard.

The client wipes its own header and trimmed copies of the key, the one-time legacy migration wipes the two copies it reads, SecretStore::Get zeroes the Windows credential buffer before freeing it, and the two identical wipe helpers are one.

The Run button keeps its id when an offer replaces the script under it, so a click begun on the user's own script could run one nobody had read: Run is now disabled for a moment after an offer first draws. A next step is sent as the user's own message, so the ## that hides part of a button label is removed from it. switch_tab no longer risks quoting a tab's path back.
…ree a slot a timed-out query held.

A paged table read counted the rows not shown from the page alone, so a read with an offset was told that rows it had already seen were still to come and the last page looked unfinished. Rows are now numbered by their place in the result and the footer names the slice and the next offset. Wide rows reach the size cap before the row limit, and the trim then cut the last row in half and the footer off; the rows now stop on a whole row and the footer says where to carry on.

A change of selection clears the whole event model, so a goto earlier in the same batch, or a click, made event_details report a valid uuid as one the trace lacks. The panel now runs the read again when the entry was cleared under it, and the reply for a cleared entry no longer blames the uuid.

goto frames an event from its own span when no window is given, using the rows the assistant read and the details it loaded, and says the details will load when one of those vouches for the uuid. An entry a wrong uuid left empty can no longer stretch the window back to time zero.

A table query that outlives its deadline is cancelled, so the narrower retry does not queue behind it. A PC-sampling layer that lands late is reported as a long read, not a busy slot. A briefing built before the summary loads prints no zero totals. event_details says when it cut a list, list_tracks how many tracks it left out, and search_events when it dropped terms.
…nd stop recutting the activity chart every frame.

The model offers next steps as its last tool. When it did so alone the turn went straight to the tools-off write-up, but batched with the goto and flow_arrows that point at the evidence it paid for a tools-on round whose prose is thrown away. UI tools now mark an action carried out exactly as asked, and a batch of those plus an offer goes straight to the write-up too. A batch that read data, or in which an action missed, still gets its round, so nothing the model could act on is skipped.

The summary preload held the question until the summary landed, up to the full fetch deadline. It now waits ten seconds; get_summary parks on the same request, so the first round overlaps a slow summary.

The activity strip summed every track's minimap row twice on every frame it was on screen. The minimap does not change after load, so the strip is kept on its chat line until the bin count changes.

A metric read owns its request, so Stop, Clear and a timeout cancel it instead of leaving the next one queued behind it.
HandleHttpResult handled a cancelled result, but a cancelled call is moved to m_abandoned before Cancel and reaped there, and the destructor never hands a result on. The branch goes, and so does the cancelled flag nothing else read. AbandonPendingRequest cancelled a call that had no future, which cannot exist: the two are set and cleared together.

The fallback text for an empty final reply could not be reached, because the client turns a reply with neither prose nor tool calls into an error. SendCurrentInput reset turn state that ResetTurn has already cleared on every way a turn ends. get_summary and compare_traces re-checked for a pending summary request they had ruled out a few lines earlier.

SCRIPTING.md gave the fetch deadline as 45 seconds and described a front-tab check in Run that does not exist.
… do.

The prompt limited sort_by to the filter whitelist, but a sort resolves against the columns the result prints, so top_events could not be told to sort by Invocations or DurationMax. get_summary's description sent the model to it when the briefing's totals were 0; the briefing now says the summary is not loaded instead of printing zeroes. goto's start_ns promised the event's own span whenever it was omitted; it is used when the event came from the rows read last or from event_details, which is what the tool can look up.

The system prompt also says offer_next_steps can go in the same batch as the last goto, which is the batch the turn loop now takes straight to the write-up.
…drawn.

Run is disabled for a moment after an offer first draws, which drops a press in progress only while the pointer is over the button. A press begun on the user's own script, dragged off the button and held past that moment could still be let go on Run and start a script nobody had read. The press's start time is now checked against the time the offer was first drawn. Keyboard activation is untouched: it fires on a new key press, which the disabled moment already covers.
…timed-out read report.

A summary that loaded with nothing in it was described by the briefing as not loaded yet, and get_summary fetched it again on every call and then said it could not be loaded. Both now say it loaded and is empty, and the preload no longer runs for it.

goto told the model to pass an event's start and end from its row when the event has no duration, which gives a window of no width and the same reply again. It now says such an event needs a window either side of it. goto counts as carried out only when every event named was marked, and flow_arrows only when an event is selected for the arrows to draw from, so a batch that missed still gets its round; flow_arrows no longer tells the model to call goto when an event is already selected.

A track_statistics read that outlives its deadline is cancelled like the table reads, so its numbers cannot land later as the track pill's for another window. A chart of a linked trace is cut again after that trace is closed and reopened, instead of drawing the strip kept from the old one.
CODING.md asks for a comment of one or two lines, and only where the reason is not obvious. Thirty of the comments added on this branch since 1f392be ran three to five. They are cut to two, and three that had gone out of date are corrected: m_force_final is set for every write-up round, not only when the tool budget runs out; a turn may cancel its own requests on a timeout as well as when it ends; and UI.md named ZoomToRange, which this branch removed. No code changes.
…n unbound key off an edited URL.

The Script tab's Save dialog runs alongside the frame loop, so a script Ask Optiq offered while it was open replaced the editor's text, and confirming the dialog wrote that unreviewed script under the name the user had picked for their own and showed the path as its source. Opened later, it would run as the user's own. Save now writes the text as it was when Save was pressed, and takes the path and saved state only if the editor still holds that text.

A key saved before keys were bound to an origin is bound to the URL's origin on its first read. When the credential store refused that write the key was still handed out, and if the store then also refused the erase that an origin change on OK asks for, the next read bound the old key to the new host and sent it there. A key whose binding cannot be kept is no longer used.

SCRIPTING.md drops two known gaps this branch already closed: a stopped run is reported as the user's decision, and an offer no longer replaces an unsaved draft.
…, and give an approved script its own deadline.

Cancel() stops a request by closing its socket, but between Adopt and httplib starting the request there is no socket yet, and stop() then leaves nothing behind: the POST ran to its 300-second read timeout, and quitting in that window waited for it. Both posts now pass an upload-progress callback that ends the body write once Cancel() has been called, so the request gives up after the connect at most.

A script offer waits up to 300 seconds for the user, and the run they approve waited under the same deadline, so a script approved near the end of the reading time was reported to the model as still running seconds after it started, and the answer was written without its result. Pressing Run now starts the deadline again, and the status line says the script is running.
…e loop that did it.

TrimAssistantText cut a long result at a byte count, which can split a UTF-8 character in an event or kernel name, and the model then read a replacement character in its place. It now backs up to the start of the character, as TrimNoteText already did with its own copy of the loop. TrimNoteText becomes a call to it.
@trangvu-amd trangvu-amd changed the title Bug Fixes and Improvements [AIPROFVIS-898] Bug Fixes and Improvements Nov 25, 2026
Conflicts in the assistant panel, the client, the settings page and UI.md,
resolved as follows.

Turn pinning: main (#1214) and this branch both pin the turn's endpoint,
model and key. One set of members is kept, under main's names, with this
branch's wipe when the turn ends and its redaction of the key from the
question and the tool replies. A tool re-run still does not scroll the
transcript, and is logged once (#1191).

Key storage: this branch's origin-bound storage merged without conflicts and
is kept, with #1214's check at OK on top: a host change clears the old key
first, and the URL change is refused if that fails. This branch's own clear on
a host change gives way to it. ASSISTANT_KEY_STORAGE_PLAN.md replaces both
layers in a follow-up.

Error text: #1195 cut the provider's text in ErrorText, before this branch
blanks the key, so a key straddling the cut would have survived as a prefix.
ErrorText now returns the text uncut, and ScrubErrorText blanks the key and
then calls ClampErrorText. One limit remains, main's 500 bytes, with #1194's
wording.

Client: main's IsIpv4Loopback replaces this branch's 127.x check. AuthHeaders
takes the token, as #1214's model list needs, and keeps this branch's trim and
wipe. The 300 s read timeout and the retry stay.

UI.md: the key rule describes both layers.
#1214's model lookup sends the key from a worker of its own, and none of the
client's protections reached it. Its URL now goes through NormalizeOrigin,
split out of ResolveEndpoint: the scheme is lower-cased and must be http or
https, a URL with userinfo is refused before anything is logged or looked
up, and an origin cpp-httplib would misread is refused. Without the
lower-casing an HTTP:// URL listed nothing, because cpp-httplib only parses
a lower-case scheme.

The lookup's thread blocks SIGPIPE on Linux, and its sockets set
SO_NOSIGPIPE on macOS, as Send does, so a reset during the request cannot
end the app. A listed name that quotes the key is dropped: picking it would
show the key and save it in the settings file.

Tests cover the dropped name and the upper-case scheme.
A dropped connection was retried whenever it failed within ten seconds. But
httplib reports any failure after the request is written - a reply that broke
off, a connection the endpoint closed, or a reply past the 8 MB cap #1195
added - as a read error, and by then the endpoint may already be running the
request. An oversized reply was fetched twice. Only a write that failed
straight away is retried now; throttles and gateway errors are unchanged.

A test checks that an oversized reply is asked for once.
The table filters and groups through a double, which cannot hold a 64-bit
uuid exactly, so neighbouring events would match or merge into one row.
__uuid was refused for filters but still on the column whitelist, so
group_by accepted it, and the "Allowed columns" error and the system prompt
both offered it. It is now off the list and refused for both before the
list is checked. The list's comment no longer says sort_by uses it.
Clearing is no longer the only way to stop a turn now that Stop exists,
Cancel() can block for the DNS lookup, the connect and the TLS handshake
rather than one timeout, and TracksFromArgs says why it reports an error
instead of describing what it used to do.
…URL saving.

AssistantRedactKey, AssistantUrlIsCleartext and the inline to= rule are tested
in the client tests, the redaction both directly and against an endpoint that
echoes the key. AssistantStorableUrl moves unchanged to its own
rocprofvis_assistant_url.cpp, still in every build, so roc-optiq-assistant-tests
can cover it.
MSVC rejects a local constexpr used in a lambda that does not capture
it, so roc-optiq-assistant-client-tests did not compile on Windows. The
constant is static now.

The header passed the context pill the URL as shown, with its query cut,
and the pill matches the model list against the full URL. An endpoint
saved with ?api-version= lost its model picker. The pill gets the full
URL again, and only the text it shows is cut.

The .gitleaksignore fingerprints name the commit that added the two test
fixtures, which a squash merge replaces. Both lines now also carry
gitleaks:allow.

goto counted as carried out as asked for a uuid nothing vouched for, and
calls skipped after switch_tab left their batch settled. Either one
skipped the round in which the model could still correct itself.

The settings page decided a host change with another test than OK uses,
so it could say a key would be kept that OK then removed. It uses OK's
test now.

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch was previously deployed

1 inactive deployment
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