Skip to content

ABI: reconstruct async Error stacks from Promise await chains #254

Description

@chrisbbreuer

Parent: #140
Profiles: #163, #164
Roadmap: #134

Implement Bun__attachAsyncStackFromPromise from the pinned upstream algorithm, including the runtime metadata it depends on.

Acceptance:

  • Track pending Promise reaction links to suspended async-function/generator activations without retaining completed activations.
  • Retain each suspension's exact function, script, source position/byte offset, async flag, and parent result-Promise link.
  • Walk direct await and plain thenable-forwarding chains with the upstream 32-hop guard; stop at combinators, invalid links, settled promises, or the configured stack limit.
  • Attach frames only to native Error instances that have neither an existing structured trace nor materialized error info; preserve user-provided/synchronous stacks.
  • Respect selected-realm stackTraceLimit, including zero, and never replace an existing VM exception.
  • Trace all live links precisely through GC and clear them on settlement/completion so no Promise/generator graph leaks.
  • Cover nested awaits, rejection from native/event-loop code, sibling realms, empty/settled/non-Promise/null inputs, chain/hop/limit boundaries, materialized stacks, existing stacks, and GC.
  • Add the export to both inventories, the compiled fixture, API/ABI docs, README evidence, and publish zero-unclassified audit counts.

This remains separate from #253: that issue registers native Promise callbacks; this one reconstructs structured async stack metadata.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions