Repository navigation
Commit 791a286
committed
feat(workspace): expose a read-only settledOutcome for other modules
Workspace precedence needs to attest which engine is actually serving a session,
and had been awaiting ensure() to get it. That is unsafe in two ways: ensure()
builds a fresh task per call and awaits the binding before resolving, so it never
returns an already-settled promise and re-registers the session entry once per
turn — mutating attach bookkeeping a caller only meant to read — and awaiting it
is unbounded, reintroducing the prompt hang the bounded whenAttached exists to
prevent.
settledOutcome(sessionID) is a pure read of state already held: no task, no
registration, no await. It returns undefined while an attach is in flight and for
a session that never attached, so callers must read undefined as "not known yet"
rather than "no engine".
3 tests: undefined before and settled after, undefined while in flight, and
repeated reads leaving the session memo, the project chain and the attach count
untouched.1 parent 9295086 commit 791a286
2 files changed
Lines changed: 54 additions & 0 deletions
File tree
- packages/opencode
- src/altimate/workspace
- test/altimate/workspace
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
939 | 939 | | |
940 | 940 | | |
941 | 941 | | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
942 | 959 | | |
943 | 960 | | |
944 | 961 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
1037 | 1038 | | |
1038 | 1039 | | |
1039 | 1040 | | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
0 commit comments