Skip to content

feat(host,desktop,build): save a launch panic to disk, title chats from plain text - #1322

Merged
huichen merged 7 commits into
mainfrom
pr/dev-huichen
Oct 23, 2026
Merged

huichen merged 7 commits into
mainfrom
pr/dev-huichen

Conversation

@huichen

@huichen huichen commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Four commits from dev-huichen, each already verified on its own task branch. The theme: make two "the process just vanished" incidents from tonight diagnosable, and stop a conversation from being named after its message's markdown source.

Crash evidence for a windowless launch

futureos.exe once disappeared mid-launch with nothing recorded — no WARN/ERROR, no crash dump, no Windows event-log entry. A Rust panic in a GUI build has no console, so its text went to a stderr nobody sees. host/src/crash_log.rs installs a std::panic::set_hook that appends message, location and backtrace to ~/.future/app/logs/desktop.panic.log before forwarding to the default hook, so the next launch can say what killed the previous one. The hook is installed unconditionally at process preparation rather than at a later startup stage, because the launch that panics may die before that stage runs.

Previous log tail and timestamps

host/src/environment.rs moves the previous run's log to desktop.prev.log before opening the current one, and report() now stamps its output with UTC time on both the log and stderr. Without a timestamp, two launches wrote adjacent lines that read like one launch starting twice.

Conversation titles from plain text

A new conversation's placeholder title truncated the first message's raw markdown, so a session reference [label](futureos://session/<id>) landed in the title as brackets plus URL. @future-os/markdown gains plainTitleText(), mirroring the Rust future_rpc::title::plain_title_text: references contribute nothing, links keep their label, images keep their alt text, whitespace collapses. deriveThreadTitle passes the message through it before truncating.

Local build profile and a screenshot assertion

[profile.local] inherits release with lto = false and incremental = true: editing one line of future-cli and rebuilding --release spends most of its ~137 s in whole-graph ThinLTO. Nothing selects the profile implicitly — cargo build --release, make build and CI keep using release. The screenshot harness now asserts the machine mark actually rendered instead of probing for an emoji.

Commits

  • feat(host): record a panicking launch in a crash log (d2b27027b)
  • fix(desktop): name a new conversation from plain text, not reference markdown (9cef8cfcf)
  • build(cargo): add an LTO-free local profile for fast iteration (464b75bda)
  • fix(screenshots): check the machine mark rendered, not for an emoji (0ec5fa9b6)

Verification

Local, at the tip of this branch (d92578d3b, rustc 1.97.0):

  • cargo fmt --all -- --check — clean
  • cargo clippy -p future-host --all-targets -- -D warnings — clean
  • cargo test -p future-host --lib -- crash_log environment startup — 32 passed, 0 failed
  • npx vitest run src/components/layout/hooks/flows.test.tsx (desktop) — 32 passed
  • npx vitest run --config ../packages/markdown/vitest.config.ts (from desktop/) — 22 files, 615 tests passed

CI at this head: every reported context green (Rust on Linux, Windows, macOS; TypeScript check and test for desktop, mobile and @future-os/markdown) as of the last poll; the mobile and Windows tui-cli/host-remote jobs were still running.

Notes

  • New files under ~/.future/app/logs/: desktop.panic.log (appended per panic) and desktop.prev.log (the previous run's log, replacing it each launch).
  • [profile.local] is opt-in only; no build path selects it implicitly.
  • No .github/workflows/** change.

huichen and others added 5 commits October 23, 2026 20:35
`capture-mobile chat` had been failing with "the badge carries no glyph" since
#1314 replaced the emoji machine marks with the shared icon component
(`PeerIconGlyph`). The assertion looked for `💻` in the badge's text, which is
where an emoji would have been — the picture changed, the check kept reading
text. The same assertion in `capture-desktop remote-conversation` looked for
`💻` too and was still passing only by accident: the desktop badge's emoji had
already become an icon, so it was one glyph away from the same failure.

Both now check the fact the assertion was ever about: that the mark rendered.
The badge must contain an `<svg>` at least 8x8 carrying at least one shape. That
still fails when the icon stops drawing — verified by removing it, which turns
both captures red ("draws no machine icon") — and no longer cares whether the
mark is an emoji, a line icon, or something else later.

The two spots are the only glyph lookups in the scenario table; the remaining
single-character assertions all match real copy (中 / 你 / 接管 / 本机 / …), so
nothing else changed. `scripts/screenshots/scenarios.json` is the only file,
two lines replaced.

Not in scope, for the record: the shot scripts run in no workflow, which is why
this assertion could rot from #1314 until now with nothing noticing. Whether to
put them in CI is a cost decision for the product side, not something this
change should slip in.
A Windows GUI launch has no console, so a panic prints to a stderr nobody
reads and exits 101 — a code Windows Error Reporting does not record, which
is why the 2026-10-23 failed restart left no event-log entry and no dump.
Append the panic (time, thread, file:line, payload, startup step) to
<future home>/app/logs/crash.log, which is never trimmed, so a later launch
can say what killed the earlier one.

Also report each startup step as it is entered: the stall watchdog only
speaks after 20s, so a launch that dies sooner left no step name at all.
…markdown

The placeholder title the Desktop mints for a fresh conversation was cut from
the composer's raw markdown source, so a first message carrying a picked
conversation read as '[关闭应用未清理锁文件](futureos:...' in the sidebar --
brackets and a URL instead of a topic.

Add plainTitleText to @future-os/markdown, the TypeScript sibling of
uture_rpc::title::plain_title_text which the Agent, the host prompt path and
the importer already apply: a conversation reference contributes nothing (its
label is the *other* conversation's name), any other link contributes its
label, an image its alt text, whitespace collapses to one line, and a message
that is nothing but a reference keeps the label it points at. Derive the seed
title through it.
@huichen
huichen enabled auto-merge (squash) October 23, 2026 13:47
[profile.release] sets `lto = "thin"`, so every edit re-runs whole-graph
ThinLTO even when a single crate changed. Measured on this 20-thread Windows
machine, touching one line of `future-cli` and rebuilding `--release` takes
~137 s, of which the linker accounts for ~1.5 s (which is why swapping in LLD
gains almost nothing). The same edit with LTO off and the incremental cache
reused takes 2.8-3.6 s, after one 236 s cold build.

[profile.local] inherits `release`, so it stays optimised, but sets
`lto = false`, `incremental = true`, `debug = 0` and `strip = false`.

This is a local-iteration profile, not a release profile: nothing selects it
implicitly, and `cargo build --release`, `make build` and CI keep building the
unchanged `release` profile, so shipped binaries cannot drift from it. Use it
with `cargo build --profile local -p future-cli`.
@huichen huichen changed the title batch(dev): record a panicking launch, keep the log tail, and name conversations from plain text feat(host,desktop,build): save a launch panic to disk, title chats from plain text Oct 23, 2026
@huichen
huichen merged commit d59f39c into main Oct 23, 2026
37 checks passed
@huichen
huichen deleted the pr/dev-huichen branch October 23, 2026 14:19
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